Skip to content

Commit

Permalink
Minor fix to OTLP doc and integration test (#1758)
Browse files Browse the repository at this point in the history
Co-authored-by: Zhongyang Wu <[email protected]>
  • Loading branch information
cijothomas and TommyCpp authored May 15, 2024
1 parent 10f99bf commit 49c88ea
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
10 changes: 6 additions & 4 deletions opentelemetry-otlp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,25 @@
//! Then install a new pipeline with the recommended defaults to start exporting
//! telemetry. You will have to build a OTLP exporter first.
//!
//! Tracing and metrics pipelines can be started with `new_pipeline().tracing()` and
//! `new_pipeline().metrics()` respectively.
//! Exporting pipelines can be started with `new_pipeline().tracing()` and
//! `new_pipeline().metrics()`, and `new_pipeline().logging()` respectively for
//! traces, metrics and logs.
//!
//! ```no_run
//! # #[cfg(all(feature = "trace", feature = "grpc-tonic"))]
//! # {
//! use opentelemetry::global;
//! use opentelemetry::trace::Tracer;
//!
//! fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync + 'static>> {
//! // First, create a OTLP exporter builder. Configure it as you need.
//! let otlp_exporter = opentelemetry_otlp::new_exporter().tonic();
//! // Then pass it into pipeline builder
//! let tracer = opentelemetry_otlp::new_pipeline()
//! let _ = opentelemetry_otlp::new_pipeline()
//! .tracing()
//! .with_exporter(otlp_exporter)
//! .install_simple()?;
//!
//! let tracer = global::tracer("my_tracer");
//! tracer.in_span("doing_work", |cx| {
//! // Traced app logic here...
//! });
Expand Down
1 change: 1 addition & 0 deletions opentelemetry-otlp/tests/integration_test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ opentelemetry-proto = { path = "../../../opentelemetry-proto", features = ["gen-
tokio = { version = "1.0", features = ["full"] }
serde_json = "1"
testcontainers = "0.15.0"
# env_logger = "0.11.3" // uncomment if needed for local debugging.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ impl TestSuite {
#[tokio::test(flavor = "multi_thread", worker_threads = 4)]
#[ignore] // skip when running unit test
async fn integration_tests() {
// Uncomment to see logs from testcontainers
// env_logger::init();
// Run locally using the below command
// cargo test -- --ignored --nocapture

let test_suites = [TestSuite::new("traces.json")];

let mut collector_image = Collector::default();
Expand Down

0 comments on commit 49c88ea

Please sign in to comment.