Class AwsSpanMetricsProcessor

java.lang.Object
io.opentelemetry.contrib.awsxray.AwsSpanMetricsProcessor
All Implemented Interfaces:
io.opentelemetry.sdk.trace.SpanProcessor, Closeable, AutoCloseable

@Immutable public final class AwsSpanMetricsProcessor extends Object implements io.opentelemetry.sdk.trace.SpanProcessor
This processor will generate metrics based on span data. It depends on a MetricAttributeGenerator being provided on instantiation, which will provide a means to determine attributes which should be used to create metrics. A Resource must also be provided, which is used to generate metrics. Finally, two LongCounter's and a DoubleHistogram must be provided, which will be used to actually create desired metrics (see below)

AwsSpanMetricsProcessor produces metrics for errors (e.g. HTTP 4XX status codes), faults (e.g. HTTP 5XX status codes), and latency (in Milliseconds). Errors and faults are counted, while latency is measured with a histogram. Metrics are emitted with attributes derived from span attributes.

For highest fidelity metrics, this processor should be coupled with the AlwaysRecordSampler, which will result in 100% of spans being sent to the processor.

  • Method Details

    • onStart

      public void onStart(io.opentelemetry.context.Context parentContext, io.opentelemetry.sdk.trace.ReadWriteSpan span)
      Specified by:
      onStart in interface io.opentelemetry.sdk.trace.SpanProcessor
    • isStartRequired

      public boolean isStartRequired()
      Specified by:
      isStartRequired in interface io.opentelemetry.sdk.trace.SpanProcessor
    • onEnd

      public void onEnd(io.opentelemetry.sdk.trace.ReadableSpan span)
      Specified by:
      onEnd in interface io.opentelemetry.sdk.trace.SpanProcessor
    • isEndRequired

      public boolean isEndRequired()
      Specified by:
      isEndRequired in interface io.opentelemetry.sdk.trace.SpanProcessor