Class Span.Builder

  • Enclosing class:
    Span

    public static class Span.Builder
    extends Object
    • Constructor Detail

      • Builder

        public Builder()
    • Method Detail

      • key

        public Span.Builder key​(String key)
        Unique identifier (spanId) for the span.

        Note that this field is defined as spanKey in the API and it maps to the spanId in the trace data in Application Performance Monitoring.

        Parameters:
        key - the value to set
        Returns:
        this builder
      • parentSpanKey

        public Span.Builder parentSpanKey​(String parentSpanKey)
        Unique parent identifier for the span if one exists.

        For root spans this will be null.

        Parameters:
        parentSpanKey - the value to set
        Returns:
        this builder
      • traceKey

        public Span.Builder traceKey​(String traceKey)
        Unique identifier for the trace.
        Parameters:
        traceKey - the value to set
        Returns:
        this builder
      • timeStarted

        public Span.Builder timeStarted​(Date timeStarted)
        Span start time.

        Timestamp when the span was started.

        Parameters:
        timeStarted - the value to set
        Returns:
        this builder
      • timeEnded

        public Span.Builder timeEnded​(Date timeEnded)
        Span end time.

        Timestamp when the span was completed.

        Parameters:
        timeEnded - the value to set
        Returns:
        this builder
      • durationInMs

        public Span.Builder durationInMs​(Long durationInMs)
        Total span duration in milliseconds.
        Parameters:
        durationInMs - the value to set
        Returns:
        this builder
      • operationName

        public Span.Builder operationName​(String operationName)
        Span name associated with the trace.

        This is usually the method or URI of the request.

        Parameters:
        operationName - the value to set
        Returns:
        this builder
      • serviceName

        public Span.Builder serviceName​(String serviceName)
        Service name associated with the span.
        Parameters:
        serviceName - the value to set
        Returns:
        this builder
      • kind

        public Span.Builder kind​(String kind)
        Kind associated with the span.
        Parameters:
        kind - the value to set
        Returns:
        this builder
      • tags

        public Span.Builder tags​(List<Tag> tags)
        List of tags associated with the span.
        Parameters:
        tags - the value to set
        Returns:
        this builder
      • tagsMetadata

        public Span.Builder tagsMetadata​(Map<String,​TagMetadata> tagsMetadata)
        Metadata about the tags in the span.
        Parameters:
        tagsMetadata - the value to set
        Returns:
        this builder
      • isError

        public Span.Builder isError​(Boolean isError)
        Indicates if the span has an error.
        Parameters:
        isError - the value to set
        Returns:
        this builder
      • sourceName

        public Span.Builder sourceName​(Span.SourceName sourceName)
        Source of span (spans, syn_spans).
        Parameters:
        sourceName - the value to set
        Returns:
        this builder
      • build

        public Span build()