Configure the async runtime (Tokio, async-std, ...) in Rust using
`with_runtime(runtime)` on the trace pipeline builders instead of using
cargo features.
The main advantages of using Rust code is that cargo doesn't have a way
of describing mutually exclusive features at the moment. We currently
fall back to Tokio if multiple runtime features are enabled. This can be
confusing, especially if a runtime feature is enabled by another crate.
Choosing the runtime in Rust code means the entire trace pipeline
configuration is in one place.
`tonic` and `grpcio` take different approaches in serializing and sending spans. This change use an enum to represent the two grpc layers. If users want to bring their own grpc layer, they can implement `TracerExporter` and `SpanExporter` and then install it.
This adds a suite of tests to ensure the global tracer provider shuts down properly using different runtimes. For optimal performance it is often preferable to spawn shutdown tasks using `tokio::spawn` instead of `tokio::spawn_blocking`, but in order to have a consistent API between blocking and non-blocking programs, then shutdown code will block on some tasks. This can cause deadlocks with single-threaded runtimes, the current solution is to spawn the background task in a separate thread if single threaded runtime features are present.
Add support for the [tonic](https://github.com/hyperium/tonic) implementation of the gRPC transport layer to `opentelemetry-otlp`.
- Use tonic as the underlying gRPC transport layer (default)
- Optional: TLS support using rustls
- Optional: Use the platform's native certificate store
- Optional: Use an async client
This makes working with cargo easier, because many commands (like cargo
check, cargo test) will apply to all crates by default, rather than
only selecting the crate in the top-level directory.
Added optional `serialize` feature that allows `SpanData` to be
serialized/deserialized using the `serde` crate.
Also added a basic unit test for `SpanData` to test serialization and
deserialization.
Fixes: #58.
Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>