Cargo tests and formatting security audit

OpenTelemetry support for Google Cloud Trace

Quick start

Cargo.toml: toml [dependencies] opentelemetry-gcloud-trace = "0.1"

Example code: ```rust

use opentelemetry::KeyValue; use opentelemetry::trace::; use opentelemetry_gcloud_trace::;

let googleprojectid = configenvvar("PROJECT_ID")?;

let tracer: opentelemetry::sdk::trace::Tracer = GcpCloudTraceExporterBuilder::new(googleprojectid) .install_simple() .await?;

tracer.inspan("doingwork_parent", |cx| { // ... });

```

All examples available at examples directory.

To run example use with environment variables: ```

PROJECT_ID= cargo run --example enable-exporter

```

Google Cloud Console Example

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.

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

rust let google_project_id = config_env_var("PROJECT_ID")?; let tracer: opentelemetry::sdk::trace::Tracer = GcpCloudTraceExporterBuilder::new(google_project_id) .install_batch( opentelemetry::runtime::Tokio ) .await?;

Configuration

You can specify trace configuration using with_trace_config:

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

Limitations

Licence

Apache Software License (ASL)

Author

Abdulla Abdurakhmanov