opentelemetry-gcloud-trace 0.8.2

OpenTelemetry support for Google Cloud Trace
Documentation

Cargo tests and formatting security audit

OpenTelemetry support for Google Cloud Trace

Quick start

Cargo.toml:

[dependencies]
opentelemetry-gcloud-trace = "0.8"

Compatibility matrix

opentelemetry-gcloud-trace version opentelemetry version tracing-opentelemetry gcloud-sdk
0.8 0.21 0.22 0.23
0.7 0.20 0.21 0.21
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 opentelemetry::trace::*;
use opentelemetry_gcloud_trace::*;

let tracer = GcpCloudTraceExporterBuilder::for_default_project_id().await? // or GcpCloudTraceExporterBuilder::new(config_env_var("PROJECT_ID")?)
    .install()
    .await?;

tracer.in_span("doing_work_parent", |cx| {
  // ...
});

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

Google Cloud Console Example

[dependencies]
opentelemetry = { version = "*", features = [] }
opentelemetry_sdk = { version = "*", features = ["rt-tokio"] }
opentelemetry-gcloud-trace = "*"

Configuration

You can specify trace configuration using with_trace_config:

   GcpCloudTraceExporterBuilder::new(google_project_id).with_trace_config(
      trace::config()
         .with_sampler(Sampler::AlwaysOn)
         .with_id_generator(RandomIdGenerator::default())
   )

Limitations

  • This exporter doesn't support any other runtimes except Tokio.

Licence

Apache Software License (ASL)

Author

Abdulla Abdurakhmanov