Class WavefrontSpanHandler

java.lang.Object
io.micrometer.tracing.reporter.wavefront.WavefrontSpanHandler
All Implemented Interfaces:
Closeable, AutoCloseable, Runnable

public class WavefrontSpanHandler extends Object implements Runnable, Closeable
This converts a span recorded by Micrometer Tracing and invokes WavefrontTracingSpanSender.sendSpan(java.lang.String, long, long, java.lang.String, java.util.UUID, java.util.UUID, java.util.List<java.util.UUID>, java.util.List<java.util.UUID>, java.util.List<com.wavefront.sdk.common.Pair<java.lang.String, java.lang.String>>, java.util.List<com.wavefront.sdk.entities.tracing.SpanLog>).

This uses a combination of conversion approaches from Wavefront projects:

  • https://github.com/wavefrontHQ/wavefront-opentracing-sdk-java
  • https://github.com/wavefrontHQ/wavefront-proxy

On conflict, we make a comment and prefer wavefront-opentracing-sdk-java. The rationale is wavefront-opentracing-sdk-java uses the same WavefrontTracingSpanSender.sendSpan(java.lang.String, long, long, java.lang.String, java.util.UUID, java.util.UUID, java.util.List<java.util.UUID>, java.util.List<java.util.UUID>, java.util.List<com.wavefront.sdk.common.Pair<java.lang.String, java.lang.String>>, java.util.List<com.wavefront.sdk.entities.tracing.SpanLog>) library, so it is easier to reason with. This policy can be revisited by future maintainers.

Note:UUID conversions follow the same conventions used in practice in Wavefront. Ex. https://github.com/wavefrontHQ/wavefront-opentracing-sdk-java/blob/6babf2ff95daa37452e1e8c35ae54b58b6abb50f/src/main/java/com/wavefront/opentracing/propagation/JaegerWavefrontPropagator.java#L191-L204 While in practice this is not a problem, it is worth mentioning that this convention will only result in RFC 4122 timestamp (version 1) format by accident. In other words, don't call UUID.timestamp() on UUIDs converted here, or in other Wavefront code, as it might throw an exception.

Since:
1.0.0
  • Constructor Summary

    Constructors
    Constructor
    Description
    WavefrontSpanHandler(int maxQueueSize, com.wavefront.sdk.common.WavefrontSender wavefrontSender, SpanMetrics spanMetrics, String source, com.wavefront.sdk.common.application.ApplicationTags applicationTags, Set<String> redMetricsCustomTagKeys)
    Creates a new instance of WavefrontSpanHandler.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    boolean
    end(io.micrometer.tracing.TraceContext context, io.micrometer.tracing.exporter.FinishedSpan span)
    Exact same behavior as WavefrontSpanReporter.
    void
    run()
     

    Methods inherited from class java.lang.Object

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

    • WavefrontSpanHandler

      public WavefrontSpanHandler(int maxQueueSize, com.wavefront.sdk.common.WavefrontSender wavefrontSender, SpanMetrics spanMetrics, String source, com.wavefront.sdk.common.application.ApplicationTags applicationTags, Set<String> redMetricsCustomTagKeys)
      Creates a new instance of WavefrontSpanHandler.
      Parameters:
      maxQueueSize - maximal span queue size
      wavefrontSender - wavefront server
      spanMetrics - span metrics
      source - source of metrics and spans
      applicationTags - additional application tags
      redMetricsCustomTagKeys - RED metrics custom tag keys
  • Method Details

    • end

      public boolean end(io.micrometer.tracing.TraceContext context, io.micrometer.tracing.exporter.FinishedSpan span)
      Exact same behavior as WavefrontSpanReporter. https://github.com/wavefrontHQ/wavefront-opentracing-sdk-java/blob/f1f08d8daf7b692b9b61dcd5bc24ca6befa8e710/src/main/java/com/wavefront/opentracing/reporting/WavefrontSpanReporter.java#L163-L179
      Parameters:
      context - trace context
      span - reported span
      Returns:
      should other handler be ran
    • run

      public void run()
      Specified by:
      run in interface Runnable
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable