OpenTelemetry support for Google Cloud Trace
Quick start
Cargo.toml:
[]
= "0.6"
Compatibility matrix
| opentelemetry-gcloud-trace version | opentelemetry version | tracing-opentelemetry | gcloud-sdk |
|---|---|---|---|
| 0.6 | 0.20 | 0.20 | 0.20 |
| 0.5 | 0.19 | 0.19 | 0.20 |
| 0.4 | 0.18 | 0.18 | 0.19 |
Example:
use KeyValue;
use *;
use *;
let tracer: Tracer =
for_default_project_id.await? // or GcpCloudTraceExporterBuilder::new(config_env_var("PROJECT_ID")?)
.install_simple // use install_batch for production/performance reasons
.await?;
tracer.in_span;
This is a basic configuration, not recommended for prod systems. See the Performance section for prod config.
All examples available at examples directory.
To run example use with environment variables:
# PROJECT_ID=<your-google-project-id> cargo run --example enable-exporter

Performance
For optimal performance, a batch exporter is recommended as the simple exporter will export
each span synchronously on drop. You can enable the [rt-tokio], [rt-tokio-current-thread]
features and specify a runtime on the pipeline to have a batch exporter
configured for you automatically.
[]
= { = "*", = ["rt-tokio"] }
= "*"
let tracer: Tracer =
for_default_project_id.await? // or GcpCloudTraceExporterBuilder::new(config_env_var("PROJECT_ID")?)
.install_batch
.await?;
Configuration
You can specify trace configuration using with_trace_config:
new.with_trace_config
Limitations
- This exporter doesn't support any other runtimes except Tokio.
Licence
Apache Software License (ASL)
Author
Abdulla Abdurakhmanov