Skip to main content

Module tracing

Module tracing 

Source
Expand description

OpenTelemetry tracing and Pyroscope profiling initialization.

This module provides configurable distributed tracing via OpenTelemetry and continuous profiling via Pyroscope.

§Configuration

All configuration is via environment variables:

§Tracing (OpenTelemetry/OTLP)

  • TRACING_ENABLED: Enable/disable tracing (“true”/“false”, default: “true”)
  • OTEL_EXPORTER_OTLP_ENDPOINT: OTLP collector endpoint (e.g., “http://alloy:4317”)
  • OTEL_SERVICE_NAME: Service name for traces (default: “hypercall”)
  • TRACING_SAMPLE_RATIO: Sampling ratio 0.0-1.0 (default: “1.0” = always sample)

§Profiling (Pyroscope)

  • PYROSCOPE_ENABLED: Enable/disable profiling (“true”/“false”, default: “true”)
  • PYROSCOPE_SERVER_ADDRESS: Pyroscope server address (e.g., “http://alloy:4040”)
  • PYROSCOPE_APPLICATION_NAME: Application name for profiles (default: “hypercall”)

§Usage

use hypercall::observability::tracing::{init_tracing, shutdown_tracing};

#[tokio::main]
async fn main() {
    // Initialize tracing (call early in main)
    init_tracing(None);

    // ... application code ...

    // Graceful shutdown (flushes pending traces)
    shutdown_tracing();
}

Statics§

PYROSCOPE_AGENT 🔒
TRACER_PROVIDER 🔒

Functions§

init_pyroscope 🔒
Initialize Pyroscope continuous profiling.
init_tracing
Initialize OpenTelemetry tracing and Pyroscope profiling.
shutdown_tracing
Gracefully shutdown tracing and profiling.