Package io.sentry

Class SpanContext

java.lang.Object
io.sentry.SpanContext
All Implemented Interfaces:
JsonSerializable, JsonUnknown
Direct Known Subclasses:
TransactionContext

public class SpanContext extends Object implements JsonUnknown, JsonSerializable
  • Field Details

    • TYPE

      public static final String TYPE
      See Also:
    • op

      @NotNull protected @NotNull String op
      Short code identifying the type of operation the span is measuring.
    • description

      @Nullable protected @Nullable String description
      Longer description of the span's operation, which uniquely identifies the span but is consistent across instances of the span.
    • status

      @Nullable protected @Nullable SpanStatus status
      Describes the status of the Transaction.
    • tags

      @NotNull protected @NotNull Map<String,@NotNull String> tags
      A map or list of tags for this event. Each tag must be less than 200 characters.
    • origin

      @Nullable protected @Nullable String origin
      Describes the status of the Transaction.
  • Constructor Details

    • SpanContext

      public SpanContext(@NotNull @NotNull String operation, @Nullable @Nullable TracesSamplingDecision samplingDecision)
    • SpanContext

      public SpanContext(@NotNull @NotNull String operation)
      Creates trace context with deferred sampling decision.
      Parameters:
      operation - the operation
    • SpanContext

      public SpanContext(@NotNull @NotNull SentryId traceId, @NotNull @NotNull SpanId spanId, @NotNull @NotNull String operation, @Nullable @Nullable SpanId parentSpanId, @Nullable @Nullable TracesSamplingDecision samplingDecision)
    • SpanContext

      @Internal public SpanContext(@NotNull @NotNull SentryId traceId, @NotNull @NotNull SpanId spanId, @Nullable @Nullable SpanId parentSpanId, @NotNull @NotNull String operation, @Nullable @Nullable String description, @Nullable @Nullable TracesSamplingDecision samplingDecision, @Nullable @Nullable SpanStatus status, @Nullable @Nullable String origin)
    • SpanContext

      public SpanContext(@NotNull @NotNull SpanContext spanContext)
      Copy constructor.
      Parameters:
      spanContext - the spanContext to copy
  • Method Details

    • setOperation

      public void setOperation(@NotNull @NotNull String operation)
    • setTag

      public void setTag(@NotNull @NotNull String name, @NotNull @NotNull String value)
    • setDescription

      public void setDescription(@Nullable @Nullable String description)
    • setStatus

      public void setStatus(@Nullable @Nullable SpanStatus status)
    • getTraceId

      @NotNull public @NotNull SentryId getTraceId()
    • getSpanId

      @NotNull public @NotNull SpanId getSpanId()
    • getParentSpanId

      @Nullable @TestOnly public @Nullable SpanId getParentSpanId()
    • getOperation

      @NotNull public @NotNull String getOperation()
    • getDescription

      @Nullable public @Nullable String getDescription()
    • getStatus

      @Nullable public @Nullable SpanStatus getStatus()
    • getTags

      @NotNull public @NotNull Map<String,String> getTags()
    • getSamplingDecision

      @Nullable public @Nullable TracesSamplingDecision getSamplingDecision()
    • getSampled

      @Nullable public @Nullable Boolean getSampled()
    • getProfileSampled

      @Nullable public @Nullable Boolean getProfileSampled()
    • setSampled

      @Internal public void setSampled(@Nullable @Nullable Boolean sampled)
    • setSampled

      @Internal public void setSampled(@Nullable @Nullable Boolean sampled, @Nullable @Nullable Boolean profileSampled)
    • setSamplingDecision

      @Internal public void setSamplingDecision(@Nullable @Nullable TracesSamplingDecision samplingDecision)
    • getOrigin

      @Nullable public @Nullable String getOrigin()
    • setOrigin

      public void setOrigin(@Nullable @Nullable String origin)
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • serialize

      public void serialize(@NotNull @NotNull ObjectWriter writer, @NotNull @NotNull ILogger logger) throws IOException
      Specified by:
      serialize in interface JsonSerializable
      Throws:
      IOException
    • getUnknown

      @Nullable public @Nullable Map<String,Object> getUnknown()
      Specified by:
      getUnknown in interface JsonUnknown
    • setUnknown

      public void setUnknown(@Nullable @Nullable Map<String,Object> unknown)
      Specified by:
      setUnknown in interface JsonUnknown