Class TraceSpan

  • All Implemented Interfaces:
    TraceSpanOrBuilder, com.google.protobuf.Message, com.google.protobuf.MessageLite, com.google.protobuf.MessageLiteOrBuilder, com.google.protobuf.MessageOrBuilder, Serializable

    public final class TraceSpan
    extends com.google.protobuf.GeneratedMessageV3
    implements TraceSpanOrBuilder
     A span represents a single timed event within a trace. Spans can be nested
     and form a trace tree. Often, a trace contains a root span that describes the
     end-to-end latency of an operation and, optionally, one or more subspans for
     its suboperations. Spans do not need to be contiguous. There may be gaps
     between spans in a trace.
     
    Protobuf type google.devtools.cloudtrace.v1.TraceSpan
    See Also:
    Serialized Form
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  TraceSpan.Builder
      A span represents a single timed event within a trace.
      static class  TraceSpan.SpanKind
      Type of span.
      • Nested classes/interfaces inherited from class com.google.protobuf.GeneratedMessageV3

        com.google.protobuf.GeneratedMessageV3.BuilderParent, com.google.protobuf.GeneratedMessageV3.ExtendableBuilder<MessageT extends com.google.protobuf.GeneratedMessageV3.ExtendableMessage<MessageT>,​BuilderT extends com.google.protobuf.GeneratedMessageV3.ExtendableBuilder<MessageT,​BuilderT>>, com.google.protobuf.GeneratedMessageV3.ExtendableMessage<MessageT extends com.google.protobuf.GeneratedMessageV3.ExtendableMessage<MessageT>>, com.google.protobuf.GeneratedMessageV3.ExtendableMessageOrBuilder<MessageT extends com.google.protobuf.GeneratedMessageV3.ExtendableMessage<MessageT>>, com.google.protobuf.GeneratedMessageV3.FieldAccessorTable, com.google.protobuf.GeneratedMessageV3.UnusedPrivateParameter
      • Nested classes/interfaces inherited from class com.google.protobuf.AbstractMessageLite

        com.google.protobuf.AbstractMessageLite.InternalOneOfEnum
    • Method Detail

      • newInstance

        protected Object newInstance​(com.google.protobuf.GeneratedMessageV3.UnusedPrivateParameter unused)
        Overrides:
        newInstance in class com.google.protobuf.GeneratedMessageV3
      • getDescriptor

        public static final com.google.protobuf.Descriptors.Descriptor getDescriptor()
      • internalGetMapField

        protected com.google.protobuf.MapField internalGetMapField​(int number)
        Overrides:
        internalGetMapField in class com.google.protobuf.GeneratedMessageV3
      • internalGetFieldAccessorTable

        protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
        Specified by:
        internalGetFieldAccessorTable in class com.google.protobuf.GeneratedMessageV3
      • getSpanId

        public long getSpanId()
         Identifier for the span. Must be a 64-bit integer other than 0 and
         unique within a trace. For example, `2205310701640571284`.
         
        fixed64 span_id = 1;
        Specified by:
        getSpanId in interface TraceSpanOrBuilder
        Returns:
        The spanId.
      • getKindValue

        public int getKindValue()
         Distinguishes between spans generated in a particular context. For example,
         two spans with the same name may be distinguished using `RPC_CLIENT`
         and `RPC_SERVER` to identify queueing latency associated with the span.
         
        .google.devtools.cloudtrace.v1.TraceSpan.SpanKind kind = 2;
        Specified by:
        getKindValue in interface TraceSpanOrBuilder
        Returns:
        The enum numeric value on the wire for kind.
      • getKind

        public TraceSpan.SpanKind getKind()
         Distinguishes between spans generated in a particular context. For example,
         two spans with the same name may be distinguished using `RPC_CLIENT`
         and `RPC_SERVER` to identify queueing latency associated with the span.
         
        .google.devtools.cloudtrace.v1.TraceSpan.SpanKind kind = 2;
        Specified by:
        getKind in interface TraceSpanOrBuilder
        Returns:
        The kind.
      • getName

        public String getName()
         Name of the span. Must be less than 128 bytes. The span name is sanitized
         and displayed in the Stackdriver Trace tool in the
         Google Cloud Platform Console.
         The name may be a method name or some other per-call site name.
         For the same executable and the same call point, a best practice is
         to use a consistent name, which makes it easier to correlate
         cross-trace spans.
         
        string name = 3;
        Specified by:
        getName in interface TraceSpanOrBuilder
        Returns:
        The name.
      • getNameBytes

        public com.google.protobuf.ByteString getNameBytes()
         Name of the span. Must be less than 128 bytes. The span name is sanitized
         and displayed in the Stackdriver Trace tool in the
         Google Cloud Platform Console.
         The name may be a method name or some other per-call site name.
         For the same executable and the same call point, a best practice is
         to use a consistent name, which makes it easier to correlate
         cross-trace spans.
         
        string name = 3;
        Specified by:
        getNameBytes in interface TraceSpanOrBuilder
        Returns:
        The bytes for name.
      • hasStartTime

        public boolean hasStartTime()
         Start time of the span in nanoseconds from the UNIX epoch.
         
        .google.protobuf.Timestamp start_time = 4;
        Specified by:
        hasStartTime in interface TraceSpanOrBuilder
        Returns:
        Whether the startTime field is set.
      • getStartTime

        public com.google.protobuf.Timestamp getStartTime()
         Start time of the span in nanoseconds from the UNIX epoch.
         
        .google.protobuf.Timestamp start_time = 4;
        Specified by:
        getStartTime in interface TraceSpanOrBuilder
        Returns:
        The startTime.
      • getStartTimeOrBuilder

        public com.google.protobuf.TimestampOrBuilder getStartTimeOrBuilder()
         Start time of the span in nanoseconds from the UNIX epoch.
         
        .google.protobuf.Timestamp start_time = 4;
        Specified by:
        getStartTimeOrBuilder in interface TraceSpanOrBuilder
      • hasEndTime

        public boolean hasEndTime()
         End time of the span in nanoseconds from the UNIX epoch.
         
        .google.protobuf.Timestamp end_time = 5;
        Specified by:
        hasEndTime in interface TraceSpanOrBuilder
        Returns:
        Whether the endTime field is set.
      • getEndTime

        public com.google.protobuf.Timestamp getEndTime()
         End time of the span in nanoseconds from the UNIX epoch.
         
        .google.protobuf.Timestamp end_time = 5;
        Specified by:
        getEndTime in interface TraceSpanOrBuilder
        Returns:
        The endTime.
      • getEndTimeOrBuilder

        public com.google.protobuf.TimestampOrBuilder getEndTimeOrBuilder()
         End time of the span in nanoseconds from the UNIX epoch.
         
        .google.protobuf.Timestamp end_time = 5;
        Specified by:
        getEndTimeOrBuilder in interface TraceSpanOrBuilder
      • getParentSpanId

        public long getParentSpanId()
         Optional. ID of the parent span, if any.
         
        fixed64 parent_span_id = 6 [(.google.api.field_behavior) = OPTIONAL];
        Specified by:
        getParentSpanId in interface TraceSpanOrBuilder
        Returns:
        The parentSpanId.
      • getLabelsCount

        public int getLabelsCount()
        Description copied from interface: TraceSpanOrBuilder
         Collection of labels associated with the span. Label keys must be less than
         128 bytes. Label values must be less than 16 kilobytes (10MB for
         `/stacktrace` values).
        
         Some predefined label keys exist, or you may create your own. When creating
         your own, we recommend the following formats:
        
         * `/category/product/key` for agents of well-known products (e.g.
           `/db/mongodb/read_size`).
         * `short_host/path/key` for domain-specific keys (e.g.
           `foo.com/myproduct/bar`)
        
         Predefined labels include:
        
         *   `/agent`
         *   `/component`
         *   `/error/message`
         *   `/error/name`
         *   `/http/client_city`
         *   `/http/client_country`
         *   `/http/client_protocol`
         *   `/http/client_region`
         *   `/http/host`
         *   `/http/method`
         *   `/http/path`
         *   `/http/redirected_url`
         *   `/http/request/size`
         *   `/http/response/size`
         *   `/http/route`
         *   `/http/status_code`
         *   `/http/url`
         *   `/http/user_agent`
         *   `/pid`
         *   `/stacktrace`
         *   `/tid`
         
        map<string, string> labels = 7;
        Specified by:
        getLabelsCount in interface TraceSpanOrBuilder
      • containsLabels

        public boolean containsLabels​(String key)
         Collection of labels associated with the span. Label keys must be less than
         128 bytes. Label values must be less than 16 kilobytes (10MB for
         `/stacktrace` values).
        
         Some predefined label keys exist, or you may create your own. When creating
         your own, we recommend the following formats:
        
         * `/category/product/key` for agents of well-known products (e.g.
           `/db/mongodb/read_size`).
         * `short_host/path/key` for domain-specific keys (e.g.
           `foo.com/myproduct/bar`)
        
         Predefined labels include:
        
         *   `/agent`
         *   `/component`
         *   `/error/message`
         *   `/error/name`
         *   `/http/client_city`
         *   `/http/client_country`
         *   `/http/client_protocol`
         *   `/http/client_region`
         *   `/http/host`
         *   `/http/method`
         *   `/http/path`
         *   `/http/redirected_url`
         *   `/http/request/size`
         *   `/http/response/size`
         *   `/http/route`
         *   `/http/status_code`
         *   `/http/url`
         *   `/http/user_agent`
         *   `/pid`
         *   `/stacktrace`
         *   `/tid`
         
        map<string, string> labels = 7;
        Specified by:
        containsLabels in interface TraceSpanOrBuilder
      • getLabelsMap

        public Map<String,​String> getLabelsMap()
         Collection of labels associated with the span. Label keys must be less than
         128 bytes. Label values must be less than 16 kilobytes (10MB for
         `/stacktrace` values).
        
         Some predefined label keys exist, or you may create your own. When creating
         your own, we recommend the following formats:
        
         * `/category/product/key` for agents of well-known products (e.g.
           `/db/mongodb/read_size`).
         * `short_host/path/key` for domain-specific keys (e.g.
           `foo.com/myproduct/bar`)
        
         Predefined labels include:
        
         *   `/agent`
         *   `/component`
         *   `/error/message`
         *   `/error/name`
         *   `/http/client_city`
         *   `/http/client_country`
         *   `/http/client_protocol`
         *   `/http/client_region`
         *   `/http/host`
         *   `/http/method`
         *   `/http/path`
         *   `/http/redirected_url`
         *   `/http/request/size`
         *   `/http/response/size`
         *   `/http/route`
         *   `/http/status_code`
         *   `/http/url`
         *   `/http/user_agent`
         *   `/pid`
         *   `/stacktrace`
         *   `/tid`
         
        map<string, string> labels = 7;
        Specified by:
        getLabelsMap in interface TraceSpanOrBuilder
      • getLabelsOrDefault

        public String getLabelsOrDefault​(String key,
                                         String defaultValue)
         Collection of labels associated with the span. Label keys must be less than
         128 bytes. Label values must be less than 16 kilobytes (10MB for
         `/stacktrace` values).
        
         Some predefined label keys exist, or you may create your own. When creating
         your own, we recommend the following formats:
        
         * `/category/product/key` for agents of well-known products (e.g.
           `/db/mongodb/read_size`).
         * `short_host/path/key` for domain-specific keys (e.g.
           `foo.com/myproduct/bar`)
        
         Predefined labels include:
        
         *   `/agent`
         *   `/component`
         *   `/error/message`
         *   `/error/name`
         *   `/http/client_city`
         *   `/http/client_country`
         *   `/http/client_protocol`
         *   `/http/client_region`
         *   `/http/host`
         *   `/http/method`
         *   `/http/path`
         *   `/http/redirected_url`
         *   `/http/request/size`
         *   `/http/response/size`
         *   `/http/route`
         *   `/http/status_code`
         *   `/http/url`
         *   `/http/user_agent`
         *   `/pid`
         *   `/stacktrace`
         *   `/tid`
         
        map<string, string> labels = 7;
        Specified by:
        getLabelsOrDefault in interface TraceSpanOrBuilder
      • getLabelsOrThrow

        public String getLabelsOrThrow​(String key)
         Collection of labels associated with the span. Label keys must be less than
         128 bytes. Label values must be less than 16 kilobytes (10MB for
         `/stacktrace` values).
        
         Some predefined label keys exist, or you may create your own. When creating
         your own, we recommend the following formats:
        
         * `/category/product/key` for agents of well-known products (e.g.
           `/db/mongodb/read_size`).
         * `short_host/path/key` for domain-specific keys (e.g.
           `foo.com/myproduct/bar`)
        
         Predefined labels include:
        
         *   `/agent`
         *   `/component`
         *   `/error/message`
         *   `/error/name`
         *   `/http/client_city`
         *   `/http/client_country`
         *   `/http/client_protocol`
         *   `/http/client_region`
         *   `/http/host`
         *   `/http/method`
         *   `/http/path`
         *   `/http/redirected_url`
         *   `/http/request/size`
         *   `/http/response/size`
         *   `/http/route`
         *   `/http/status_code`
         *   `/http/url`
         *   `/http/user_agent`
         *   `/pid`
         *   `/stacktrace`
         *   `/tid`
         
        map<string, string> labels = 7;
        Specified by:
        getLabelsOrThrow in interface TraceSpanOrBuilder
      • isInitialized

        public final boolean isInitialized()
        Specified by:
        isInitialized in interface com.google.protobuf.MessageLiteOrBuilder
        Overrides:
        isInitialized in class com.google.protobuf.GeneratedMessageV3
      • writeTo

        public void writeTo​(com.google.protobuf.CodedOutputStream output)
                     throws IOException
        Specified by:
        writeTo in interface com.google.protobuf.MessageLite
        Overrides:
        writeTo in class com.google.protobuf.GeneratedMessageV3
        Throws:
        IOException
      • getSerializedSize

        public int getSerializedSize()
        Specified by:
        getSerializedSize in interface com.google.protobuf.MessageLite
        Overrides:
        getSerializedSize in class com.google.protobuf.GeneratedMessageV3
      • equals

        public boolean equals​(Object obj)
        Specified by:
        equals in interface com.google.protobuf.Message
        Overrides:
        equals in class com.google.protobuf.AbstractMessage
      • hashCode

        public int hashCode()
        Specified by:
        hashCode in interface com.google.protobuf.Message
        Overrides:
        hashCode in class com.google.protobuf.AbstractMessage
      • parseFrom

        public static TraceSpan parseFrom​(ByteBuffer data)
                                   throws com.google.protobuf.InvalidProtocolBufferException
        Throws:
        com.google.protobuf.InvalidProtocolBufferException
      • parseFrom

        public static TraceSpan parseFrom​(ByteBuffer data,
                                          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                                   throws com.google.protobuf.InvalidProtocolBufferException
        Throws:
        com.google.protobuf.InvalidProtocolBufferException
      • parseFrom

        public static TraceSpan parseFrom​(com.google.protobuf.ByteString data)
                                   throws com.google.protobuf.InvalidProtocolBufferException
        Throws:
        com.google.protobuf.InvalidProtocolBufferException
      • parseFrom

        public static TraceSpan parseFrom​(com.google.protobuf.ByteString data,
                                          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                                   throws com.google.protobuf.InvalidProtocolBufferException
        Throws:
        com.google.protobuf.InvalidProtocolBufferException
      • parseFrom

        public static TraceSpan parseFrom​(byte[] data)
                                   throws com.google.protobuf.InvalidProtocolBufferException
        Throws:
        com.google.protobuf.InvalidProtocolBufferException
      • parseFrom

        public static TraceSpan parseFrom​(byte[] data,
                                          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                                   throws com.google.protobuf.InvalidProtocolBufferException
        Throws:
        com.google.protobuf.InvalidProtocolBufferException
      • parseFrom

        public static TraceSpan parseFrom​(com.google.protobuf.CodedInputStream input,
                                          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                                   throws IOException
        Throws:
        IOException
      • newBuilderForType

        public TraceSpan.Builder newBuilderForType()
        Specified by:
        newBuilderForType in interface com.google.protobuf.Message
        Specified by:
        newBuilderForType in interface com.google.protobuf.MessageLite
      • toBuilder

        public TraceSpan.Builder toBuilder()
        Specified by:
        toBuilder in interface com.google.protobuf.Message
        Specified by:
        toBuilder in interface com.google.protobuf.MessageLite
      • newBuilderForType

        protected TraceSpan.Builder newBuilderForType​(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)
        Specified by:
        newBuilderForType in class com.google.protobuf.GeneratedMessageV3
      • getDefaultInstance

        public static TraceSpan getDefaultInstance()
      • parser

        public static com.google.protobuf.Parser<TraceSpan> parser()
      • getParserForType

        public com.google.protobuf.Parser<TraceSpan> getParserForType()
        Specified by:
        getParserForType in interface com.google.protobuf.Message
        Specified by:
        getParserForType in interface com.google.protobuf.MessageLite
        Overrides:
        getParserForType in class com.google.protobuf.GeneratedMessageV3
      • getDefaultInstanceForType

        public TraceSpan getDefaultInstanceForType()
        Specified by:
        getDefaultInstanceForType in interface com.google.protobuf.MessageLiteOrBuilder
        Specified by:
        getDefaultInstanceForType in interface com.google.protobuf.MessageOrBuilder