Skip to content

Commit 8b8188d

Browse files
Merge branch 'main' into add-shutdown-with-timeout-for-log-exporter
2 parents 4fabae8 + 10cf02c commit 8b8188d

File tree

17 files changed

+73
-44
lines changed

17 files changed

+73
-44
lines changed

.cspell.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"anyvalue",
3030
"appender",
3131
"appenders",
32+
"autobenches",
3233
"Bhasin",
3334
"BLRP",
3435
"Cijo",

examples/metrics-advanced/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ bench = false
1313

1414
[dependencies]
1515
opentelemetry = { path = "../../opentelemetry", features = ["metrics"] }
16-
opentelemetry_sdk = { path = "../../opentelemetry-sdk", features = ["spec_unstable_metrics_views", "rt-tokio"] }
16+
opentelemetry_sdk = { path = "../../opentelemetry-sdk", features = ["spec_unstable_metrics_views"] }
1717
opentelemetry-stdout = { workspace = true, features = ["metrics"] }
1818
tokio = { workspace = true, features = ["full"] }

examples/metrics-basic/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ bench = false
1313

1414
[dependencies]
1515
opentelemetry = { path = "../../opentelemetry", features = ["metrics"] }
16-
opentelemetry_sdk = { path = "../../opentelemetry-sdk", features = ["metrics", "rt-tokio"] }
16+
opentelemetry_sdk = { path = "../../opentelemetry-sdk", features = ["metrics"] }
1717
opentelemetry-stdout = { workspace = true, features = ["metrics"] }
1818
tokio = { workspace = true, features = ["full"] }
1919

opentelemetry-prometheus/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
## vNext
44

5+
## 0.29.1
6+
7+
Released 2025-April-11
8+
9+
- Update `prometheus` dependency version to 0.14
10+
- Remove `protobuf` dependency
11+
512
## v0.29.0
613

714
- Update `opentelemetry` dependency version to 0.29

opentelemetry-prometheus/Cargo.toml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "opentelemetry-prometheus"
3-
version = "0.29.0"
4-
description = "Prometheus exporter for OpenTelemetry"
3+
version = "0.29.1"
4+
description = "Prometheus exporter for OpenTelemetry (This crate is discontinued and is no longer maintained)"
55
homepage = "https://github.com/open-telemetry/opentelemetry-rust/tree/main/opentelemetry-prometheus"
66
repository = "https://github.com/open-telemetry/opentelemetry-rust/tree/main/opentelemetry-prometheus"
77
readme = "README.md"
@@ -23,8 +23,7 @@ rustdoc-args = ["--cfg", "docsrs"]
2323
once_cell = { version = "1.13" }
2424
opentelemetry = { version = "0.29", default-features = false, features = ["metrics"] }
2525
opentelemetry_sdk = { version = "0.29", default-features = false, features = ["metrics"] }
26-
prometheus = "0.13"
27-
protobuf = "2.14"
26+
prometheus = "0.14"
2827
tracing = { version = ">=0.1.40", default-features = false, optional = true } # optional for opentelemetry internal logging
2928

3029
[dev-dependencies]

opentelemetry-prometheus/src/lib.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -439,13 +439,13 @@ fn validate_metrics(
439439
);
440440
return (true, None);
441441
}
442-
if existing.get_help() != description {
442+
if existing.help() != description {
443443
otel_warn!(
444444
name: "MetricValidationFailed",
445445
message = "Instrument description conflict, using existing",
446-
metric_description = format!("Instrument {name}, Existing: {:?}, dropped: {:?}", existing.get_help().to_string(), description.to_string()).as_str(),
446+
metric_description = format!("Instrument {name}, Existing: {:?}, dropped: {:?}", existing.help().to_string(), description.to_string()).as_str(),
447447
);
448-
return (false, Some(existing.get_help().to_string()));
448+
return (false, Some(existing.help().to_string()));
449449
}
450450
(false, None)
451451
} else {
@@ -491,16 +491,16 @@ fn add_histogram_metric<T: Numeric>(
491491
let mut h = prometheus::proto::Histogram::default();
492492
h.set_sample_sum(dp.sum.as_f64());
493493
h.set_sample_count(dp.count);
494-
h.set_bucket(protobuf::RepeatedField::from_vec(bucket));
494+
h.set_bucket(bucket);
495495
let mut pm = prometheus::proto::Metric::default();
496-
pm.set_label(protobuf::RepeatedField::from_vec(kvs));
496+
pm.set_label(kvs);
497497
pm.set_histogram(h);
498498

499499
let mut mf = prometheus::proto::MetricFamily::default();
500500
mf.set_name(name.to_string());
501501
mf.set_help(description.clone());
502502
mf.set_field_type(prometheus::proto::MetricType::HISTOGRAM);
503-
mf.set_metric(protobuf::RepeatedField::from_vec(vec![pm]));
503+
mf.set_metric(vec![pm]);
504504
res.push(mf);
505505
}
506506
}
@@ -525,7 +525,7 @@ fn add_sum_metric<T: Numeric>(
525525
);
526526

