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 Summary
Fields Modifier and Type Field Description Map<String,String>commonTagsstatic com.networknt.metrics.MetricsConfigconfigstatic io.dropwizard.metrics.MetricRegistryregistry-
Fields inherited from interface com.networknt.aws.lambda.handler.LambdaHandler
DISABLED_LAMBDA_HANDLER_RETURN, SUCCESS_LAMBDA_HANDLER_RETURN
-
-
Constructor Summary
Constructors Constructor Description AbstractMetricsMiddleware()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcreateJVMMetricsReporter(com.networknt.metrics.TimeSeriesDbSender sender)voidincCounterForStatusCode(int statusCode, Map<String,String> commonTags, Map<String,String> tags)voidinjectMetrics(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.booleanisEnabled()Indicate if this handler is enabled or not.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.networknt.aws.lambda.handler.LambdaHandler
disabledMiddlewareStatus, execute, isAsynchronous, isResponseMiddleware, register, reload, successMiddlewareStatus
-
Methods inherited from interface com.networknt.aws.lambda.handler.MiddlewareHandler
getCachedConfigurations, isAudited, isContinueOnFailure
-
-
-
-
Method Detail
-
isEnabled
public boolean isEnabled()
Description copied from interface:LambdaHandlerIndicate if this handler is enabled or not.- Specified by:
isEnabledin interfaceLambdaHandler- 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.
-
-