Class EMFMetricFormatter

  • All Implemented Interfaces:

    public class EMFMetricFormatter
    extends java.lang.Object
    implements MetricFormatter
    Creates metrics based on a Segment.

    These metrics are published to CloudWatch via a structured log through CloudWatch Logs. These logs are created in the ServiceMetricsSDK log group.

    In addition to the metrics describe below these logs contain properties to enable correlation with Traces.

    • Timestamp: The end time of the segment, used for the timestamp of the generated metric.
    • TraceId: The Trace ID

    Metrics are published to the ServiceMetrics/SDK namespace with dimensions:

    • ServiceType: The Segment Origin
    • ServiceName: The Segment Name

    The following metrics will be reported:

    • Latency: The difference between Start and End time in milliseconds
    • ErrorRate: 1 if the segment is marked as an error, zero otherwise.
    • FaultRate: 1 if the segment is marked as an fault, zero otherwise.
    • ThrottleRate: 1 if the segment is marked as throttled, zero otherwise.
    • OkRate: 1 if no other statuses are set, zero otherwise.

    Rate metrics above may be used with the CloudWatch AVG statistic to get a percentage of requests in a category or may be used as a SUM. COUNT of Latency represents the total count of invocations of this segment.

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String formatSegment​(Segment segment)
      Converts a segment into a metric string.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • EMFMetricFormatter

        public EMFMetricFormatter()
    • Method Detail

      • formatSegment

        public java.lang.String formatSegment​(Segment segment)
        Description copied from interface: MetricFormatter
        Converts a segment into a metric string.
        Specified by:
        formatSegment in interface MetricFormatter
        segment - Segment to format into metrics
        a string representation of the Segment