OpenTelemetry¶
Send OpenTelemetry data directly from your application, or with the OpenTelemetry Collector.
OpenTelemetry provides a framework for creating and managing telemetry data such as traces, metrics and logs. It has several components, including SDKs for instrumenting your application and a vendor agnostic Collector. The Collector sends data to Observe using the OpenTelemetry endpoint.
Note
If you use Kubernetes, Observe recommends the Observe Kubernetes proxy and agent rather than manually configuring OpenTelemetry. The proxy offers several additional configuration options tailored to Kubernetes environments, including additional metadata for ingested observations.
OpenTelemetry Collector Installation¶
Please see the OpenTelemetry documentation for installation instructions.
Configuring the OpenTelemetry Collector¶
The OpenTelemetry Collector supports various configuration options.
The example below describes a configuration for the OpenTelemetry Collector to receive data in OTLP format and export it to Observe.
receivers:
otlp:
protocols:
grpc:
http:
processors:
batch:
exporters:
logging:
logLevel: debug
otlphttp:
endpoint: "https://{OBSERVE_CUSTOMER}.collect.observeinc.com/v1/otel"
headers:
'Authorization': 'Bearer my_ingest_token'
prometheusremotewrite:
endpoint: "https://{OBSERVE_CUSTOMER}.collect.observeinc.com/v1/prometheus"
headers:
'Authorization': 'Bearer my_ingest_token'
extensions:
health_check:
pprof:
zpages:
service:
extensions: [health_check,pprof,zpages]
pipelines:
traces:
receivers: [otlp]
processors: [batch]
exporters: [otlphttp]
metrics:
receivers: [otlp]
processors: [batch]
exporters: [prometheusremotewrite]
logs:
receivers: [otlp]
processors: [batch]
exporters: [logging]
The Authorization
header requires your customer ID and data stream token as a single space-delimited string:
'Authorization': 'Bearer my_ingest_token'
Instrumenting with an SDK¶
OpenTelemetry provides SDKs for several languages. An instrumented application can send data directly to Observe, or use the OpenTelemetry Collector. Note that it is generally recommended to use the OpenTelemetry Collector in production environments for performance and scalability.
The example below describes a configuration for a Go application to export data to Observe:
ctx := context.Background()
driver := otlphttp.NewDriver(
otlphttp.WithEndpoint("customerid.collect.observeinc.com/v1/otel"),
otlphttp.WithTracesURLPath("v1/traces"),
otlphttp.WithHeaders(map[string]string{
"Authorization": "Bearer my_ingest_token",
}),
)
exp, err := otlp.NewExporter(ctx, driver)
handleErr(err, "failed to create exporter")