Interface OperationListener

All Known Implementing Classes:
HttpClientMetrics, HttpServerMetrics

public interface OperationListener
A listener of the start and end of an instrumented operation. The onStart(Context, Attributes, long) methods will be called as early as possible in the processing of a request; and the onEnd(Context, Attributes, long) method will be called as late as possible when finishing the processing of a response. These correspond to the start and end of a span when tracing.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    onEnd(io.opentelemetry.context.Context context, io.opentelemetry.api.common.Attributes endAttributes, long endNanos)
    Listener method that is called at the end of an instrumented operation.
    io.opentelemetry.context.Context
    onStart(io.opentelemetry.context.Context context, io.opentelemetry.api.common.Attributes startAttributes, long startNanos)
    Listener method that is called at the start of an instrumented operation.
  • Method Details

    • onStart

      io.opentelemetry.context.Context onStart(io.opentelemetry.context.Context context, io.opentelemetry.api.common.Attributes startAttributes, long startNanos)
      Listener method that is called at the start of an instrumented operation. If any state needs to be kept between the start and end of the processing, e.g., an in-progress span, it should be added to the passed in Context and returned.
      Parameters:
      startNanos - The nanosecond timestamp marking the start of the operation. Can be used to compute the duration of the entire operation.
    • onEnd

      void onEnd(io.opentelemetry.context.Context context, io.opentelemetry.api.common.Attributes endAttributes, long endNanos)
      Listener method that is called at the end of an instrumented operation.
      Parameters:
      endNanos - The nanosecond timestamp marking the end of the operation. Can be used to compute the duration of the entire operation.