Class TraceConfiguration.Builder

    • Method Detail

      • setCredentials

        public abstract TraceConfiguration.Builder setCredentials​(com.google.auth.Credentials credentials)
        Sets the Credentials used to authenticate API calls.
        Parameters:
        credentials - the Credentials.
        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 - the TraceServiceStub.
        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 TraceServiceStub and Deadline are set, TraceServiceStub takes precedence and Deadline will not be respected.

        Parameters:
        deadline - the export deadline.
        Returns:
        this