Class SpanContext.Builder (3.77.0) 
  
  
  
   
  
    
  
  
    
    
    
    
  Version 3.77.0keyboard_arrow_down  
  
 
    
    
    
    
      
  
  
  
    
public   static   final   class  SpanContext . Builder   extends   GeneratedMessageV3 . Builder<SpanContext . Builder >  implements   SpanContextOrBuilder  
   The context of a span. This is attached to an
 Exemplar 
 in Distribution  values during aggregation.
 It contains the name of a span with format:
 projects/[PROJECT_ID_OR_NUMBER]/traces/[TRACE_ID]/spans/[SPAN_ID]
 Protobuf type google.monitoring.v3.SpanContext
    Inherited Members 
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
      com.google.protobuf.GeneratedMessageV3.Builder.getUnknownFieldSetBuilder() 
    
    
    
    
    
    
    
      com.google.protobuf.GeneratedMessageV3.Builder.internalGetMapFieldReflection(int) 
    
    
    
      com.google.protobuf.GeneratedMessageV3.Builder.internalGetMutableMapFieldReflection(int) 
    
    
    
    
    
    
      com.google.protobuf.GeneratedMessageV3.Builder.mergeUnknownLengthDelimitedField(int,com.google.protobuf.ByteString) 
    
    
      com.google.protobuf.GeneratedMessageV3.Builder.mergeUnknownVarintField(int,int) 
    
    
    
    
    
      com.google.protobuf.GeneratedMessageV3.Builder.parseUnknownField(com.google.protobuf.CodedInputStream,com.google.protobuf.ExtensionRegistryLite,int) 
    
    
    
    
      com.google.protobuf.GeneratedMessageV3.Builder.setUnknownFieldSetBuilder(com.google.protobuf.UnknownFieldSet.Builder) 
    
    
    
    
    
    
    
    
    
    
    
    
   
  Static Methods
   
  getDescriptor() 
  
    
public   static   final   Descriptors . Descriptor   getDescriptor ()  
  
  Methods
   
  addRepeatedField(Descriptors.FieldDescriptor field, Object value) 
  
    
public   SpanContext . Builder   addRepeatedField ( Descriptors . FieldDescriptor   field ,   Object   value )  
  
  
  Overrides 
  
  build() 
  
    
public   SpanContext   build ()  
  
  buildPartial() 
  
    
public   SpanContext   buildPartial ()  
  
  clear() 
  
    
public   SpanContext . Builder   clear ()  
  
  Overrides 
  
  clearField(Descriptors.FieldDescriptor field) 
  
    
public   SpanContext . Builder   clearField ( Descriptors . FieldDescriptor   field )  
  
  
  Overrides 
  
  clearOneof(Descriptors.OneofDescriptor oneof) 
  
    
public   SpanContext . Builder   clearOneof ( Descriptors . OneofDescriptor   oneof )  
  
  
  Overrides 
  
  clearSpanName() 
  
    
public   SpanContext . Builder   clearSpanName ()  
   The resource name of the span. The format is:
 projects/[PROJECT_ID_OR_NUMBER]/traces/[TRACE_ID]/spans/[SPAN_ID]
 [TRACE_ID] is a unique identifier for a trace within a project;
 it is a 32-character hexadecimal encoding of a 16-byte array.
 [SPAN_ID] is a unique identifier for a span within a trace; it
 is a 16-character hexadecimal encoding of an 8-byte array.
 string span_name = 1;
clone() 
  
    
public   SpanContext . Builder   clone ()  
  
  Overrides 
  
  getDefaultInstanceForType() 
  
    
public   SpanContext   getDefaultInstanceForType ()  
  
  getDescriptorForType() 
  
    
public   Descriptors . Descriptor   getDescriptorForType ()  
  
  Overrides 
  
  getSpanName() 
  
    
public   String   getSpanName ()  
   The resource name of the span. The format is:
 projects/[PROJECT_ID_OR_NUMBER]/traces/[TRACE_ID]/spans/[SPAN_ID]
 [TRACE_ID] is a unique identifier for a trace within a project;
 it is a 32-character hexadecimal encoding of a 16-byte array.
 [SPAN_ID] is a unique identifier for a span within a trace; it
 is a 16-character hexadecimal encoding of an 8-byte array.
 string span_name = 1;
    
      
        Returns  
      
        Type Description  
      
        String The spanName.
 
     
  
  getSpanNameBytes() 
  
    
