001package io.prometheus.metrics.tracer.common;
002
003import javax.annotation.Nullable;
004
005public interface SpanContext {
006
007  String EXEMPLAR_ATTRIBUTE_NAME = "exemplar";
008  String EXEMPLAR_ATTRIBUTE_VALUE = "true";
009
010  /**
011   * @return the current trace id, or {@code null} if this call is not happening within a span
012   *     context.
013   */
014  @Nullable
015  String getCurrentTraceId();
016
017  /**
018   * @return the current span id, or {@code null} if this call is not happening within a span
019   *     context.
020   */
021  @Nullable
022  String getCurrentSpanId();
023
024  /**
025   * @return the state of the current Span. If this value is false a component before in the chain
026   *     take the decision to not record it. Subsequent calling service have to respect this value
027   *     in order not to have partial TraceID with only some Span in it. This value is important to
028   *     be sure to choose a recorded Trace in Examplar sampling process
029   */
030  boolean isCurrentSpanSampled();
031
032  void markCurrentSpanAsExemplar();
033}