Skip to content

Commit 35b0004

Browse files
authored
Merge branch 'main' into propogate-trace-errors
2 parents 3fe647d + cff5728 commit 35b0004

File tree

8 files changed

+98
-15
lines changed

8 files changed

+98
-15
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ jobs:
6565
with:
6666
toolchain: stable
6767
components: rustfmt, clippy
68-
- uses: taiki-e/install-action@d6d752794628f1e1fffa3c4d3c8874e06f043d50 # v2.62.15
68+
- uses: taiki-e/install-action@47be02f2de8a32619316956f6117e150bdc6763f # v2.62.44
6969
with:
7070
tool: cargo-hack
7171
- uses: arduino/setup-protoc@c65c819552d16ad3c9b72d9dfd5ba5237b9c906b # v3.0.0
@@ -93,7 +93,7 @@ jobs:
9393
# https://github.com/awslabs/cargo-check-external-types/releases
9494
toolchain: nightly-2025-05-04
9595
components: rustfmt
96-
- uses: taiki-e/install-action@d6d752794628f1e1fffa3c4d3c8874e06f043d50 # v2.62.15
96+
- uses: taiki-e/install-action@47be02f2de8a32619316956f6117e150bdc6763f # v2.62.44
9797
with:
9898
tool: cargo-check-external-types@0.2.0
9999
- name: external-type-check
@@ -117,7 +117,7 @@ jobs:
117117
- uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9
118118
with:
119119
toolchain: stable
120-
- uses: taiki-e/install-action@d6d752794628f1e1fffa3c4d3c8874e06f043d50 # v2.62.15
120+
- uses: taiki-e/install-action@47be02f2de8a32619316956f6117e150bdc6763f # v2.62.44
121121
with:
122122
tool: cargo-msrv
123123
- uses: arduino/setup-protoc@c65c819552d16ad3c9b72d9dfd5ba5237b9c906b # v3.0.0
@@ -199,7 +199,7 @@ jobs:
199199
with:
200200
repo-token: ${{ secrets.GITHUB_TOKEN }}
201201
- name: Install cargo-llvm-cov
202-
uses: taiki-e/install-action@d6d752794628f1e1fffa3c4d3c8874e06f043d50 # v2.62.15
202+
uses: taiki-e/install-action@47be02f2de8a32619316956f6117e150bdc6763f # v2.62.44
203203
with:
204204
tool: cargo-llvm-cov
205205
- name: cargo generate-lockfile
@@ -247,7 +247,7 @@ jobs:
247247
- uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9
248248
with:
249249
toolchain: stable
250-
- uses: taiki-e/install-action@d6d752794628f1e1fffa3c4d3c8874e06f043d50 # v2.62.15
250+
- uses: taiki-e/install-action@47be02f2de8a32619316956f6117e150bdc6763f # v2.62.44
251251
with:
252252
tool: cargo-machete
253253
- name: cargo machete

.github/workflows/codeql-analysis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ jobs:
3434
submodules: true
3535

3636
- name: Initialize CodeQL
37-
uses: github/codeql-action/init@3599b3baa15b485a2e49ef411a7a4bb2452e7f93 # v3.30.5
37+
uses: github/codeql-action/init@0499de31b99561a6d14a36a5f662c2a54f91beee # v4.31.2
3838
with:
3939
languages: rust
4040

4141
- name: Autobuild
42-
uses: github/codeql-action/autobuild@3599b3baa15b485a2e49ef411a7a4bb2452e7f93 # v3.30.5
42+
uses: github/codeql-action/autobuild@0499de31b99561a6d14a36a5f662c2a54f91beee # v4.31.2
4343

4444
- name: Perform CodeQL Analysis
45-
uses: github/codeql-action/analyze@3599b3baa15b485a2e49ef411a7a4bb2452e7f93 # v3.30.5
45+
uses: github/codeql-action/analyze@0499de31b99561a6d14a36a5f662c2a54f91beee # v4.31.2

.github/workflows/ossf-scorecard.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
# uploads of run results in SARIF format to the repository Actions tab.
4040
# https://docs.github.com/en/actions/advanced-guides/storing-workflow-data-as-artifacts
4141
- name: "Upload artifact"
42-
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
42+
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
4343
with:
4444
name: SARIF file
4545
path: results.sarif
@@ -48,6 +48,6 @@ jobs:
4848
# Upload the results to GitHub's code scanning dashboard (optional).
4949
# Commenting out will disable upload of results to your repo's Code Scanning dashboard
5050
- name: "Upload to code-scanning"
51-
uses: github/codeql-action/upload-sarif@3599b3baa15b485a2e49ef411a7a4bb2452e7f93 # v3.30.5
51+
uses: github/codeql-action/upload-sarif@0499de31b99561a6d14a36a5f662c2a54f91beee # v4.31.2
5252
with:
5353
sarif_file: results.sarif

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ rstest = "0.23.0"
8080
schemars = "0.8"
8181
sysinfo = "0.32"
8282
tempfile = "3.3.0"
83-
testcontainers = "0.23.1"
8483
tracing-log = "0.2"
8584
tracing-opentelemetry = "0.32"
8685
typed-builder = "0.20"

opentelemetry-otlp/tests/integration_test/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "integration_test_runner"
33
version = "0.1.0"
44
edition = "2021"
55
license = "Apache-2.0"
6-
rust-version = "1.75.0"
6+
rust-version = "1.88.0"
77
publish = false
88
autobenches = false
99

