@@ -107,40 +107,40 @@ public Object around(ProceedingJoinPoint pjp,
107107 return pjp .proceed (proceedArgs );
108108 }
109109
110- private void captureColdStartMetricIfEnabled (Context extractedContext , FlushMetrics metrics ) {
110+ private void captureColdStartMetricIfEnabled (Context extractedContext , FlushMetrics flushMetrics ) {
111111 if (extractedContext == null ) {
112112 return ;
113113 }
114114
115- Metrics metricsInstance = MetricsFactory .getMetricsInstance ();
115+ Metrics metrics = MetricsFactory .getMetricsInstance ();
116116 // This can be null e.g. during unit tests when mocking the Lambda context
117117 if (extractedContext .getAwsRequestId () != null ) {
118- metricsInstance .addProperty (REQUEST_ID_PROPERTY , extractedContext .getAwsRequestId ());
118+ metrics .addProperty (REQUEST_ID_PROPERTY , extractedContext .getAwsRequestId ());
119119 }
120120
121121 // Only capture cold start metrics if enabled on annotation
122- if (metrics .captureColdStart ()) {
122+ if (flushMetrics .captureColdStart ()) {
123123 // Get function name from annotation or context
124- String funcName = functionName (metrics , extractedContext );
124+ String funcName = functionName (flushMetrics , extractedContext );
125125
126- DimensionSet coldStartDimensions = new DimensionSet ();
126+ DimensionSet dimensionSet = new DimensionSet ();
127127
128128 // Get service name from metrics instance default dimensions or fallback
129- String serviceName = metricsInstance .getDefaultDimensions ().getDimensions ().getOrDefault (
129+ String serviceName = metrics .getDefaultDimensions ().getDimensions ().getOrDefault (
130130 SERVICE_DIMENSION ,
131- serviceNameWithFallback (metrics ));
131+ serviceNameWithFallback (flushMetrics ));
132132
133133 // Only add service if it is not undefined
134134 if (!LambdaConstants .SERVICE_UNDEFINED .equals (serviceName )) {
135- coldStartDimensions .addDimension (SERVICE_DIMENSION , serviceName );
135+ dimensionSet .addDimension (SERVICE_DIMENSION , serviceName );
136136 }
137137
138138 // Add function name
139139 if (funcName != null ) {
140- coldStartDimensions .addDimension ("FunctionName" , funcName );
140+ dimensionSet .addDimension ("FunctionName" , funcName );
141141 }
142142
143- metricsInstance .captureColdStartMetric (extractedContext , coldStartDimensions );
143+ metrics .captureColdStartMetric (extractedContext , dimensionSet );
144144 }
145145 }
146146}
0 commit comments