Skip to content

Commit 99a7941

Browse files
authored
Merge branch 'main' into semconv_1.33.0
2 parents b9979b5 + c5f9718 commit 99a7941

File tree

19 files changed

+326
-126
lines changed

19 files changed

+326
-126
lines changed

.github/workflows/ci.yml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ jobs:
9898
with:
9999
toolchain: nightly-2024-06-30
100100
components: rustfmt
101+
- name: Patch dependencies versions
102+
run: bash ./scripts/patch_dependencies.sh
101103
- name: external-type-check
102104
run: |
103105
cargo install [email protected]
@@ -199,9 +201,11 @@ jobs:
199201
components: rustfmt,llvm-tools-preview
200202
- uses: arduino/setup-protoc@c65c819552d16ad3c9b72d9dfd5ba5237b9c906b # v3.0.0
201203
with:
202-
repo-token: ${{ secrets.GITHUB_TOKEN }}
203-
- name: cargo install cargo-llvm-cov
204-
uses: taiki-e/install-action@33734a118689b0b418824fb78ea2bf18e970b43b # cargo-llvm-cov
204+
repo-token: ${{ secrets.GITHUB_TOKEN }}
205+
- name: Install cargo-llvm-cov
206+
uses: taiki-e/install-action@33734a118689b0b418824fb78ea2bf18e970b43b # v2.50.4
207+
with:
208+
tool: cargo-llvm-cov
205209
- name: cargo generate-lockfile
206210
if: hashFiles('Cargo.lock') == ''
207211
run: cargo generate-lockfile
@@ -216,11 +220,11 @@ jobs:
216220
build-examples:
217221
runs-on: ubuntu-latest
218222
steps:
219-
- uses: actions/checkout@v4
220-
- uses: dtolnay/rust-toolchain@stable
223+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
224+
- uses: dtolnay/rust-toolchain@4305c38b25d97ef35a8ad1f985ccf2d2242004f2 # stable
221225
with:
222226
components: rustfmt
223-
- uses: arduino/setup-protoc@v3
227+
- uses: arduino/setup-protoc@c65c819552d16ad3c9b72d9dfd5ba5237b9c906b # v3.0.0
224228
with:
225229
repo-token: ${{ secrets.GITHUB_TOKEN }}
226230
- name: Build examples
@@ -250,4 +254,4 @@ jobs:
250254
with:
251255
tool: cargo-machete
252256
- name: cargo machete
253-
run: cargo machete
257+
run: cargo machete