527527
let mut pm = prometheus::proto::Metric::default();
528-
pm.set_label(protobuf::RepeatedField::from_vec(kvs));
528+
pm.set_label(kvs);
529529

530530
if sum.is_monotonic {
531531
let mut c = prometheus::proto::Counter::default();
@@ -541,7 +541,7 @@ fn add_sum_metric<T: Numeric>(
541541
mf.set_name(name.to_string());
542542
mf.set_help(description.clone());
543543
mf.set_field_type(metric_type);
544-
mf.set_metric(protobuf::RepeatedField::from_vec(vec![pm]));
544+
mf.set_metric(vec![pm]);
545545
res.push(mf);
546546
}
547547
}
@@ -562,14 +562,14 @@ fn add_gauge_metric<T: Numeric>(
562562
let mut g = prometheus::proto::Gauge::default();
563563
g.set_value(dp.value.as_f64());
564564
let mut pm = prometheus::proto::Metric::default();
565-
pm.set_label(protobuf::RepeatedField::from_vec(kvs));
565+
pm.set_label(kvs);
566566
pm.set_gauge(g);
567567

568568
let mut mf = prometheus::proto::MetricFamily::default();
569569
mf.set_name(name.to_string());
570570
mf.set_help(description.to_string());
571571
mf.set_field_type(MetricType::GAUGE);
572-
mf.set_metric(protobuf::RepeatedField::from_vec(vec![pm]));
572+
mf.set_metric(vec![pm]);
573573
res.push(mf);
574574
}
575575
}
@@ -583,17 +583,17 @@ fn create_info_metric(
583583
g.set_value(1.0);
584584

585585
let mut m = prometheus::proto::Metric::default();
586-
m.set_label(protobuf::RepeatedField::from_vec(get_attrs(
586+
m.set_label(get_attrs(
587587
&mut resource.iter(),
588588
&[],
589-
)));
589+
));
590590
m.set_gauge(g);
591591

592592
let mut mf = MetricFamily::default();
593593
mf.set_name(target_info_name.into());
594594
mf.set_help(target_info_description.into());
595595
mf.set_field_type(MetricType::GAUGE);
596-
mf.set_metric(protobuf::RepeatedField::from_vec(vec![m]));
596+
mf.set_metric(vec![m]);
597597
mf
598598
}
599599

@@ -614,14 +614,14 @@ fn create_scope_info_metric(scope: &InstrumentationScope) -> MetricFamily {
614614
}
615615

616616
let mut m = prometheus::proto::Metric::default();
617-
m.set_label(protobuf::RepeatedField::from_vec(labels));
617+
m.set_label(labels);
618618
m.set_gauge(g);
619619

620620
let mut mf = MetricFamily::default();
621621
mf.set_name(SCOPE_INFO_METRIC_NAME.into());
622622
mf.set_help(SCOPE_INFO_DESCRIPTION.into());
623623
mf.set_field_type(MetricType::GAUGE);
624-
mf.set_metric(protobuf::RepeatedField::from_vec(vec![m]));
624+
mf.set_metric(vec![m]);
625625
mf
626626
}
627627

opentelemetry-sdk/CHANGELOG.md

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@
22

33
## vNext
44

