Skip to content

Commit ead827b

Browse files
committed
Rename back namespace to ServerlessAirline example.
1 parent 4085b0d commit ead827b

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

docs/core/metrics.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ These metrics can be visualized through [Amazon CloudWatch Console](https://aws.
1919

2020
If you're new to Amazon CloudWatch, there are some terminologies you must be aware of before using this utility:
2121

22-
- **Namespace**. It's the highest level container that will group multiple metrics from multiple services for a given application, for example `e-commerce-app`.
22+
- **Namespace**. It's the highest level container that will group multiple metrics from multiple services for a given application, for example `ServerlessAirline`.
2323
- **Dimensions**. Metrics metadata in key-value format. They help you slice and dice metrics visualization, for example `ColdStart` metric by `service`.
24-
- **Metric**. It's the name of the metric, for example: `CartUpdated` or `ProductAdded`.
24+
- **Metric**. It's the name of the metric, for example: `SuccessfulBooking` or `UpdatedBooking`.
2525
- **Unit**. It's a value representing the unit of measure for the corresponding metric, for example: `Count` or `Seconds`.
2626
- **Resolution**. It's a value representing the storage resolution for the corresponding metric. Metrics can be either `Standard` or `High` resolution. Read more about CloudWatch Periods [here](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch_concepts.html#Resolution_definition).
2727

@@ -155,7 +155,7 @@ Metrics has two global settings that will be used across all metrics emitted. Us
155155
private static final MetricsLogger metricsLogger = MetricsLoggerFactory.getMetricsLogger();
156156

157157
@Override
158-
@Metrics(namespace = "e-commerce-app", service = "product-service")
158+
@Metrics(namespace = "ServerlessAirline", service = "payment")
159159
public Object handleRequest(Object input, Context context) {
160160
// ...
161161
}
@@ -183,7 +183,7 @@ You can create metrics using `addMetric`, and manually create dimensions for all
183183
private static final MetricsLogger metricsLogger = MetricsLoggerFactory.getMetricsLogger();
184184

185185
@Override
186-
@Metrics(namespace = "e-commerce-app", service = "product-service")
186+
@Metrics(namespace = "ServerlessAirline", service = "payment")
187187
public Object handleRequest(Object input, Context context) {
188188
metricsLogger.addDimension("environment", "prod");
189189
metricsLogger.addMetric("SuccessfulBooking", 1, MetricUnit.COUNT);
@@ -216,7 +216,7 @@ passing a `MetricResolution.HIGH` to the `addMetric` method:
216216
private static final MetricsLogger metricsLogger = MetricsLoggerFactory.getMetricsLogger();
217217

218218
@Override
219-
@Metrics(namespace = "e-commerce-app", service = "product-service")
219+
@Metrics(namespace = "ServerlessAirline", service = "payment")
220220
public Object handleRequest(Object input, Context context) {
221221
// ...
222222
metricsLogger.addMetric("SuccessfulBooking", 1, MetricUnit.COUNT, MetricResolution.HIGH);
@@ -328,7 +328,7 @@ You can use `addMetadata` for advanced use cases, where you want to add metadata
328328
private static final MetricsLogger metricsLogger = MetricsLoggerFactory.getMetricsLogger();
329329

330330
@Override
331-
@Metrics(namespace = "e-commerce-app", service = "booking-service")
331+
@Metrics(namespace = "ServerlessAirline", service = "booking-service")
332332
public Object handleRequest(Object input, Context context) {
333333
metricsLogger.addMetric("CustomMetric1", 1, MetricUnit.COUNT);
334334
metricsLogger.addMetadata("booking_id", "1234567890");
@@ -358,7 +358,7 @@ If you wish to set custom default dimensions, it can be done via `#!java metrics
358358
private static final MetricsLogger metricsLogger = MetricsLoggerFactory.getMetricsLogger();
359359

360360
@Override
361-
@Metrics(namespace = "e-commerce-app", service = "product-service")
361+
@Metrics(namespace = "ServerlessAirline", service = "payment")
362362
public Object handleRequest(Object input, Context context) {
363363
metricsLogger.setDefaultDimensions(Map.of("CustomDimension", "booking", "Environment", "prod"));
364364
...
@@ -381,7 +381,7 @@ If you wish to set custom default dimensions, it can be done via `#!java metrics
381381
.build();
382382

383383
@Override
384-
@Metrics(namespace = "e-commerce-app", service = "product-service")
384+
@Metrics(namespace = "ServerlessAirline", service = "payment")
385385
public Object handleRequest(Object input, Context context) {
386386
metricsLogger.addMetric("CustomMetric1", 1, MetricUnit.COUNT);
387387
...
@@ -410,7 +410,7 @@ You can create a single metric with its own namespace and dimensions using `push
410410
private static final MetricsLogger metricsLogger = MetricsLoggerFactory.getMetricsLogger();
411411

412412
@Override
413-
@Metrics(namespace = "e-commerce-app", service = "product-service")
413+
@Metrics(namespace = "ServerlessAirline", service = "payment")
414414
public Object handleRequest(Object input, Context context) {
415415
metricsLogger.pushSingleMetric(
416416
"CustomMetric",
@@ -449,9 +449,9 @@ The following example shows how to configure a custom `MetricsLogger` using the
449449
public class App implements RequestHandler<Object, Object> {
450450
// Create and configure a MetricsLogger singleton without annotation
451451
private static final MetricsLogger customLogger = MetricsLoggerBuilder.builder()
452-
.withNamespace("e-commerce-app")
452+
.withNamespace("ServerlessAirline")
453453
.withRaiseOnEmptyMetrics(true)
454-
.withService("product-service")
454+
.withService("payment")
455455
.build();
456456

457457
@Override

0 commit comments

Comments
 (0)