Skip to content

Commit

Permalink
Merge branch 'main' into tracer-provider-drop-shutdown-check
Browse files Browse the repository at this point in the history
  • Loading branch information
lalitb authored Oct 22, 2024
2 parents 14a42cc + ea4b5e4 commit 2e5899b
Show file tree
Hide file tree
Showing 8 changed files with 294 additions and 140 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"traceId": "9b458af7378cba65253d7042d34fc72e",
"spanId": "cd7cf7bf939930b7",
"parentSpanId": "",
"flags": 1,
"name": "Sub operation...",
"kind": 1,
"startTimeUnixNano": "1703985537070566698",
Expand All @@ -40,32 +41,12 @@
}
],
"status": {}
}
]
}
]
},
{
"resource": {
"attributes": [
{
"key": "service.name",
"value": {
"stringValue": "basic-otlp-tracing-example"
}
}
]
},
"scopeSpans": [
{
"scope": {
"name": "ex.com/basic"
},
"spans": [
},
{
"traceId": "9b458af7378cba65253d7042d34fc72e",
"spanId": "d58cf2d702a061e0",
"parentSpanId": "cd7cf7bf939930b7",
"flags": 1,
"name": "operation",
"kind": 1,
"startTimeUnixNano": "1703985537070558635",
Expand Down
31 changes: 3 additions & 28 deletions opentelemetry-otlp/tests/integration_test/expected/traces.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"traceId": "9b458af7378cba65253d7042d34fc72e",
"spanId": "cd7cf7bf939930b7",
"parentSpanId": "d58cf2d702a061e0",
"flags": 1,
"name": "Sub operation...",
"kind": 1,
"startTimeUnixNano": "1703985537070566698",
Expand All @@ -40,32 +41,12 @@
}
],
"status": {}
}
]
}
]
},
{
"resource": {
"attributes": [
{
"key": "service.name",
"value": {
"stringValue": "basic-otlp-tracing-example"
}
}
]
},
"scopeSpans": [
{
"scope": {
"name": "ex.com/basic"
},
"spans": [
},
{
"traceId": "9b458af7378cba65253d7042d34fc72e",
"spanId": "d58cf2d702a061e0",
"parentSpanId": "",
"flags": 1,
"name": "operation",
"kind": 1,
"startTimeUnixNano": "1703985537070558635",
Expand All @@ -88,12 +69,6 @@
"value": {
"intValue": "100"
}
},
{
"key": "number/int",
"value": {
"intValue": 100
}
}
]
}
Expand Down
4 changes: 4 additions & 0 deletions opentelemetry-prometheus/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
## vNext

- Bump MSRV to 1.70 [#2179](https://github.com/open-telemetry/opentelemetry-rust/pull/2179)
- Update `opentelemetry` dependency version to 0.26
- Update `opentelemetry_sdk` dependency version to 0.26
- Update `opentelemetry-semantic-conventions` dependency version to 0.26


## v0.17.0

Expand Down
6 changes: 3 additions & 3 deletions opentelemetry-prometheus/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ rustdoc-args = ["--cfg", "docsrs"]

[dependencies]
once_cell = { workspace = true }
opentelemetry = { version = "0.24", default-features = false, features = ["metrics"] }
opentelemetry_sdk = { version = "0.24", default-features = false, features = ["metrics"] }
opentelemetry = { version = "0.26", default-features = false, features = ["metrics"] }
opentelemetry_sdk = { version = "0.26", default-features = false, features = ["metrics"] }
prometheus = "0.13"
protobuf = "2.14"

[dev-dependencies]
opentelemetry-semantic-conventions = { version = "0.16" }
opentelemetry-semantic-conventions = { version = "0.26" }
http-body-util = { workspace = true }
hyper = { workspace = true, features = ["full"] }
hyper-util = { workspace = true, features = ["full"] }
Expand Down
24 changes: 1 addition & 23 deletions opentelemetry-prometheus/src/config.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
use core::fmt;
use once_cell::sync::OnceCell;
use opentelemetry::metrics::{MetricsError, Result};
use opentelemetry_sdk::metrics::{
reader::{AggregationSelector, MetricProducer},
ManualReaderBuilder,
};
use opentelemetry_sdk::metrics::ManualReaderBuilder;
use std::sync::{Arc, Mutex};

use crate::{Collector, PrometheusExporter, ResourceSelector};
Expand Down Expand Up @@ -105,16 +102,6 @@ impl ExporterBuilder {
self
}

/// Configure the [AggregationSelector] the exporter will use.
///
/// If no selector is provided, the [DefaultAggregationSelector] is used.
///
/// [DefaultAggregationSelector]: opentelemetry_sdk::metrics::reader::DefaultAggregationSelector
pub fn with_aggregation_selector(mut self, agg: impl AggregationSelector + 'static) -> Self {
self.reader = self.reader.with_aggregation_selector(agg);
self
}

/// Configures whether to export resource as attributes with every metric.
///
/// Note that this is orthogonal to the `target_info` metric, which can be disabled using `without_target_info`.
Expand All @@ -128,15 +115,6 @@ impl ExporterBuilder {
self
}

/// Registers an external [MetricProducer] with this reader.
///
/// The producer is used as a source of aggregated metric data which is
/// incorporated into metrics collected from the SDK.
pub fn with_producer(mut self, producer: impl MetricProducer + 'static) -> Self {
self.reader = self.reader.with_producer(producer);
self
}

/// Creates a new [PrometheusExporter] from this configuration.
pub fn build(self) -> Result<PrometheusExporter> {
let reader = Arc::new(self.reader.build());
Expand Down
10 changes: 2 additions & 8 deletions opentelemetry-prometheus/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ use opentelemetry::{
use opentelemetry_sdk::{
metrics::{
data::{self, ResourceMetrics, Temporality},
reader::{AggregationSelector, MetricReader, TemporalitySelector},
Aggregation, InstrumentKind, ManualReader, Pipeline,
reader::{MetricReader, TemporalitySelector},
InstrumentKind, ManualReader, Pipeline,
},
Resource, Scope,
};
Expand Down Expand Up @@ -160,12 +160,6 @@ impl TemporalitySelector for PrometheusExporter {
}
}

impl AggregationSelector for PrometheusExporter {
fn aggregation(&self, kind: InstrumentKind) -> Aggregation {
self.reader.aggregation(kind)
}
}

impl MetricReader for PrometheusExporter {
fn register_pipeline(&self, pipeline: Weak<Pipeline>) {
self.reader.register_pipeline(pipeline)
Expand Down
Loading

0 comments on commit 2e5899b

Please sign in to comment.