@@ -43,7 +43,7 @@ const DEFAULT_NAMESPACE = 'default_namespace';
4343 * import { Metrics, MetricUnits } from '@aws-lambda-powertools/metrics';
4444 * import { Callback, Context } from 'aws-lambda';
4545 *
46- * const metrics = new Metrics({namespace:"MyService", service :"withDecorator"});
46+ * const metrics = new Metrics({namespace:"MyService", serviceName :"withDecorator"});
4747 *
4848 * export class MyFunctionWithDecorator {
4949 *
@@ -70,7 +70,7 @@ const DEFAULT_NAMESPACE = 'default_namespace';
7070 * ```typescript
7171 * import { Metrics, MetricUnits } from '@aws-lambda-powertools/metrics';
7272 *
73- * const metrics = new Metrics({namespace: "MyService", service : "MyFunction"});
73+ * const metrics = new Metrics({namespace: "MyService", serviceName : "MyFunction"});
7474 *
7575 * export const handler = async (_event: any, _context: any) => {
7676 * metrics.captureColdStart();
@@ -164,7 +164,7 @@ class Metrics implements MetricsInterface {
164164 * import { Metrics, MetricUnits } from '@aws-lambda-powertools/metrics';
165165 * import { Context } from 'aws-lambda';
166166 *
167- * const metrics = new Metrics({namespace:"serverlessAirline", service :"orders"});
167+ * const metrics = new Metrics({namespace:"serverlessAirline", serviceName :"orders"});
168168 *
169169 * export const handler = async (event: any, context: Context) => {
170170 * metrics.captureColdStartMetric();
@@ -210,7 +210,7 @@ class Metrics implements MetricsInterface {
210210 * import { Metrics, MetricUnits } from '@aws-lambda-powertools/metrics';
211211 * import { Callback, Context } from 'aws-lambda';
212212 *
213- * const metrics = new Metrics({namespace:"CDKExample", service :"withDecorator"});
213+ * const metrics = new Metrics({namespace:"CDKExample", serviceName :"withDecorator"});
214214 *
215215 * export class MyFunctionWithDecorator {
216216 *
@@ -267,7 +267,7 @@ class Metrics implements MetricsInterface {
267267 * ```typescript
268268 * import { Metrics, MetricUnits } from '@aws-lambda-powertools/metrics';
269269 *
270- * const metrics = new Metrics({namespace: "CDKExample", service : "MyFunction"}); // Sets metric namespace, and service as a metric dimension
270+ * const metrics = new Metrics({namespace: "CDKExample", serviceName : "MyFunction"}); // Sets metric namespace, and service as a metric dimension
271271 *
272272 * export const handler = async (_event: any, _context: any) => {
273273 * metrics.addMetric('test-metric', MetricUnits.Count, 10);
@@ -290,7 +290,7 @@ class Metrics implements MetricsInterface {
290290 * import { Metrics, MetricUnits } from '@aws-lambda-powertools/metrics';
291291 * import { Context } from 'aws-lambda';
292292 *
293- * const metrics = new Metrics({namespace:"serverlessAirline", service :"orders"});
293+ * const metrics = new Metrics({namespace:"serverlessAirline", serviceName :"orders"});
294294 *
295295 * export const handler = async (event: any, context: Context) => {
296296 * metrics.raiseOnEmptyMetrics();
@@ -380,7 +380,7 @@ class Metrics implements MetricsInterface {
380380 public singleMetric ( ) : Metrics {
381381 return new Metrics ( {
382382 namespace : this . namespace ,
383- service : this . dimensions . service ,
383+ serviceName : this . dimensions . service ,
384384 defaultDimensions : this . defaultDimensions ,
385385 singleMetric : true ,
386386 } ) ;
@@ -427,12 +427,12 @@ class Metrics implements MetricsInterface {
427427 }
428428
429429 private setOptions ( options : MetricsOptions ) : Metrics {
430- const { customConfigService, namespace, service , singleMetric, defaultDimensions } = options ;
430+ const { customConfigService, namespace, serviceName , singleMetric, defaultDimensions } = options ;
431431
432432 this . setEnvVarsService ( ) ;
433433 this . setCustomConfigService ( customConfigService ) ;
434434 this . setNamespace ( namespace ) ;
435- this . setService ( service ) ;
435+ this . setService ( serviceName ) ;
436436 this . setDefaultDimensions ( defaultDimensions ) ;
437437 this . isSingleMetric = singleMetric || false ;
438438
0 commit comments