Skip to content

Commit 49c88ea

Browse files
cijothomasTommyCpp
andauthored
Minor fix to OTLP doc and integration test (#1758)
Co-authored-by: Zhongyang Wu <[email protected]>
1 parent 10f99bf commit 49c88ea

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

opentelemetry-otlp/src/lib.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -24,23 +24,25 @@
2424
//! Then install a new pipeline with the recommended defaults to start exporting
2525
//! telemetry. You will have to build a OTLP exporter first.
2626
//!
27-
//! Tracing and metrics pipelines can be started with `new_pipeline().tracing()` and
28-
//! `new_pipeline().metrics()` respectively.
27+
//! Exporting pipelines can be started with `new_pipeline().tracing()` and
28+
//! `new_pipeline().metrics()`, and `new_pipeline().logging()` respectively for
29+
//! traces, metrics and logs.
2930
//!
3031
//! ```no_run
3132
//! # #[cfg(all(feature = "trace", feature = "grpc-tonic"))]
3233
//! # {
34+
//! use opentelemetry::global;
3335
//! use opentelemetry::trace::Tracer;
3436
//!
3537
//! fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync + 'static>> {
3638
//! // First, create a OTLP exporter builder. Configure it as you need.
3739
//! let otlp_exporter = opentelemetry_otlp::new_exporter().tonic();
3840
//! // Then pass it into pipeline builder
39-
//! let tracer = opentelemetry_otlp::new_pipeline()
41+
//! let _ = opentelemetry_otlp::new_pipeline()
4042
//! .tracing()
4143
//! .with_exporter(otlp_exporter)
4244
//! .install_simple()?;
43-
//!
45+
//! let tracer = global::tracer("my_tracer");
4446
//! tracer.in_span("doing_work", |cx| {
4547
//! // Traced app logic here...
4648
//! });

opentelemetry-otlp/tests/integration_test/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ opentelemetry-proto = { path = "../../../opentelemetry-proto", features = ["gen-
1515
tokio = { version = "1.0", features = ["full"] }
1616
serde_json = "1"
1717
testcontainers = "0.15.0"
18+
# env_logger = "0.11.3" // uncomment if needed for local debugging.

opentelemetry-otlp/tests/integration_test/tests/integration_tests.rs

+5
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ impl TestSuite {
5252
#[tokio::test(flavor = "multi_thread", worker_threads = 4)]
5353
#[ignore] // skip when running unit test
5454
async fn integration_tests() {
55+
// Uncomment to see logs from testcontainers
56+
// env_logger::init();
57+
// Run locally using the below command
58+
// cargo test -- --ignored --nocapture
59+
5560
let test_suites = [TestSuite::new("traces.json")];
5661

5762
let mut collector_image = Collector::default();

0 commit comments

Comments
 (0)