@@ -42,7 +42,7 @@ const DEFAULT_NAMESPACE = 'default_namespace';
42
42
* import { Metrics, MetricUnits } from '@aws-lambda-powertools/metrics';
43
43
* import { Callback, Context } from 'aws-lambda';
44
44
*
45
- * const metrics = new Metrics({namespace:"MyService", service :"withDecorator"});
45
+ * const metrics = new Metrics({namespace:"MyService", serviceName :"withDecorator"});
46
46
*
47
47
* export class MyFunctionWithDecorator {
48
48
*
@@ -69,7 +69,7 @@ const DEFAULT_NAMESPACE = 'default_namespace';
69
69
* ```typescript
70
70
* import { Metrics, MetricUnits } from '@aws-lambda-powertools/metrics';
71
71
*
72
- * const metrics = new Metrics({namespace: "MyService", service : "MyFunction"});
72
+ * const metrics = new Metrics({namespace: "MyService", serviceName : "MyFunction"});
73
73
*
74
74
* export const handler = async (_event: any, _context: any) => {
75
75
* metrics.captureColdStart();
@@ -163,7 +163,7 @@ class Metrics implements MetricsInterface {
163
163
* import { Metrics, MetricUnits } from '@aws-lambda-powertools/metrics';
164
164
* import { Context } from 'aws-lambda';
165
165
*
166
- * const metrics = new Metrics({namespace:"serverlessAirline", service :"orders"});
166
+ * const metrics = new Metrics({namespace:"serverlessAirline", serviceName :"orders"});
167
167
*
168
168
* export const handler = async (event: any, context: Context) => {
169
169
* metrics.captureColdStartMetric();
@@ -209,7 +209,7 @@ class Metrics implements MetricsInterface {
209
209
* import { Metrics, MetricUnits } from '@aws-lambda-powertools/metrics';
210
210
* import { Callback, Context } from 'aws-lambda';
211
211
*
212
- * const metrics = new Metrics({namespace:"CDKExample", service :"withDecorator"});
212
+ * const metrics = new Metrics({namespace:"CDKExample", serviceName :"withDecorator"});
213
213
*
214
214
* export class MyFunctionWithDecorator {
215
215
*
@@ -260,7 +260,7 @@ class Metrics implements MetricsInterface {
260
260
* ```typescript
261
261
* import { Metrics, MetricUnits } from '@aws-lambda-powertools/metrics';
262
262
*
263
- * const metrics = new Metrics({namespace: "CDKExample", service : "MyFunction"}); // Sets metric namespace, and service as a metric dimension
263
+ * const metrics = new Metrics({namespace: "CDKExample", serviceName : "MyFunction"}); // Sets metric namespace, and service as a metric dimension
264
264
*
265
265
* export const handler = async (_event: any, _context: any) => {
266
266
* metrics.addMetric('test-metric', MetricUnits.Count, 10);
@@ -283,7 +283,7 @@ class Metrics implements MetricsInterface {
283
283
* import { Metrics, MetricUnits } from '@aws-lambda-powertools/metrics';
284
284
* import { Context } from 'aws-lambda';
285
285
*
286
- * const metrics = new Metrics({namespace:"serverlessAirline", service :"orders"});
286
+ * const metrics = new Metrics({namespace:"serverlessAirline", serviceName :"orders"});
287
287
*
288
288
* export const handler = async (event: any, context: Context) => {
289
289
* metrics.raiseOnEmptyMetrics();
@@ -373,7 +373,7 @@ class Metrics implements MetricsInterface {
373
373
public singleMetric ( ) : Metrics {
374
374
return new Metrics ( {
375
375
namespace : this . namespace ,
376
- service : this . dimensions . service ,
376
+ serviceName : this . dimensions . service ,
377
377
defaultDimensions : this . defaultDimensions ,
378
378
singleMetric : true ,
379
379
} ) ;
@@ -420,12 +420,12 @@ class Metrics implements MetricsInterface {
420
420
}
421
421
422
422
private setOptions ( options : MetricsOptions ) : Metrics {
423
- const { customConfigService, namespace, service , singleMetric, defaultDimensions } = options ;
423
+ const { customConfigService, namespace, serviceName , singleMetric, defaultDimensions } = options ;
424
424
425
425
this . setEnvVarsService ( ) ;
426
426
this . setCustomConfigService ( customConfigService ) ;
427
427
this . setNamespace ( namespace ) ;
428
- this . setService ( service ) ;
428
+ this . setService ( serviceName ) ;
429
429
this . setDefaultDimensions ( defaultDimensions ) ;
430
430
this . isSingleMetric = singleMetric || false ;
431
431
0 commit comments