Package brave

Interface SpanCustomizer

All Known Implementing Classes:
CurrentSpanCustomizer, NoopSpanCustomizer, Span

public interface SpanCustomizer
Simple interface users can customize a span with. For example, this can add custom tags useful in looking up spans.

This type is safer to expose directly to users than Span, as it has no hooks that can affect the span lifecycle.

While unnecessary when tagging constants, guard potentially expensive operations on the NoopSpanCustomizer type.

Ex.


 if (!(customizer instanceof NoopSpanCustomizer)) {
   customizer.tag("summary", computeSummary());
 }
 
  • Method Summary

    Modifier and Type Method Description
    SpanCustomizer annotate​(String value)
    Associates an event that explains latency with the current system time.
    SpanCustomizer name​(String name)
    Sets the string name for the logical operation this span represents.
    SpanCustomizer tag​(String key, String value)
    Tags give your span context for search, viewing and analysis.
  • Method Details

    • name

      SpanCustomizer name​(String name)
      Sets the string name for the logical operation this span represents.
    • tag

      SpanCustomizer tag​(String key, String value)
      Tags give your span context for search, viewing and analysis. For example, a key "your_app.version" would let you lookup spans by version. A tag "sql.query" isn't searchable, but it can help in debugging when viewing a trace.
      Parameters:
      key - Name used to lookup spans, such as "your_app.version".
      value - String value, cannot be null.
    • annotate

      SpanCustomizer annotate​(String value)
      Associates an event that explains latency with the current system time.
      Parameters:
      value - A short tag indicating the event, like "finagle.retry"