Package io.opentelemetry.exporter.otlp
Class OtlpGrpcSpanExporter
- java.lang.Object
-
- io.opentelemetry.exporter.otlp.OtlpGrpcSpanExporter
-
- All Implemented Interfaces:
io.opentelemetry.sdk.trace.export.SpanExporter
@ThreadSafe public final class OtlpGrpcSpanExporter extends Object implements io.opentelemetry.sdk.trace.export.SpanExporter
Exports spans using OTLP via gRPC, using OpenTelemetry's protobuf model.Configuration options for
OtlpGrpcSpanExportercan be read from system properties, environment variables, orPropertiesobjects.For system properties and
Propertiesobjects,OtlpGrpcSpanExporterwill look for the following names:otel.exporter.otlp.span.timeout: to set the max waiting time allowed to send each span batch.otel.exporter.otlp.span.endpoint: to set the endpoint to connect to.otel.exporter.otlp.span.insecure: whether to enable client transport security for the connection.otel.exporter.otlp.span.headers: the headers associated with the requests.
For environment variables,
OtlpGrpcSpanExporterwill look for the following names:OTEL_EXPORTER_OTLP_SPAN_TIMEOUT: to set the max waiting time allowed to send each span batch.OTEL_EXPORTER_OTLP_SPAN_ENDPOINT: to set the endpoint to connect to.OTEL_EXPORTER_OTLP_SPAN_INSECURE: whether to enable client transport security for the connection.OTEL_EXPORTER_OTLP_SPAN_HEADERS: the headers associated with the requests.
In both cases, if a property is missing, the name without "span" is used to resolve the value.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classOtlpGrpcSpanExporter.BuilderBuilder utility for this exporter.
-
Field Summary
Fields Modifier and Type Field Description static longDEFAULT_DEADLINE_MSstatic StringDEFAULT_ENDPOINT
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static OtlpGrpcSpanExporter.Builderbuilder()Returns a new builder instance for this exporter.io.opentelemetry.sdk.common.CompletableResultCodeexport(Collection<io.opentelemetry.sdk.trace.data.SpanData> spans)Submits all the given spans in a single batch to the OpenTelemetry collector.io.opentelemetry.sdk.common.CompletableResultCodeflush()The OTLP exporter does not batch spans, so this method will immediately return with success.static OtlpGrpcSpanExportergetDefault()Returns a newOtlpGrpcSpanExporterreading the configuration values from the environment and from system properties.io.opentelemetry.sdk.common.CompletableResultCodeshutdown()Initiates an orderly shutdown in which preexisting calls continue but new calls are immediately cancelled.
-
-
-
Field Detail
-
DEFAULT_ENDPOINT
public static final String DEFAULT_ENDPOINT
- See Also:
- Constant Field Values
-
DEFAULT_DEADLINE_MS
public static final long DEFAULT_DEADLINE_MS
-
-
Method Detail
-
export
public io.opentelemetry.sdk.common.CompletableResultCode export(Collection<io.opentelemetry.sdk.trace.data.SpanData> spans)
Submits all the given spans in a single batch to the OpenTelemetry collector.- Specified by:
exportin interfaceio.opentelemetry.sdk.trace.export.SpanExporter- Parameters:
spans- the list of sampled Spans to be exported.- Returns:
- the result of the operation
-
flush
public io.opentelemetry.sdk.common.CompletableResultCode flush()
The OTLP exporter does not batch spans, so this method will immediately return with success.- Specified by:
flushin interfaceio.opentelemetry.sdk.trace.export.SpanExporter- Returns:
- always Success
-
builder
public static OtlpGrpcSpanExporter.Builder builder()
Returns a new builder instance for this exporter.- Returns:
- a new builder instance for this exporter.
-
getDefault
public static OtlpGrpcSpanExporter getDefault()
Returns a newOtlpGrpcSpanExporterreading the configuration values from the environment and from system properties. System properties override values defined in the environment. If a configuration value is missing, it uses the default value.- Returns:
- a new
OtlpGrpcSpanExporterinstance.
-
shutdown
public io.opentelemetry.sdk.common.CompletableResultCode shutdown()
Initiates an orderly shutdown in which preexisting calls continue but new calls are immediately cancelled.- Specified by:
shutdownin interfaceio.opentelemetry.sdk.trace.export.SpanExporter
-
-