5-
[#2868](https://github.com/open-telemetry/opentelemetry-rust/pull/2868)
6-
`SdkLogger`, `SdkTracer` modified to respect telemetry suppression based on
5+
- **Feature**: Added context based telemetry suppression. [#2868](https://github.com/open-telemetry/opentelemetry-rust/pull/2868)
6+
- `SdkLogger`, `SdkTracer` modified to respect telemetry suppression based on
77
`Context`. In other words, if the current context has telemetry suppression
8-
enabled, then logs/spans will be ignored. The flag is typically set by OTel
8+
enabled, then logs/spans will be ignored.
9+
- The flag is typically set by OTel
910
components to prevent telemetry from itself being fed back into OTel.
10-
`BatchLogProcessor`, `BatchSpanProcessor`, and `PeriodicReader` modified to set
11+
- `BatchLogProcessor`, `BatchSpanProcessor`, and `PeriodicReader` modified to set
1112
the suppression flag in their dedicated thread, so that telemetry generated from
12-
those threads will not be fed back into OTel. Similarly, `SimpleLogProcessor`
13+
those threads will not be fed back into OTel.
14+
- Similarly, `SimpleLogProcessor`
1315
also modified to suppress telemetry before invoking exporters.
1416

1517
- **Feature**: Implemented and enabled cardinality capping for Metrics by
@@ -23,15 +25,25 @@ also modified to suppress telemetry before invoking exporters.
2325
- Fixed the overflow attribute to correctly use the boolean value `true`
2426
instead of the string `"true"`.
2527
[#2878](https://github.com/open-telemetry/opentelemetry-rust/issues/2878)
26-
- *Breaking* change for custom `MetricReader` authors.
27-
The `shutdown_with_timeout` method is added to `MetricReader` trait.
28-
`collect` method on `MetricReader` modified to return `OTelSdkResult`.
2928
- *Breaking* The `shutdown_with_timeout` method is added to LogExporter trait. This is breaking change for custom `LogExporter` authors.
3029
- [#2905](https://github.com/open-telemetry/opentelemetry-rust/pull/2905)
3130
- *Breaking* `MetricError`, `MetricResult` no longer public (except when
3231
`spec_unstable_metrics_views` feature flag is enabled). `OTelSdkResult` should
33-
be used instead, wherever applicable.
32+
be used instead, wherever applicable. [#2906](https://github.com/open-telemetry/opentelemetry-rust/pull/2906)
33+
- *Breaking* change, affecting custom `MetricReader` authors:
34+
- The
35+
`shutdown_with_timeout` method is added to `MetricReader` trait.
36+
- `collect`
37+
method on `MetricReader` modified to return `OTelSdkResult`.
3438
[#2905](https://github.com/open-telemetry/opentelemetry-rust/pull/2905)
39+
- `MetricReader`
40+
trait, `ManualReader` struct, `Pipeline` struct, `InstrumentKind` enum moved
41+
behind feature flag "experimental_metrics_custom_reader".
42+
[#2928](https://github.com/open-telemetry/opentelemetry-rust/pull/2928)
43+
44+
- *Breaking* `Aggregation` enum moved behind feature flag
45+
"spec_unstable_metrics_views". This was only required when using Views.
46+
[#2928](https://github.com/open-telemetry/opentelemetry-rust/pull/2928)
3547

3648
## 0.29.0
3749

opentelemetry-sdk/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ rt-tokio-current-thread = ["tokio", "tokio-stream", "experimental_async_runtime"
5353
internal-logs = ["opentelemetry/internal-logs"]
5454
experimental_metrics_periodicreader_with_async_runtime = ["metrics", "experimental_async_runtime"]
5555
spec_unstable_metrics_views = ["metrics"]
56+
experimental_metrics_custom_reader = ["metrics"]
5657
experimental_logs_batch_log_processor_with_async_runtime = ["logs", "experimental_async_runtime"]
5758
experimental_logs_concurrent_log_processor = ["logs"]
5859
experimental_trace_batch_span_processor_with_async_runtime = ["trace", "experimental_async_runtime"]
@@ -107,7 +108,7 @@ required-features = ["testing"]
107108
[[bench]]
108109
name = "metric"
109110
harness = false
110-
required-features = ["metrics", "spec_unstable_metrics_views"]
111+
required-features = ["metrics", "spec_unstable_metrics_views", "experimental_metrics_custom_reader"]
111112

112113
[[bench]]
113114
name = "log"

opentelemetry-sdk/src/metrics/meter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -696,7 +696,7 @@ where
696696
mod tests {
697697
use std::borrow::Cow;
698698

699-
use crate::metrics::MetricError;
699+
use crate::metrics::error::MetricError;
700700

701701
use super::{
702702
validate_instrument_name, validate_instrument_unit, INSTRUMENT_NAME_EMPTY,

opentelemetry-sdk/src/metrics/meter_provider.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ use crate::error::OTelSdkResult;
1616
use crate::Resource;
1717

1818
use super::{
19-
exporter::PushMetricExporter, meter::SdkMeter, noop::NoopMeter, pipeline::Pipelines,
20-
reader::MetricReader, view::View, PeriodicReader,
19+
exporter::PushMetricExporter, meter::SdkMeter, noop::NoopMeter,
20+
periodic_reader::PeriodicReader, pipeline::Pipelines, reader::MetricReader, view::View,
2121
};
2222

2323
/// Handles the creation and coordination of [Meter]s.

0 commit comments

Comments
 (0)