Skip to content

Commit ac3b61a

Browse files
committed
better comment to reflect current state
1 parent 4d79c1c commit ac3b61a

File tree

4 files changed

+48
-36
lines changed
  • examples/logs-basic/src
  • opentelemetry-appender-tracing/examples
  • opentelemetry-otlp/examples

4 files changed

+48
-36
lines changed

examples/logs-basic/src/main.rs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,19 @@ fn main() {
1515
.with_simple_exporter(exporter)
1616
.build();
1717

18-
// For the OpenTelemetry layer, add a tracing filter to filter events from
19-
// OpenTelemetry and its dependent crates (opentelemetry-otlp uses crates
20-
// like reqwest/tonic etc.) from being sent back to OTel itself, thus
21-
// preventing infinite telemetry generation. The filter levels are set as
22-
// follows:
18+
// To prevent a telemetry-induced-telemetry loop, OpenTelemetry's own internal
19+
// logging is properly suppressed. However, logs emitted by external components
20+
// (such as reqwest, tonic, etc.) are not suppressed as they do not propagate
21+
// OpenTelemetry context. Until this issue is addressed
22+
// (https://github.com/open-telemetry/opentelemetry-rust/issues/2877),
23+
// filtering like this is the best way to suppress such logs.
24+
//
25+
// The filter levels are set as follows:
2326
// - Allow `info` level and above by default.
24-
// - Restrict `opentelemetry`, `hyper`, `tonic`, and `reqwest` completely.
25-
// Note: This will also drop events from crates like `tonic` etc. even when
26-
// they are used outside the OTLP Exporter. For more details, see:
27-
// https://github.com/open-telemetry/opentelemetry-rust/issues/761
27+
// - Completely restrict logs from `hyper`, `tonic`, `h2`, and `reqwest`.
28+
//
29+
// Note: This filtering will also drop logs from these components even when
30+
// they are used outside of the OTLP Exporter.
2831
let filter_otel = EnvFilter::new("info")
2932
.add_directive("hyper=off".parse().unwrap())
3033
.add_directive("tonic=off".parse().unwrap())

opentelemetry-appender-tracing/examples/basic.rs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,19 @@ fn main() {
1616
.with_simple_exporter(exporter)
1717
.build();
1818

19-
// For the OpenTelemetry layer, add a tracing filter to filter events from
20-
// OpenTelemetry and its dependent crates (opentelemetry-otlp uses crates
21-
// like reqwest/tonic etc.) from being sent back to OTel itself, thus
22-
// preventing infinite telemetry generation. The filter levels are set as
23-
// follows:
19+
// To prevent a telemetry-induced-telemetry loop, OpenTelemetry's own internal
20+
// logging is properly suppressed. However, logs emitted by external components
21+
// (such as reqwest, tonic, etc.) are not suppressed as they do not propagate
22+
// OpenTelemetry context. Until this issue is addressed
23+
// (https://github.com/open-telemetry/opentelemetry-rust/issues/2877),
24+
// filtering like this is the best way to suppress such logs.
25+
//
26+
// The filter levels are set as follows:
2427
// - Allow `info` level and above by default.
25-
// - Restrict `opentelemetry`, `hyper`, `tonic`, and `reqwest` completely.
26-
// Note: This will also drop events from crates like `tonic` etc. even when
27-
// they are used outside the OTLP Exporter. For more details, see:
28-
// https://github.com/open-telemetry/opentelemetry-rust/issues/761
28+
// - Completely restrict logs from `hyper`, `tonic`, `h2`, and `reqwest`.
29+
//
30+
// Note: This filtering will also drop logs from these components even when
31+
// they are used outside of the OTLP Exporter.
2932
let filter_otel = EnvFilter::new("info")
3033
.add_directive("hyper=off".parse().unwrap())
3134
.add_directive("opentelemetry=off".parse().unwrap())

opentelemetry-otlp/examples/basic-otlp-http/src/main.rs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -72,16 +72,19 @@ async fn main() -> Result<(), Box<dyn Error + Send + Sync + 'static>> {
7272
// Create a new OpenTelemetryTracingBridge using the above LoggerProvider.
7373
let otel_layer = OpenTelemetryTracingBridge::new(&logger_provider);
7474

75-
// For the OpenTelemetry layer, add a tracing filter to filter events from
76-
// OpenTelemetry and its dependent crates (opentelemetry-otlp uses crates
77-
// like reqwest/tonic etc.) from being sent back to OTel itself, thus
78-
// preventing infinite telemetry generation. The filter levels are set as
79-
// follows:
75+
// To prevent a telemetry-induced-telemetry loop, OpenTelemetry's own internal
76+
// logging is properly suppressed. However, logs emitted by external components
77+
// (such as reqwest, tonic, etc.) are not suppressed as they do not propagate
78+
// OpenTelemetry context. Until this issue is addressed
79+
// (https://github.com/open-telemetry/opentelemetry-rust/issues/2877),
80+
// filtering like this is the best way to suppress such logs.
81+
//
82+
// The filter levels are set as follows:
8083
// - Allow `info` level and above by default.
81-
// - Restrict `opentelemetry`, `hyper`, `tonic`, and `reqwest` completely.
82-
// Note: This will also drop events from crates like `tonic` etc. even when
83-
// they are used outside the OTLP Exporter. For more details, see:
84-
// https://github.com/open-telemetry/opentelemetry-rust/issues/761
84+
// - Completely restrict logs from `hyper`, `tonic`, `h2`, and `reqwest`.
85+
//
86+
// Note: This filtering will also drop logs from these components even when
87+
// they are used outside of the OTLP Exporter.
8588
let filter_otel = EnvFilter::new("info")
8689
.add_directive("hyper=off".parse().unwrap())
8790
.add_directive("tonic=off".parse().unwrap())

opentelemetry-otlp/examples/basic-otlp/src/main.rs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,16 +66,19 @@ async fn main() -> Result<(), Box<dyn Error + Send + Sync + 'static>> {
6666
// Create a new OpenTelemetryTracingBridge using the above LoggerProvider.
6767
let otel_layer = OpenTelemetryTracingBridge::new(&logger_provider);
6868

69-
// For the OpenTelemetry layer, add a tracing filter to filter events from
70-
// OpenTelemetry and its dependent crates (opentelemetry-otlp uses crates
71-
// like reqwest/tonic etc.) from being sent back to OTel itself, thus
72-
// preventing infinite telemetry generation. The filter levels are set as
73-
// follows:
69+
// To prevent a telemetry-induced-telemetry loop, OpenTelemetry's own internal
70+
// logging is properly suppressed. However, logs emitted by external components
71+
// (such as reqwest, tonic, etc.) are not suppressed as they do not propagate
72+
// OpenTelemetry context. Until this issue is addressed
73+
// (https://github.com/open-telemetry/opentelemetry-rust/issues/2877),
74+
// filtering like this is the best way to suppress such logs.
75+
//
76+
// The filter levels are set as follows:
7477
// - Allow `info` level and above by default.
75-
// - Restrict `opentelemetry`, `hyper`, `tonic`, and `reqwest` completely.
76-
// Note: This will also drop events from crates like `tonic` etc. even when
77-
// they are used outside the OTLP Exporter. For more details, see:
78-
// https://github.com/open-telemetry/opentelemetry-rust/issues/761
78+
// - Completely restrict logs from `hyper`, `tonic`, `h2`, and `reqwest`.
79+
//
80+
// Note: This filtering will also drop logs from these components even when
81+
// they are used outside of the OTLP Exporter.
7982
let filter_otel = EnvFilter::new("info")
8083
.add_directive("hyper=off".parse().unwrap())
8184
.add_directive("tonic=off".parse().unwrap())

0 commit comments

Comments
 (0)