Class AbstractMetricsMiddleware

java.lang.Object
com.networknt.aws.lambda.handler.middleware.metrics.AbstractMetricsMiddleware
All Implemented Interfaces:
LambdaHandler, MiddlewareHandler
Direct Known Subclasses:
APMMetricsMiddleware, InfluxMetricsMiddleware

public abstract class AbstractMetricsMiddleware extends Object implements MiddlewareHandler
  • Field Details

    • config

      public static com.networknt.metrics.MetricsConfig config
    • registry

      public static final io.dropwizard.metrics.MetricRegistry registry
    • commonTags

      public Map<String,String> commonTags
  • Constructor Details

    • AbstractMetricsMiddleware

      public AbstractMetricsMiddleware()
  • Method Details

    • isEnabled

      public boolean isEnabled()
      Description copied from interface: LambdaHandler
      Indicate if this handler is enabled or not.
      Specified by:
      isEnabled in interface LambdaHandler
      Returns:
      boolean true if enabled
    • createJVMMetricsReporter

      public void createJVMMetricsReporter(com.networknt.metrics.TimeSeriesDbSender sender)
    • incCounterForStatusCode

      public void incCounterForStatusCode(int statusCode, Map<String,String> commonTags, Map<String,String> tags)
    • injectMetrics

      public void injectMetrics(LightLambdaExchange exchange, long startTime, String metricsName, String endpoint)
      This is the method that is used for all other handlers to inject its metrics info to the real metrics handler impl.
      Parameters:
      exchange - the LightLambdaExchange that is used to get the auditInfo to collect the metrics tag.
      startTime - the start time passed in to calculate the response time.
      metricsName - the name of the metrics that is collected.
      endpoint - the endpoint that is used to collect the metrics. It is optional and only provided by the external handlers.