@@ -74,7 +74,7 @@ For a **complete list** of supported environment variables, refer to [this secti
74
74
// You can also pass the parameters in the constructor
75
75
// const metrics = new Metrics({
76
76
// namespace: 'serverlessAirline',
77
- // service : 'orders'
77
+ // serviceName : 'orders'
78
78
// });
79
79
```
80
80
@@ -103,7 +103,7 @@ You can create metrics using the `addMetric` method, and you can create dimensio
103
103
```typescript hl_lines="6"
104
104
import { Metrics, MetricUnits } from '@aws-lambda-powertools/metrics';
105
105
106
- const metrics = new Metrics({ namespace: 'serverlessAirline', service : 'orders' });
106
+ const metrics = new Metrics({ namespace: 'serverlessAirline', serviceName : 'orders' });
107
107
108
108
export const handler = async (_event: any, _context: any) => {
109
109
metrics.addMetric('successfulBooking', MetricUnits.Count, 1);
@@ -116,7 +116,7 @@ You can create metrics using the `addMetric` method, and you can create dimensio
116
116
```typescript hl_lines="6-7"
117
117
import { Metrics, MetricUnits } from '@aws-lambda-powertools/metrics';
118
118
119
- const metrics = new Metrics({ namespace: 'serverlessAirline', service : 'orders' });
119
+ const metrics = new Metrics({ namespace: 'serverlessAirline', serviceName : 'orders' });
120
120
121
121
export const handler = async (_event: any, _context: any) => {
122
122
metrics.addDimension('environment', 'prod');
@@ -144,7 +144,7 @@ You can call `addMetric()` with the same name multiple times. The values will be
144
144
import { Context } from 'aws-lambda';
145
145
146
146
147
- const metrics = new Metrics({namespace:"serverlessAirline", service :"orders"});
147
+ const metrics = new Metrics({namespace:"serverlessAirline", serviceName :"orders"});
148
148
149
149
export const handler = async (event: any, context: Context) => {
150
150
metrics.addMetric('performedActionA', MetricUnits.Count, 2);
@@ -198,7 +198,7 @@ You can add default dimensions to your metrics by passing them as parameters in
198
198
199
199
const metrics = new Metrics({
200
200
namespace: 'serverlessAirline',
201
- service : 'orders',
201
+ serviceName : 'orders',
202
202
defaultDimensions: { 'environment': 'prod', 'foo': 'bar' }
203
203
});
204
204
@@ -219,7 +219,7 @@ You can add default dimensions to your metrics by passing them as parameters in
219
219
import { Metrics, MetricUnits, logMetrics } from '@aws-lambda-powertools/metrics';
220
220
import middy from '@middy/core';
221
221
222
- const metrics = new Metrics({ namespace: 'serverlessAirline', service : 'orders' });
222
+ const metrics = new Metrics({ namespace: 'serverlessAirline', serviceName : 'orders' });
223
223
224
224
const lambdaHandler = async (_event: any, _context: any) => {
225
225
metrics.addMetric('successfulBooking', MetricUnits.Count, 1);
@@ -236,7 +236,7 @@ You can add default dimensions to your metrics by passing them as parameters in
236
236
```typescript hl_lines="4"
237
237
import { Metrics, MetricUnits } from '@aws-lambda-powertools/metrics';
238
238
239
- const metrics = new Metrics({ namespace: 'serverlessAirline', service : 'orders' });
239
+ const metrics = new Metrics({ namespace: 'serverlessAirline', serviceName : 'orders' });
240
240
metrics.setDefaultDimensions({ 'environment': 'prod', 'foo': 'bar' });
241
241
242
242
export const handler = async (event: any, _context: any) => {
@@ -250,7 +250,7 @@ You can add default dimensions to your metrics by passing them as parameters in
250
250
import { Metrics, MetricUnits } from '@aws-lambda-powertools/metrics';
251
251
import { LambdaInterface } from '@aws-lambda-powertools/commons';
252
252
253
- const metrics = new Metrics({ namespace: 'serverlessAirline', service : 'orders' });
253
+ const metrics = new Metrics({ namespace: 'serverlessAirline', serviceName : 'orders' });
254
254
const DEFAULT_DIMENSIONS = { 'environment': 'prod', 'foo': 'bar' };
255
255
256
256
export class MyFunction implements LambdaInterface {
@@ -297,7 +297,7 @@ You can manually flush the metrics with `publishStoredMetrics` as follows:
297
297
```typescript hl_lines="7"
298
298
import { Metrics, MetricUnits } from '@aws-lambda-powertools/metrics';
299
299
300
- const metrics = new Metrics({ namespace: 'serverlessAirline', service : 'orders' });
300
+ const metrics = new Metrics({ namespace: 'serverlessAirline', serviceName : 'orders' });
301
301
302
302
export const handler = async (_event: any, _context: any) => {
303
303
metrics.addMetric('successfulBooking', MetricUnits.Count, 10);
@@ -343,7 +343,7 @@ See below an example of how to automatically flush metrics with the Middy-compat
343
343
import { Metrics, MetricUnits, logMetrics } from '@aws-lambda-powertools/metrics';
344
344
import middy from '@middy/core';
345
345
346
- const metrics = new Metrics({ namespace: 'serverlessAirline', service : 'orders' });
346
+ const metrics = new Metrics({ namespace: 'serverlessAirline', serviceName : 'orders' });
347
347
348
348
const lambdaHandler = async (_event: any, _context: any) => {
349
349
metrics.addMetric('successfulBooking', MetricUnits.Count, 1);
@@ -394,7 +394,7 @@ The `logMetrics` decorator of the metrics utility can be used when your Lambda h
394
394
import { Metrics, MetricUnits } from '@aws-lambda-powertools/metrics';
395
395
import { LambdaInterface } from '@aws-lambda-powertools/commons';
396
396
397
- const metrics = new Metrics({ namespace: 'serverlessAirline', service : 'orders' });
397
+ const metrics = new Metrics({ namespace: 'serverlessAirline', serviceName : 'orders' });
398
398
399
399
export class MyFunction implements LambdaInterface {
400
400
@@ -439,7 +439,7 @@ If you want to ensure that at least one metric is emitted before you flush them,
439
439
import { Metrics , MetricUnits , logMetrics } from ' @aws-lambda-powertools/metrics' ;
440
440
import middy from ' @middy/core' ;
441
441
442
- const metrics = new Metrics ({ namespace: ' serverlessAirline' , service : ' orders' });
442
+ const metrics = new Metrics ({ namespace: ' serverlessAirline' , serviceName : ' orders' });
443
443
444
444
const lambdaHandler = async (_event : any , _context : any ) => {
445
445
metrics .addMetric (' successfulBooking' , MetricUnits .Count , 1 );
@@ -459,7 +459,7 @@ You can optionally capture cold start metrics with the `logMetrics` middleware o
459
459
import { Metrics, MetricUnits, logMetrics } from '@aws-lambda-powertools/metrics';
460
460
import middy from '@middy/core';
461
461
462
- const metrics = new Metrics({ namespace: 'serverlessAirline', service : 'orders' });
462
+ const metrics = new Metrics({ namespace: 'serverlessAirline', serviceName : 'orders' });
463
463
464
464
const lambdaHandler = async (_event: any, _context: any) => {
465
465
metrics.addMetric('successfulBooking', MetricUnits.Count, 1);
@@ -475,7 +475,7 @@ You can optionally capture cold start metrics with the `logMetrics` middleware o
475
475
import { Metrics, MetricUnits } from '@aws-lambda-powertools/metrics';
476
476
import { LambdaInterface } from '@aws-lambda-powertools/commons';
477
477
478
- const metrics = new Metrics({namespace: 'serverlessAirline', service : 'orders' });
478
+ const metrics = new Metrics({namespace: 'serverlessAirline', serviceName : 'orders' });
479
479
480
480
export class MyFunction implements LambdaInterface {
481
481
@@ -510,7 +510,7 @@ You can add high-cardinality data as part of your Metrics log with the `addMetad
510
510
import { Metrics, MetricUnits, logMetrics } from '@aws-lambda-powertools/metrics';
511
511
import middy from '@middy/core';
512
512
513
- const metrics = new Metrics({ namespace: 'serverlessAirline', service : 'orders' });
513
+ const metrics = new Metrics({ namespace: 'serverlessAirline', serviceName : 'orders' });
514
514
515
515
const lambdaHandler = async (_event: any, _context: any) => {
516
516
metrics.addMetric('successfulBooking', MetricUnits.Count, 1);
@@ -574,7 +574,7 @@ CloudWatch EMF uses the same dimensions across all your metrics. Use `singleMetr
574
574
import { Metrics, MetricUnits, logMetrics } from '@aws-lambda-powertools/metrics';
575
575
import middy from '@middy/core';
576
576
577
- const metrics = new Metrics({ namespace: 'serverlessAirline', service : 'orders' });
577
+ const metrics = new Metrics({ namespace: 'serverlessAirline', serviceName : 'orders' });
578
578
579
579
const lambdaHandler = async (_event: any, _context: any) => {
580
580
metrics.addDimension('metricUnit', 'milliseconds');
@@ -597,7 +597,7 @@ CloudWatch EMF uses the same dimensions across all your metrics. Use `singleMetr
597
597
import { Metrics, MetricUnits } from '@aws-lambda-powertools/metrics';
598
598
import { LambdaInterface } from '@aws-lambda-powertools/commons';
599
599
600
- const metrics = new Metrics({ namespace: 'serverlessAirline', service : 'orders' });
600
+ const metrics = new Metrics({ namespace: 'serverlessAirline', serviceName : 'orders' });
601
601
602
602
class Lambda implements LambdaInterface {
603
603
0 commit comments