OpenTelemetry for Rust

OpenTelemetry for Rust provides libraries to create and export traces, logs, and metrics. The ecosystem is growing rapidly and supports async-first applications.

Installation

Add the OpenTelemetry crates to your Cargo.toml:

opentelemetry = "0.20" 
opentelemetry-otlp = "0.13" tokio = { version = "1", features = ["full"] }

For full installation instructions:
👉 OpenTelemetry Rust Getting Started

Auto-Instrumentation

Auto-instrumentation lets you automatically trace common libraries such as HTTP clients, database drivers, and more without needing to modify your code. OpenTelemetry provides auto-instrumentation libraries for many popular languages, making it fast to get started with tracing.

Rust currently does not have “auto-instrumentation” in the same sense as some other languages. You manually wrap your application logic with spans and telemetry.

Manual Instrumentation

Manual instrumentation gives you full control over your traces, allowing you to create spans wherever needed. You can customize span names, attributes, and relationships to capture the most important parts of your application’s flow.

You can manually create spans and traces in Rust:

use opentelemetry::{global, trace::Tracer};
let tracer = global::tracer("my-service");
tracer.in_span("my-operation", |_cx| { // your application logic });

Learn more:
👉 Rust Manual Instrumentation Guide

Exporters

Once your application is instrumented, you need to export telemetry data. PlayerZero supports the OpenTelemetry Protocol (OTLP) over HTTP. You can configure your OpenTelemetry SDK to export traces, logs, and metrics to PlayerZero’s endpoint by setting the endpoint URL and API token.

You typically configure the OTLP exporter directly in your Rust code when initializing telemetry.

Key configuration:

Endpoint: https://sdk.playerzero.app/otlp Headers: Authorization=Bearer <your-playerzero-token>

Official reference:
👉 Rust OTLP Exporter Setup

Optional: Using a Collector

Using an OpenTelemetry Collector is optional for most setups. A collector can help route telemetry to multiple destinations, perform transformations, or batch data efficiently. You might use a collector if you want to forward telemetry to both PlayerZero and another observability platform simultaneously.

You can optionally forward telemetry through an OpenTelemetry Collector before reaching PlayerZero.

For detailed language-specific instrumentation examples and full OpenTelemetry documentation, refer to the links below.