public   ByteString   getSpanNameBytes ()  
   The resource name of the span. The format is:
 projects/[PROJECT_ID_OR_NUMBER]/traces/[TRACE_ID]/spans/[SPAN_ID]
 [TRACE_ID] is a unique identifier for a trace within a project;
 it is a 32-character hexadecimal encoding of a 16-byte array.
 [SPAN_ID] is a unique identifier for a span within a trace; it
 is a 16-character hexadecimal encoding of an 8-byte array.
 string span_name = 1;
    
      
        Returns  
      
        Type Description  
      
        ByteString The bytes for spanName.
 
     
  
  internalGetFieldAccessorTable() 
  
    
protected   GeneratedMessageV3 . FieldAccessorTable   internalGetFieldAccessorTable ()  
  
  Overrides 
  
  isInitialized() 
  
    
public   final   boolean   isInitialized ()  
  
  Overrides 
  
  mergeFrom(SpanContext other) 
  
    
public   SpanContext . Builder   mergeFrom ( SpanContext   other )  
  
  
  mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry) 
  
    
public   SpanContext . Builder   mergeFrom ( CodedInputStream   input ,   ExtensionRegistryLite   extensionRegistry )  
  
  
  Overrides 
  
  
  mergeFrom(Message other) 
  
    
public   SpanContext . Builder   mergeFrom ( Message   other )  
  
    
      
        Parameter  
      
        Name Description  
      
        otherMessage  
     
  
  
  Overrides 
  
  mergeUnknownFields(UnknownFieldSet unknownFields) 
  
    
public   final   SpanContext . Builder   mergeUnknownFields ( UnknownFieldSet   unknownFields )  
  
  
  Overrides 
  
  setField(Descriptors.FieldDescriptor field, Object value) 
  
    
public   SpanContext . Builder   setField ( Descriptors . FieldDescriptor   field ,   Object   value )  
  
  
  Overrides 
  
  setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value) 
  
    
public   SpanContext . Builder   setRepeatedField ( Descriptors . FieldDescriptor   field ,   int   index ,   Object   value )  
  
  
  Overrides 
  
  setSpanName(String value) 
  
    
public   SpanContext . Builder   setSpanName ( String   value )  
   The resource name of the span. The format is:
 projects/[PROJECT_ID_OR_NUMBER]/traces/[TRACE_ID]/spans/[SPAN_ID]
 [TRACE_ID] is a unique identifier for a trace within a project;
 it is a 32-character hexadecimal encoding of a 16-byte array.
 [SPAN_ID] is a unique identifier for a span within a trace; it
 is a 16-character hexadecimal encoding of an 8-byte array.
 string span_name = 1;
    
      
        Parameter  
      
        Name Description  
      
        valueString The spanName to set.
 
     
  
  
  setSpanNameBytes(ByteString value) 
  
    
public   SpanContext . Builder   setSpanNameBytes ( ByteString   value )  
   The resource name of the span. The format is:
 projects/[PROJECT_ID_OR_NUMBER]/traces/[TRACE_ID]/spans/[SPAN_ID]
 [TRACE_ID] is a unique identifier for a trace within a project;
 it is a 32-character hexadecimal encoding of a 16-byte array.
 [SPAN_ID] is a unique identifier for a span within a trace; it
 is a 16-character hexadecimal encoding of an 8-byte array.
 string span_name = 1;
    
      
        Parameter  
      
        Name Description  
      
        valueByteString The bytes for spanName to set.
 
     
  
  
  setUnknownFields(UnknownFieldSet unknownFields) 
  
    
public   final   SpanContext . Builder   setUnknownFields ( UnknownFieldSet   unknownFields )  
  
  
  Overrides 
  
 
     
    
  
  
  
     
  
    
    
      
       
    
    
  
  
 
  Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License , and code samples are licensed under the Apache 2.0 License . For details, see the Google Developers Site Policies . Java is a registered trademark of Oracle and/or its affiliates.
  Last updated 2025-10-29 UTC.
 
 
  
  
  
    
      [[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-10-29 UTC."],[],[]]