public interface MetricsScope
Ordering contract: All addDimension(java.lang.String, java.lang.String) calls should be made before any
addData(java.lang.String, double, software.amazon.awssdk.services.cloudwatch.model.StandardUnit) calls. Some implementations (e.g., OtelMetricsScope) record observations
immediately on addData with the dimensions accumulated so far. Dimensions added after addData
may not be attached to earlier observations.
// TODO: Consider extending AutoCloseable so callers can use try-with-resources
// instead of manual try/finally with end(). This would help ensure end() is
// always called and reduce boilerplate across the codebase.
| Modifier and Type | Field and Description |
|---|---|
static String |
METRICS_DIMENSIONS_ALL
Value that signifies that all dimensions are allowed for the metrics scope.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addData(String name,
double value,
software.amazon.awssdk.services.cloudwatch.model.StandardUnit unit)
Adds a data point to this IMetricsScope.
|
void |
addData(String name,
double value,
software.amazon.awssdk.services.cloudwatch.model.StandardUnit unit,
MetricsLevel level)
Adds a data point to this IMetricsScope if given metrics level is enabled.
|
void |
addDimension(String name,
String value)
Adds a dimension that applies to all metrics in this IMetricsScope.
|
void |
end()
Flushes the data from this IMetricsScope and causes future calls to addData and addDimension to fail.
|
static final String METRICS_DIMENSIONS_ALL
void addData(String name, double value, software.amazon.awssdk.services.cloudwatch.model.StandardUnit unit)
name - data point namevalue - data point valueunit - unit of data pointvoid addData(String name, double value, software.amazon.awssdk.services.cloudwatch.model.StandardUnit unit, MetricsLevel level)
name - data point namevalue - data point valueunit - unit of data pointlevel - metrics level of this data pointvoid addDimension(String name, String value)
name - dimension namevalue - dimension valuevoid end()
Copyright © 2026. All rights reserved.