Class OtelCollectorTracing
java.lang.Object
codes.grow.packages.otelcollector.OtelCollectorTracing
Tracing preset for the OpenTelemetry Collector (SPEC section 5): the official OTLP span exporters
(
http/protobuf to http://127.0.0.1:4318/v1/traces by default, or grpc to
http://127.0.0.1:4317) and initTracing with collector defaults from the
environment.-
Method Summary
Modifier and TypeMethodDescriptionstatic io.opentelemetry.sdk.trace.export.SpanExportercreateSpanExporter(TracingConfig config) Builds the official OTLP span exporter for a tracing config:http/protobuf→OtlpHttpSpanExporter,grpc→OtlpGrpcSpanExporter.static TracingHandleSets up tracing from the environment (GROW_OPENTELEMETRY_COLLECTOR_*,GROW_OTEL_*,OTEL_*).static TracingHandleinitTracing(OtelCollectorConfig config) Sets up tracing with every setting taken from a collector config.static TracingHandleinitTracing(TracingConfig config) Sets up tracing with an explicit config over collector defaults from the environment.static TracingHandleinitTracing(TracingConfig config, OtelCollectorConfig defaults) Sets up tracing with an explicit config over collector defaults (seeresolve(codes.grow.packages.otelcollector.tracing.TracingConfig, codes.grow.packages.otelcollector.OtelCollectorConfig)).static TracingConfigresolve(TracingConfig explicit, OtelCollectorConfig defaults) Merges an explicit tracing config over collector defaults.static StringresolveTracesEndpoint(TracingConfig.Protocol protocol, String endpoint) The traces exporter URL: forhttp/protobufan endpoint without a path (a base such ashttp://collector:4318) gets/v1/traces; anything else is used as is.static SpanExporterFactoryThe span exporter factory of this preset (seecreateSpanExporter(codes.grow.packages.otelcollector.tracing.TracingConfig)).
-
Method Details
-
resolveTracesEndpoint
The traces exporter URL: forhttp/protobufan endpoint without a path (a base such ashttp://collector:4318) gets/v1/traces; anything else is used as is.- Parameters:
protocol- protocolendpoint- endpoint- Returns:
- the URL
-
spanExporterFactory
The span exporter factory of this preset (seecreateSpanExporter(codes.grow.packages.otelcollector.tracing.TracingConfig)). -
createSpanExporter
public static io.opentelemetry.sdk.trace.export.SpanExporter createSpanExporter(TracingConfig config) Builds the official OTLP span exporter for a tracing config:http/protobuf→OtlpHttpSpanExporter,grpc→OtlpGrpcSpanExporter. The export deadline isbatch.exportTimeout; retries follow the OTLP rules of the official exporter.- Parameters:
config- tracing config- Returns:
- exporter
- Throws:
ConfigException- for thenativeprotocol or unreadable TLS files
-
resolve
Merges an explicit tracing config over collector defaults. Fields left at theTracingConfigbuilder default (protocolhttp/protobuf, samplerparentbased_always_onwith ratio 1, the default propagators and batch settings, gzip, no TLS, no endpoint) take the collector value; headers and resource attributes merge key by key (explicit wins).- Parameters:
explicit- explicit configdefaults- collector config- Returns:
- the merged config
-
initTracing
Sets up tracing from the environment (GROW_OPENTELEMETRY_COLLECTOR_*,GROW_OTEL_*,OTEL_*).- Returns:
- handle
-
initTracing
Sets up tracing with every setting taken from a collector config.- Parameters:
config- collector config- Returns:
- handle
-
initTracing
Sets up tracing with an explicit config over collector defaults from the environment.- Parameters:
config- explicit tracing config- Returns:
- handle
-
initTracing
Sets up tracing with an explicit config over collector defaults (seeresolve(codes.grow.packages.otelcollector.tracing.TracingConfig, codes.grow.packages.otelcollector.OtelCollectorConfig)).- Parameters:
config- explicit tracing configdefaults- collector config- Returns:
- handle
-