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, we recommend 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.
Collector Installation¶
Please see the OpenTelemetry documentation for installation instructions.
Configuring the Collector¶
The Collector supports various configuration options.
The example below describes a configuration for the 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://collect.observeinc.com/v1/otel"
headers:
'Authorization': 'Bearer my_customer_id my_ingest_token'
prometheusremotewrite:
endpoint: "https://collect.observeinc.com/v1/prometheus"
headers:
'Authorization': 'Bearer my_customer_id 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 1234567890 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 Collector. Note that it is generally recommended to use the 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("collect.observeinc.com/v1/otel"),
otlphttp.WithTracesURLPath("v1/traces"),
otlphttp.WithHeaders(map[string]string{
"Authorization": "Bearer my_customer_id my_ingest_token",
}),
)
exp, err := otlp.NewExporter(ctx, driver)
handleErr(err, "failed to create exporter")