@@ -13,7 +13,7 @@ opentelemetry_sdk = { path = "../../../opentelemetry-sdk", features = ["rt-tokio
1313
opentelemetry-proto = { path = "../../../opentelemetry-proto", features = ["gen-tonic-messages", "trace", "logs", "metrics", "with-serde"] }
1414
tokio = { workspace = true, features = ["full"] }
1515
serde_json = { workspace = true }
16-
testcontainers = { workspace = true, features = ["http_wait"] }
16+
testcontainers = { version = "0.25.2", features = ["http_wait"] }
1717
anyhow = { workspace = true }
1818
ctor = { workspace = true }
1919
uuid = { workspace = true, features = ["v4"] }

opentelemetry-sdk/src/logs/log_processor.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,17 @@ pub trait LogProcessor: Send + Sync + Debug {
5858
/// After shutdown returns the log processor should stop processing any logs.
5959
/// It's up to the implementation on when to drop the LogProcessor.
6060
///
61-
/// All implementors should implement this method.
61+
/// Implementors that manage resources (background threads, network connections,
62+
/// file handles, etc.) should override this method to properly clean up.
63+
/// Processors that wrap other processors should forward the shutdown call to
64+
/// the wrapped processor(s).
65+
/// Simple processors that only transform log data can use the default implementation.
6266
fn shutdown_with_timeout(&self, _timeout: Duration) -> OTelSdkResult {
6367
// It would have been better to make this method required, but that ship
6468
// sailed when the logs API was declared stable.
6569
otel_warn!(
6670
name: "LogProcessor.DefaultShutdownWithTimeout",
67-
message = format!("LogProcessor::shutdown_with_timeout should be implemented by all LogProcessor types")
71+
message = "LogProcessor is using default shutdown implementation. If this processor manages background threads, network connections, file handles, or other resources that need cleanup, implement `shutdown_with_timeout()` to properly release them. Simple processors that only transform log data can safely use this default."
6872
);
6973
Ok(())
7074
}

opentelemetry/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Released 2025-Sep-25
1010

1111
- *Breaking* Change return type of `opentelemetry::global::set_tracer_provider` to Unit to align with metrics counterpart
1212
- Add `get_all` method to `opentelemetry::propagation::Extractor` to return all values of the given propagation key and provide a default implementation.
13+
- Add an `IntoIterator` implementation for `opentelemetry::trace::TraceState` to allow iterating through its key-value pair collection.
1314

1415
## 0.30.0
1516

opentelemetry/src/trace/span_context.rs

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,50 @@ impl FromStr for TraceState {
211211
}
212212
}
213213

214+
/// Iterator over TraceState key-value pairs as (&str, &str)
215+
#[derive(Debug)]
216+
pub struct TraceStateIter<'a> {
217+
inner: Option<std::collections::vec_deque::Iter<'a, (String, String)>>,
218+
}
219+
220+
impl<'a> Iterator for TraceStateIter<'a> {
221+
type Item = (&'a str, &'a str);
222+
223+
fn next(&mut self) -> Option<Self::Item> {
224+
self.inner
225+
.as_mut()?
226+
.next()
227+
.map(|(key, value)| (key.as_str(), value.as_str()))
228+
}
229+
230+
fn size_hint(&self) -> (usize, Option<usize>) {
231+
match &self.inner {
232+
Some(iter) => iter.size_hint(),
233+
None => (0, Some(0)),
234+
}
235+
}
236+
}
237+
238+
impl ExactSizeIterator for TraceStateIter<'_> {
239+
fn len(&self) -> usize {
240+
match &self.inner {
241+
Some(iter) => iter.len(),
242+
None => 0,
243+
}
244+
}
245+
}
246+
247+
impl<'a> IntoIterator for &'a TraceState {
248+
type Item = (&'a str, &'a str);
249+
type IntoIter = TraceStateIter<'a>;
250+
251+
fn into_iter(self) -> Self::IntoIter {
252+
TraceStateIter {
253+
inner: self.0.as_ref().map(|deque| deque.iter()),
254+
}
255+
}
256+
}
257+
214258
/// A specialized `Result` type for trace state operations.
215259
type TraceStateResult<T> = Result<T, TraceStateError>;
216260

@@ -417,4 +461,39 @@ mod tests {
417461
}"
418462
);
419463
}
464+
465+
#[test]
466+
fn test_tracestate_iter_empty() {
467+
let ts = TraceState::NONE;
468+
let mut iter = ts.into_iter();
469+
assert_eq!(iter.next(), None);
470+
assert_eq!(iter.size_hint(), (0, Some(0)));
471+
assert_eq!(iter.len(), 0);
472+
}
473+
474+
#[test]
475+
fn test_tracestate_iter_single() {
476+
let ts = TraceState::from_key_value(vec![("foo", "bar")]).unwrap();
477+
let mut iter = ts.into_iter();
478+
assert_eq!(iter.next(), Some(("foo", "bar")));
479+
assert_eq!(iter.next(), None);
480+
assert_eq!(iter.size_hint(), (0, Some(0)));
481+
}
482+
483+
#[test]
484+
fn test_tracestate_iter_multiple() {
485+
let ts = TraceState::from_key_value(vec![("foo", "bar"), ("apple", "banana")]).unwrap();
486+
let mut iter = ts.into_iter();
487+
assert_eq!(iter.next(), Some(("foo", "bar")));
488+
assert_eq!(iter.next(), Some(("apple", "banana")));
489+
assert_eq!(iter.next(), None);
490+
}
491+
492+
#[test]
493+
fn test_tracestate_iter_size_hint_and_len() {
494+
let ts = TraceState::from_key_value(vec![("foo", "bar"), ("apple", "banana")]).unwrap();
495+
let iter = ts.into_iter();
496+
assert_eq!(iter.size_hint(), (2, Some(2)));
497+
assert_eq!(iter.len(), 2);
498+
}
420499
}

0 commit comments

Comments
 (0)