OpenTelemetry crate for Apollo platform.
This crate provides a standard way to configure and use OpenTelemetry.
Getting Started
Create telemetry from configuration:
use apollo_configuration::parse_yaml;
use apollo_opentelemetry::{OpenTelemetryConfig, Telemetry};
# fn main() -> Result<(), Box<dyn std::error::Error>> {
let yaml = r#"
tracer_provider:
processors:
- batch:
exporter:
otlp_http:
endpoint: http://localhost:4318
"#;
let config: OpenTelemetryConfig = parse_yaml(yaml, &Default::default())?;
let telemetry = Telemetry::new(config)?;
# Ok(())
# }
Or use the builder for more control:
use apollo_configuration::parse_yaml;
use apollo_opentelemetry::{OpenTelemetryConfig, Telemetry};
# fn main() -> Result<(), Box<dyn std::error::Error>> {
let yaml = r#"
tracer_provider:
processors:
- batch:
exporter:
otlp_http:
endpoint: http://localhost:4318
"#;
let config: OpenTelemetryConfig = parse_yaml(yaml, &Default::default())?;
let telemetry = Telemetry::builder(config)
.with_global_tracer_provider()
.with_global_meter_provider()
.build()?;
# Ok(())
# }
Feature Flags
otlp- Enable OTLP exporters (HTTP and gRPC)honeycomb- Enable Honeycomb exporternew-relic- Enable New Relic exportergrafana-cloud- Enable Grafana Cloud exporterdatadog-otlp- Enable Datadog OTLP intake exporter