Skip to content

Commit 25156f0

Browse files
Merge branch 'main' into add-shutdown-with-timeout-for-metric-exporter
2 parents 548ffa4 + 99cb67d commit 25156f0

File tree

69 files changed

+546
-165
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+546
-165
lines changed

.cspell.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@
4242
"Dwarnings",
4343
"EPYC",
4444
"flamegraph",
45+
"Gerring",
46+
"Grübel",
4547
"hasher",
4648
"Isobel",
4749
"jaegertracing",

.github/workflows/benchmark.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ jobs:
3232
- uses: actions/checkout@v4
3333
with:
3434
fetch-depth: 10 # Fetch current commit and its parent
35+
- name: "Show change commit"
36+
run: git log -1
3537
- uses: arduino/setup-protoc@v3
3638
with:
3739
repo-token: ${{ secrets.GITHUB_TOKEN }}
@@ -42,13 +44,17 @@ jobs:
4244
with:
4345
cwd: opentelemetry
4446
branchName: ${{ env.BRANCH_NAME }}
47+
- name: "Checkout change commit"
48+
run: git checkout $GITHUB_SHA
4549
- uses: boa-dev/criterion-compare-action@v3
4650
with:
4751
cwd: opentelemetry-appender-tracing
4852
features: spec_unstable_logs_enabled
4953
branchName: ${{ env.BRANCH_NAME }}
54+
- name: "Checkout change commit"
55+
run: git checkout $GITHUB_SHA
5056
- uses: boa-dev/criterion-compare-action@v3
5157
with:
5258
cwd: opentelemetry-sdk
53-
features: rt-tokio,testing,metrics,logs,spec_unstable_metrics_views
59+
features: testing,metrics,logs,spec_unstable_metrics_views,spec_unstable_logs_enabled,experimental_logs_concurrent_log_processor
5460
branchName: ${{ env.BRANCH_NAME }}

.github/workflows/ci.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,10 @@ jobs:
5858
submodules: true
5959
- uses: dtolnay/rust-toolchain@stable
6060
with:
61-
components: rustfmt
61+
components: rustfmt, clippy
62+
- uses: taiki-e/install-action@v2
63+
with:
64+
tool: cargo-hack
6265
- uses: arduino/setup-protoc@v3
6366
with:
6467
repo-token: ${{ secrets.GITHUB_TOKEN }}

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ you're more than welcome to participate!
187187

188188
### Approvers
189189

190+
* [Anton Grübel](https://github.com/gruebel), Baz
190191
* [Shaun Cox](https://github.com/shaun-cox), Microsoft
191192
* [Scott Gerring](https://github.com/scottgerring), Datadog
192193

docs/design/logs.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,25 @@ only meant for OTel components itself and anyone writing extensions like custom
345345
Exporters etc.
346346

347347
// TODO: Document the principles followed when selecting severity for internal
348-
logs // TODO: Document how this can cause circular loop and plans to address it.
348+
logs
349+
350+
When OpenTelemetry components generate logs that could potentially feed back
351+
into OpenTelemetry, this can result in what is known as "telemetry-induced
352+
telemetry." To address this, OpenTelemetry provides a mechanism to suppress such
353+
telemetry using the `Context`. Components are expected to mark telemetry as
354+
suppressed within a specific `Context` by invoking
355+
`Context::enter_telemetry_suppressed_scope()`. The Logs SDK implementation
356+
checks this flag in the current `Context` and ignores logs if suppression is
357+
enabled.
358+
359+
This mechanism relies on proper in-process propagation of the `Context`.
360+
However, external libraries like `hyper` and `tonic`, which are used by
361+
OpenTelemetry in its OTLP Exporters, do not propagate OpenTelemetry's `Context`.
362+
As a result, the suppression mechanism does not work out-of-the-box to suppress
363+
logs originating from these libraries.
364+
365+
// TODO: Document how OTLP can solve this issue without asking external
366+
crates to respect and propagate OTel Context.
349367

350368
## Summary
351369

examples/logs-basic/Cargo.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ version = "0.1.0"
44
edition = "2021"
55
license = "Apache-2.0"
66
publish = false
7+
autobenches = false
8+
9+
[[bin]]
10+
name = "logs-basic"
11+
path = "src/main.rs"
12+
bench = false
713

814
[dependencies]
915
opentelemetry_sdk = { path = "../../opentelemetry-sdk", features = ["logs"] }

examples/logs-basic/src/main.rs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,21 @@ 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())
30-
.add_directive("opentelemetry=off".parse().unwrap())
3133
.add_directive("tonic=off".parse().unwrap())
3234
.add_directive("h2=off".parse().unwrap())
3335
.add_directive("reqwest=off".parse().unwrap());

examples/metrics-advanced/Cargo.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ version = "0.1.0"
44
edition = "2021"
55
license = "Apache-2.0"
66
publish = false
7+
autobenches = false
8+
9+
[[bin]]
10+
name = "metrics-advanced"
11+
path = "src/main.rs"
12+
bench = false
713

814
[dependencies]
915
opentelemetry = { path = "../../opentelemetry", features = ["metrics"] }

examples/metrics-basic/Cargo.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ version = "0.1.0"
44
edition = "2021"
55
license = "Apache-2.0"
66
publish = false
7+
autobenches = false
8+
9+
[[bin]]
10+
name = "metrics-basic"
11+
path = "src/main.rs"
12+
bench = false
713

814
[dependencies]
915
opentelemetry = { path = "../../opentelemetry", features = ["metrics"] }

examples/tracing-grpc/Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,25 @@ version = "0.1.0"
44
edition = "2021"
55
license = "Apache-2.0"
66
publish = false
7+
autobenches = false
78

89
[[bin]] # Bin to run the gRPC server
910
name = "grpc-server"
1011
path = "src/server.rs"
12+
bench = false
1113

1214
[[bin]] # Bin to run the gRPC client
1315
name = "grpc-client"
1416
path = "src/client.rs"
17+
bench = false
1518

1619
[dependencies]
1720
opentelemetry = { path = "../../opentelemetry" }
1821
opentelemetry_sdk = { path = "../../opentelemetry-sdk", features = ["rt-tokio"] }
1922
opentelemetry-stdout = { workspace = true, features = ["trace"] }
2023
prost = { workspace = true }
2124
tokio = { workspace = true, features = ["full"] }
22-
tonic = { workspace = true, features = ["server", "codegen", "channel", "prost"] }
25+
tonic = { workspace = true, features = ["server", "codegen", "channel", "prost", "router"] }
2326

2427
[build-dependencies]
2528
tonic-build = { workspace = true }

0 commit comments

Comments
 (0)