Skip to main content
Two entry points export OpenTelemetry signals to an OTLP collector. Pick one per run — no -mode flag: Do not combine WithObservabilityConfig with injected WithTracer / WithMetrics / WithLogs for the same signal unless you set DisableTraces, DisableMetrics, or DisableLogs on the observability config — otherwise the SDK replaces injected clients and logs a warning. Source: examples/agent_with_observability/

OTLP environment

OTLP collector accepts gRPC (default) or HTTP/protobuf. Use host:port only (no http:// scheme).

Quick local collector

Grafana LGTM (traces, metrics, logs in one stack):
Export before running either example:
Jaeger all-in-one (traces only):
Use the same gRPC exports as above. Only one stack should bind 4317 at a time.

Run

From examples/:
Call Agent.Close() before exit so OTLP batches flush.

Verify in Grafana (LGTM)

  1. Open http://localhost:3000 — default login admin / admin.
  2. Traces — Explore → datasource Tempo → query by service or trace. service.name follows the agent name (e.g. observability-example-agent).
  3. Metrics — Explore → Prometheus.
  4. Logs — Explore → Loki → filter by service_name aligned with your OTLP resource.
For Jaeger, open http://localhost:16686, pick your service, click Find Traces.

Learn more

Tracing

Spans and OTLP setup

Metrics

Counters and histograms