java.lang.Object
codes.grow.packages.cloudwatchlogs.Emf

public final class Emf extends Object
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.
  • Field Details

    • UNITS

      public static final List<String> UNITS
      Units accepted by CloudWatch metrics.
    • DEFAULT_NAMESPACE

      public static final String 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 value
      dimensions - 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 values
      dimensions - at most 30 dimensions (one dimension set)
      options - namespace, unit, timestamp, properties
      Returns:
      the document (insertion-ordered map)
      Throws:
      ValidationException - on invalid input
    • toJson

      public static String toJson(Map<String,Object> document)
      Serialises a document to its JSON log message.
      Parameters:
      document - an EMF document
      Returns:
      the JSON text