deny.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,22 @@ exceptions = [
1515
{ allow = ["Unicode-3.0"], crate = "icu_locid" }, # This crate gets used transitively by `reqwest`.
1616
{ allow = ["Unicode-3.0"], crate = "icu_locid_transform" }, # This crate gets used transitively by `reqwest`.
1717
{ allow = ["Unicode-3.0"], crate = "icu_locid_transform_data" }, # This crate gets used transitively by `reqwest`.
18+
{ allow = ["Unicode-3.0"], crate = "icu_locale_core" }, # This crate gets used transitively by `reqwest`.
1819
{ allow = ["Unicode-3.0"], crate = "icu_normalizer" }, # This crate gets used transitively by `reqwest`.
1920
{ allow = ["Unicode-3.0"], crate = "icu_normalizer_data" }, # This crate gets used transitively by `reqwest`.
2021
{ allow = ["Unicode-3.0"], crate = "icu_properties" }, # This crate gets used transitively by `reqwest`.
2122
{ allow = ["Unicode-3.0"], crate = "icu_properties_data" }, # This crate gets used transitively by `reqwest`.
2223
{ allow = ["Unicode-3.0"], crate = "icu_provider" }, # This crate gets used transitively by `reqwest`.
2324
{ allow = ["Unicode-3.0"], crate = "icu_provider_macros" }, # This crate gets used transitively by `reqwest`.
25+
{ allow = ["Unicode-3.0"], crate = "potential_utf" }, # This crate gets used transitively by `reqwest`.
2426
{ allow = ["Unicode-3.0"], crate = "litemap" }, # This crate gets used transitively by `reqwest`.
2527
{ allow = ["Unicode-3.0"], crate = "tinystr" }, # This crate gets used transitively by `reqwest`.
2628
{ allow = ["Unicode-3.0"], crate = "writeable" }, # This crate gets used transitively by `reqwest`.
2729
{ allow = ["Unicode-3.0"], crate = "unicode-ident" }, # This crate gets used transitively by `reqwest` and other crates.
2830
{ allow = ["Unicode-3.0"], crate = "yoke" }, # This crate gets used transitively by `reqwest`.
2931
{ allow = ["Unicode-3.0"], crate = "yoke-derive" }, # This crate gets used transitively by `reqwest`.
3032
{ allow = ["Unicode-3.0"], crate = "zerovec" }, # This crate gets used transitively by `reqwest`.
33+
{ allow = ["Unicode-3.0"], crate = "zerotrie" }, # This crate gets used transitively by `reqwest`.
3134
{ allow = ["Unicode-3.0"], crate = "zerovec-derive" }, # This crate gets used transitively by `reqwest`.
3235
{ allow = ["Unicode-3.0"], crate = "zerofrom" }, # This crate gets used transitively by `reqwest`.
3336
{ allow = ["Unicode-3.0"], crate = "zerofrom-derive" }, # This crate gets used transitively by `reqwest`.

examples/tracing-http-propagator/src/server.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ use opentelemetry_sdk::{
1919
};
2020
use opentelemetry_semantic_conventions::trace;
2121
use opentelemetry_stdout::{LogExporter, SpanExporter};
22+
use std::time::Duration;
2223
use std::{convert::Infallible, net::SocketAddr, sync::OnceLock};
2324
use tokio::net::TcpListener;
2425
use tracing::info;
@@ -131,7 +132,7 @@ impl SpanProcessor for EnrichWithBaggageSpanProcessor {
131132
Ok(())
132133
}
133134

134-
fn shutdown(&self) -> OTelSdkResult {
135+
fn shutdown_with_timeout(&self, _timeout: Duration) -> OTelSdkResult {
135136
Ok(())
136137
}
137138

opentelemetry-otlp/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
- Update `tonic` dependency version to 0.13
66
- Re-export `tonic` types under `tonic_types`
77
[2898](https://github.com/open-telemetry/opentelemetry-rust/pull/2898)
8+
- It is now possible to add links to a `Span` via the `SpanRef` that you get from
9+
a `Context`. [2959](https://github.com/open-telemetry/opentelemetry-rust/pull/2959)
810

911
## 0.29.0
1012

opentelemetry-proto/src/transform/metrics.rs

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ pub mod tonic {
115115
ExportMetricsServiceRequest {
116116
resource_metrics: vec![TonicResourceMetrics {
117117
resource: Some((&rm.resource).into()),
118-
scope_metrics: rm.scope_metrics.iter().map(Into::into).collect(),
118+
scope_metrics: rm.scope_metrics().map(Into::into).collect(),
119119
schema_url: rm.resource.schema_url().map(Into::into).unwrap_or_default(),
120120
}],
121121
}
@@ -136,7 +136,7 @@ pub mod tonic {
136136
fn from(sm: &SdkScopeMetrics) -> Self {
137137
TonicScopeMetrics {
138138
scope: Some((&sm.scope, None).into()),
139-
metrics: sm.metrics.iter().map(Into::into).collect(),
139+
metrics: sm.metrics().map(Into::into).collect(),
140140
schema_url: sm
141141
.scope
142142
.schema_url()
@@ -208,17 +208,16 @@ pub mod tonic {
208208
fn from(hist: &SdkHistogram<T>) -> Self {
209209
TonicHistogram {
210210
data_points: hist
211-
.data_points
212-
.iter()
211+
.data_points()
213212
.map(|dp| TonicHistogramDataPoint {
214-
attributes: dp.attributes.iter().map(Into::into).collect(),
213+
attributes: dp.attributes().map(Into::into).collect(),
215214
start_time_unix_nano: to_nanos(hist.start_time),
216215
time_unix_nano: to_nanos(hist.time),
217216
count: dp.count,
218217
sum: Some(dp.sum.into_f64()),
219-
bucket_counts: dp.bucket_counts.clone(),
220-
explicit_bounds: dp.bounds.clone(),
221-
exemplars: dp.exemplars.iter().map(Into::into).collect(),
218+
bucket_counts: dp.bucket_counts().collect(),
219+
explicit_bounds: dp.bounds().collect(),
220+
exemplars: dp.exemplars().map(Into::into).collect(),
222221
flags: TonicDataPointFlags::default() as u32,
223222
min: dp.min.map(Numeric::into_f64),
224223
max: dp.max.map(Numeric::into_f64),
@@ -236,10 +235,9 @@ pub mod tonic {
236235
fn from(hist: &SdkExponentialHistogram<T>) -> Self {
237236
TonicExponentialHistogram {
238237
data_points: hist
239-
.data_points
240-
.iter()
238+
.data_points()
241239
.map(|dp| TonicExponentialHistogramDataPoint {
242-
attributes: dp.attributes.iter().map(Into::into).collect(),
240+
attributes: dp.attributes().map(Into::into).collect(),
243241
start_time_unix_nano: to_nanos(hist.start_time),
244242
time_unix_nano: to_nanos(hist.time),
245243
count: dp.count as u64,
@@ -255,7 +253,7 @@ pub mod tonic {
255253
bucket_counts: dp.negative_bucket.counts.clone(),
256254
}),
257255
flags: TonicDataPointFlags::default() as u32,
258-
exemplars: dp.exemplars.iter().map(Into::into).collect(),
256+
exemplars: dp.exemplars().map(Into::into).collect(),
259257
min: dp.min.map(Numeric::into_f64),
260258
max: dp.max.map(Numeric::into_f64),
261259
zero_threshold: dp.zero_threshold,
@@ -273,13 +271,12 @@ pub mod tonic {
273271
fn from(sum: &SdkSum<T>) -> Self {
274272
TonicSum {
275273
data_points: sum
276-
.data_points
277-
.iter()
274+
.data_points()
278275
.map(|dp| TonicNumberDataPoint {
279-
attributes: dp.attributes.iter().map(Into::into).collect(),
276+
attributes: dp.attributes().map(Into::into).collect(),
280277
start_time_unix_nano: to_nanos(sum.start_time),
281278
time_unix_nano: to_nanos(sum.time),
282-
exemplars: dp.exemplars.iter().map(Into::into).collect(),
279+
exemplars: dp.exemplars().map(Into::into).collect(),
283280
flags: TonicDataPointFlags::default() as u32,
284281
value: Some(dp.value.into()),
285282
})
@@ -297,13 +294,12 @@ pub mod tonic {
297294
fn from(gauge: &SdkGauge<T>) -> Self {
298295
TonicGauge {
299296
data_points: gauge
300-
.data_points
301-
.iter()
297+
.data_points()
302298
.map(|dp| TonicNumberDataPoint {
303-
attributes: dp.attributes.iter().map(Into::into).collect(),
299+
attributes: dp.attributes().map(Into::into).collect(),
304300
start_time_unix_nano: gauge.start_time.map(to_nanos).unwrap_or_default(),
305301
time_unix_nano: to_nanos(gauge.time),
306-
exemplars: dp.exemplars.iter().map(Into::into).collect(),
302+
exemplars: dp.exemplars().map(Into::into).collect(),
307303
flags: TonicDataPointFlags::default() as u32,
308304
value: Some(dp.value.into()),
309305
})
@@ -319,8 +315,7 @@ pub mod tonic {
319315
fn from(ex: &SdkExemplar<T>) -> Self {
320316
TonicExemplar {
321317
filtered_attributes: ex
322-
.filtered_attributes
323-
.iter()
318+
.filtered_attributes()
324319
.map(|kv| (&kv.key, &kv.value).into())
325320
.collect(),
326321
time_unix_nano: to_nanos(ex.time),

opentelemetry-sdk/CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ also modified to suppress telemetry before invoking exporters.
2525
- Fixed the overflow attribute to correctly use the boolean value `true`
2626
instead of the string `"true"`.
2727
[#2878](https://github.com/open-telemetry/opentelemetry-rust/issues/2878)
28+
- The `shutdown_with_timeout` method is added to SpanProcessor, SpanExporter trait and TracerProvider.
2829
- The `shutdown_with_timeout` method is added to LogExporter trait.
2930
- The `shutdown_with_timeout` method is added to LogProvider and LogProcessor trait.
3031
- *Breaking* `MetricError`, `MetricResult` no longer public (except when
@@ -47,6 +48,23 @@ also modified to suppress telemetry before invoking exporters.
4748
- *Breaking* change, affecting custom `PushMetricExporter` authors:
4849
- The `export` method on `PushMetricExporter` now accepts `&ResourceMetrics`
4950
instead of `&mut ResourceMetrics`.
51+
- `ResourceMetrics` no longer exposes `scope_metrics` field, but instead
52+
offers `scope_metrics()` method that returns an iterator over the same.
53+
- `ScopeMetrics` no longer exposes `metrics` field, but instead offers
54+
`metrics()` method that returns an iterator over the same.
55+
- `Sum`, `Gauge`, `Histogram` & `ExponentialHistogram` no longer exposes
56+
`data_points` field, but instead offers `data_points()` method that returns
57+
an iterator over the same.
58+
- `SumDataPoint`, `GaugeDataPoint`, `HistogramDataPoint` &
59+
`ExponentialHistogramDataPoint` no longer exposes `attributes`, `exemplars`
60+
field, but instead offers `attributes()`, and `exemplars()` method that
61+
returns an iterator over the same.
62+
- `Exemplar` no longer exposes `filtered_attributes` field, but instead
63+
offers `filtered_attributes()` method that returns an iterator over
64+
the same.
65+
- `HistogramDataPoint` no longer exposes `bounds` and `bucket_counts`, but
66+
instead offers `bounds()` and `bucket_counts()` methods that returns an
67+
iterator over the same.
5068

5169
## 0.29.0
5270

opentelemetry-sdk/benches/metric.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ use opentelemetry_sdk::{
99
data::ResourceMetrics, new_view, reader::MetricReader, Aggregation, Instrument,
1010
InstrumentKind, ManualReader, Pipeline, SdkMeterProvider, Stream, Temporality, View,
1111
},
12-
Resource,
1312
};
1413
use rand::Rng;
1514
use std::sync::{Arc, Weak};
@@ -240,10 +239,7 @@ fn counters(c: &mut Criterion) {
240239
});
241240

242241
let (rdr, cntr) = bench_counter(None, "cumulative");
243-
let mut rm = ResourceMetrics {
244-
resource: Resource::builder_empty().build(),
245-
scope_metrics: Vec::new(),
246-
};
242+
let mut rm = ResourceMetrics::default();
247243

248244
group.bench_function("CollectOneAttr", |b| {
249245
let mut v = 0;
@@ -337,10 +333,7 @@ fn benchmark_collect_histogram(b: &mut Bencher, n: usize) {
337333
h.record(1, &[]);
338334
}
339335

340-
let mut rm = ResourceMetrics {
341-
resource: Resource::builder_empty().build(),
342-
scope_metrics: Vec::new(),
343-
};
336+
let mut rm = ResourceMetrics::default();
344337

345338
b.iter(|| {
346339
let _ = r.collect(&mut rm);

opentelemetry-sdk/src/metrics/aggregation.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,8 @@ impl Aggregation {
151151
#[cfg(test)]
152152
mod tests {
153153
use crate::metrics::error::{MetricError, MetricResult};
154-
use crate::metrics::{
155-
internal::{EXPO_MAX_SCALE, EXPO_MIN_SCALE},
156-
Aggregation,
157-
};
154+
use crate::metrics::internal::{EXPO_MAX_SCALE, EXPO_MIN_SCALE};
155+
use crate::metrics::Aggregation;
158156

159157
#[test]
160158
fn validate_aggregation() {

0 commit comments

Comments
 (0)