Class Emf
java.lang.Object
codes.grow.packages.cloudwatchlogs.Emf
CloudWatch Embedded Metric Format (EMF) documents (API.md section 2.2). An EMF document is a JSON
log event that CloudWatch turns into a metric; the SDK only builds and sends it, metric
extraction happens inside AWS.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordOptions ofbuild(java.lang.String, double, java.util.Map<java.lang.String, java.lang.String>, codes.grow.packages.cloudwatchlogs.Emf.Options)andCloudWatchLogsClient.emf. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringDefault EMF namespace.Units accepted by CloudWatch metrics. -
Method Summary
Modifier and TypeMethodDescriptionBuilds an EMF document for one metric value.Builds an EMF document for 1–100 values of one metric.static StringSerialises a document to its JSON log message.
-
Field Details
-
UNITS
Units accepted by CloudWatch metrics. -
DEFAULT_NAMESPACE
Default EMF namespace.- See Also:
-
-
Method Details
-
build
public static Map<String,Object> build(String metric, double value, Map<String, String> dimensions, Emf.Options options) Builds an EMF document for one metric value.- Parameters:
metric- metric name (1–1024 characters)value- finite valuedimensions- at most 30 dimensions (one dimension set)options- namespace, unit, timestamp, properties- Returns:
- the document (insertion-ordered map)
- Throws:
ValidationException- on invalid input
-
build
public static Map<String,Object> build(String metric, List<Double> values, Map<String, String> dimensions, Emf.Options options) Builds an EMF document for 1–100 values of one metric.- Parameters:
metric- metric name (1–1024 characters)values- 1–100 finite valuesdimensions- at most 30 dimensions (one dimension set)options- namespace, unit, timestamp, properties- Returns:
- the document (insertion-ordered map)
- Throws:
ValidationException- on invalid input
-
toJson
Serialises a document to its JSON log message.- Parameters:
document- an EMF document- Returns:
- the JSON text
-