Package io.sentry

Interface ISpan

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void finish()
      Sets span timestamp marking this span as finished.
      void finish​(@Nullable SpanStatus status)
      Sets span timestamp marking this span as finished.
      @Nullable java.lang.Object getData​(@NotNull java.lang.String key)
      Returns extra data from span or transaction.
      @Nullable java.lang.String getDescription()
      Returns the span description.
      @NotNull java.lang.String getOperation()
      Returns the span operation.
      @NotNull SpanContext getSpanContext()
      Gets the span context.
      @Nullable SpanStatus getStatus()
      Returns the span status
      @Nullable java.lang.String getTag​(@NotNull java.lang.String key)  
      @Nullable java.lang.Throwable getThrowable()
      Gets the throwable that was thrown during the execution of the span.
      boolean isFinished()
      Returns if span has finished.
      void setData​(@NotNull java.lang.String key, @NotNull java.lang.Object value)
      Sets extra data on span or transaction.
      void setDescription​(@Nullable java.lang.String description)
      Sets span description.
      void setOperation​(@NotNull java.lang.String operation)
      Sets span operation.
      void setStatus​(@Nullable SpanStatus status)
      Sets span status.
      void setTag​(@NotNull java.lang.String key, @NotNull java.lang.String value)
      Sets the tag on span or transaction.
      void setThrowable​(@Nullable java.lang.Throwable throwable)
      Sets the throwable that was thrown during the execution of the span.
      @NotNull ISpan startChild​(@NotNull java.lang.String operation)
      Starts a child Span.
      @NotNull ISpan startChild​(@NotNull java.lang.String operation, @Nullable java.lang.String description)
      Starts a child Span.
      @NotNull ISpan startChild​(@NotNull java.lang.String operation, @Nullable java.lang.String description, @Nullable java.util.Date timestamp)  
      @NotNull SentryTraceHeader toSentryTrace()
      Returns the trace information that could be sent as a sentry-trace header.
      @Nullable TraceStateHeader toTraceStateHeader()
      Returns the trace state that can be sent as a "tracestate" header.
      @Nullable TraceState traceState()
      Returns the trace state information.
    • Method Detail

      • startChild

        @NotNull
        @NotNull ISpan startChild​(@NotNull
                                  @NotNull java.lang.String operation)
        Starts a child Span.
        Parameters:
        operation - - new span operation name
        Returns:
        a new transaction span
      • startChild

        @Internal
        @NotNull
        @NotNull ISpan startChild​(@NotNull
                                  @NotNull java.lang.String operation,
                                  @Nullable
                                  @Nullable java.lang.String description,
                                  @Nullable
                                  @Nullable java.util.Date timestamp)
      • startChild

        @NotNull
        @NotNull ISpan startChild​(@NotNull
                                  @NotNull java.lang.String operation,
                                  @Nullable
                                  @Nullable java.lang.String description)
        Starts a child Span.
        Parameters:
        operation - - new span operation name
        description - - new span description name
        Returns:
        a new transaction span
      • toSentryTrace

        @NotNull
        @NotNull SentryTraceHeader toSentryTrace()
        Returns the trace information that could be sent as a sentry-trace header.
        Returns:
        SentryTraceHeader.
      • toTraceStateHeader

        @Nullable
        @Experimental
        @Nullable TraceStateHeader toTraceStateHeader()
        Returns the trace state that can be sent as a "tracestate" header.
        Returns:
        TraceStateHeader or null if SentryOptions.isTraceSampling() is disabled.
      • finish

        void finish()
        Sets span timestamp marking this span as finished.
      • finish

        void finish​(@Nullable
                    @Nullable SpanStatus status)
        Sets span timestamp marking this span as finished.
        Parameters:
        status - - the status
      • setOperation

        void setOperation​(@NotNull
                          @NotNull java.lang.String operation)
        Sets span operation.
        Parameters:
        operation - - the operation
      • getOperation

        @NotNull
        @NotNull java.lang.String getOperation()
        Returns the span operation.
        Returns:
        the operation
      • setDescription

        void setDescription​(@Nullable
                            @Nullable java.lang.String description)
        Sets span description.
        Parameters:
        description - - the description.
      • getDescription

        @Nullable
        @Nullable java.lang.String getDescription()
        Returns the span description.
        Returns:
        the description
      • setStatus

        void setStatus​(@Nullable
                       @Nullable SpanStatus status)
        Sets span status.
        Parameters:
        status - - the status.
      • getStatus

        @Nullable
        @Nullable SpanStatus getStatus()
        Returns the span status
        Returns:
        the status
      • setThrowable

        void setThrowable​(@Nullable
                          @Nullable java.lang.Throwable throwable)
        Sets the throwable that was thrown during the execution of the span.
        Parameters:
        throwable - - the throwable.
      • getThrowable

        @Nullable
        @Nullable java.lang.Throwable getThrowable()
        Gets the throwable that was thrown during the execution of the span.
        Returns:
        throwable or null if none
      • getSpanContext

        @NotNull
        @NotNull SpanContext getSpanContext()
        Gets the span context.
        Returns:
        the span context
      • setTag

        void setTag​(@NotNull
                    @NotNull java.lang.String key,
                    @NotNull
                    @NotNull java.lang.String value)
        Sets the tag on span or transaction.
        Parameters:
        key - the tag key
        value - the tag value
      • getTag

        @Nullable
        @Nullable java.lang.String getTag​(@NotNull
                                          @NotNull java.lang.String key)
      • isFinished

        boolean isFinished()
        Returns if span has finished.
        Returns:
        if span has finished.
      • setData

        void setData​(@NotNull
                     @NotNull java.lang.String key,
                     @NotNull
                     @NotNull java.lang.Object value)
        Sets extra data on span or transaction.
        Parameters:
        key - the data key
        value - the data value
      • getData

        @Nullable
        @Nullable java.lang.Object getData​(@NotNull
                                           @NotNull java.lang.String key)
        Returns extra data from span or transaction.
        Returns:
        the data