Class EmfMetricLoggingPublisher
- java.lang.Object
-
- software.amazon.awssdk.metrics.publishers.emf.EmfMetricLoggingPublisher
-
- All Implemented Interfaces:
AutoCloseable,MetricPublisher,SdkAutoCloseable
@ThreadSafe @Immutable public final class EmfMetricLoggingPublisher extends Object implements MetricPublisher
A metric publisher implementation that converts metrics into CloudWatch Embedded Metric Format (EMF). EMF allows metrics to be published through CloudWatch Logs using a structured JSON format, which CloudWatch automatically extracts and processes into metrics.This publisher is particularly well-suited for serverless environments like AWS Lambda and container environments like Amazon ECS that have built-in integration with CloudWatch Logs. Using EMF eliminates the need for separate metric publishing infrastructure as metrics are automatically extracted from log entries.
The EMF publisher converts metric collections into JSON-formatted log entries that conform to the CloudWatch EMF specification. The logGroupName field is required for EMF to work. CloudWatch automatically processes these logs to generate corresponding metrics that can be used for monitoring and alerting.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classEmfMetricLoggingPublisher.Builder
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static EmfMetricLoggingPublisher.Builderbuilder()voidclose()Closes this metric publisher.voidpublish(MetricCollection metricCollection)
-
-
-
Method Detail
-
builder
public static EmfMetricLoggingPublisher.Builder builder()
-
publish
public void publish(MetricCollection metricCollection)
- Specified by:
publishin interfaceMetricPublisher
-
close
public void close()
Closes this metric publisher. This implementation is empty as the EMF metric logging publisher does not maintain any resources that require explicit cleanup.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceMetricPublisher- Specified by:
closein interfaceSdkAutoCloseable
-
-