Class TraceConfiguration.Builder
- java.lang.Object
-
- com.google.cloud.opentelemetry.trace.TraceConfiguration.Builder
-
- Enclosing class:
- TraceConfiguration
public abstract static class TraceConfiguration.Builder extends java.lang.ObjectBuilder forTraceConfiguration.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description TraceConfiguration.BuilderaddAttributeMapping(java.lang.String otelKey, java.lang.String gcpKey)Adds an attribute mapping that replaces a key in OTEL with the given key name for GCP.abstract com.google.common.collect.ImmutableMap.Builder<java.lang.String,java.lang.String>attributeMappingBuilder()Returns the builder for the attribute mapping.TraceConfigurationbuild()Builds aTraceConfiguration.abstract TraceConfiguration.BuildersetAttributeMapping(com.google.common.collect.ImmutableMap<java.lang.String,java.lang.String> attributeMapping)Sets the map of attribute keys that will be renamed.abstract TraceConfiguration.BuildersetCredentials(com.google.auth.Credentials credentials)Sets theCredentialsused to authenticate API calls.abstract TraceConfiguration.BuildersetDeadline(java.time.Duration deadline)Sets the deadline for exporting to Trace backend.abstract TraceConfiguration.BuildersetFixedAttributes(java.util.Map<java.lang.String,com.google.devtools.cloudtrace.v2.AttributeValue> fixedAttributes)Sets the map of attributes that is added to all the exported spans.abstract TraceConfiguration.BuildersetProjectId(java.lang.String projectId)Sets the cloud project id.abstract TraceConfiguration.BuildersetTraceServiceEndpoint(java.lang.String endpoint)Sets the endpoint where to write traces.abstract TraceConfiguration.BuildersetTraceServiceStub(com.google.cloud.trace.v2.stub.TraceServiceStub traceServiceStub)Deprecated.("Use setTraceServiceEndpoint")
-
-
-
Method Detail
-
setCredentials
public abstract TraceConfiguration.Builder setCredentials(com.google.auth.Credentials credentials)
Sets theCredentialsused to authenticate API calls.- Parameters:
credentials- theCredentials.- Returns:
- this.
-
setProjectId
public abstract TraceConfiguration.Builder setProjectId(java.lang.String projectId)
Sets the cloud project id.- Parameters:
projectId- the cloud project id.- Returns:
- this.
-
setTraceServiceStub
@Deprecated public abstract TraceConfiguration.Builder setTraceServiceStub(com.google.cloud.trace.v2.stub.TraceServiceStub traceServiceStub)
Deprecated.("Use setTraceServiceEndpoint")Sets the trace service stub used to send gRPC calls.- Parameters:
traceServiceStub- theTraceServiceStub.- Returns:
- this.
-
setTraceServiceEndpoint
public abstract TraceConfiguration.Builder setTraceServiceEndpoint(java.lang.String endpoint)
Sets the endpoint where to write traces. Defaults to tracing.googleapis.com:443.
-
setFixedAttributes
public abstract TraceConfiguration.Builder setFixedAttributes(java.util.Map<java.lang.String,com.google.devtools.cloudtrace.v2.AttributeValue> fixedAttributes)
Sets the map of attributes that is added to all the exported spans.- Parameters:
fixedAttributes- the map of attributes that is added to all the exported spans.- Returns:
- this.
-
setAttributeMapping
public abstract TraceConfiguration.Builder setAttributeMapping(com.google.common.collect.ImmutableMap<java.lang.String,java.lang.String> attributeMapping)
Sets the map of attribute keys that will be renamed.- Parameters:
attributeMapping- the map of attribute OTEL key to GCP attribute name.- Returns:
- this.
-
attributeMappingBuilder
public abstract com.google.common.collect.ImmutableMap.Builder<java.lang.String,java.lang.String> attributeMappingBuilder()
Returns the builder for the attribute mapping.
-
addAttributeMapping
public final TraceConfiguration.Builder addAttributeMapping(java.lang.String otelKey, java.lang.String gcpKey)
Adds an attribute mapping that replaces a key in OTEL with the given key name for GCP.- Parameters:
otelKey- the attribute name from OTEL.gcpKey- the attribute name to use in GCP- Returns:
- this.
-
setDeadline
public abstract TraceConfiguration.Builder setDeadline(java.time.Duration deadline)
Sets the deadline for exporting to Trace backend.If both
TraceServiceStubandDeadlineare set,TraceServiceStubtakes precedence andDeadlinewill not be respected.- Parameters:
deadline- the export deadline.- Returns:
- this
-
build
public TraceConfiguration build()
Builds aTraceConfiguration.- Returns:
- a
TraceConfiguration.
-
-