Skip to content

Commit

Permalink
Upgrade opentelemetry to 0.21 (#628)
Browse files Browse the repository at this point in the history
  • Loading branch information
h7kanna authored Nov 13, 2023
1 parent 2e9e3b0 commit a1351da
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ resolver = "2"
[workspace.dependencies]
tonic = "0.9"
tonic-build = "0.9"
opentelemetry = "0.20"
opentelemetry = "0.21"
8 changes: 4 additions & 4 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ lru = "0.11"
mockall = "0.11"
nix = { version = "0.27", optional = true, features = ["process", "signal"] }
once_cell = "1.5"
opentelemetry = { workspace = true, features = ["rt-tokio", "metrics"] }
opentelemetry_sdk = { version = "0.20", features = ["metrics"] }
opentelemetry-otlp = { version = "0.13", features = ["tokio", "metrics"] }
opentelemetry-prometheus = "0.13"
opentelemetry = { workspace = true, features = ["metrics"] }
opentelemetry_sdk = { version = "0.21", features = ["rt-tokio", "metrics"] }
opentelemetry-otlp = { version = "0.14", features = ["tokio", "metrics"] }
opentelemetry-prometheus = "0.14"
parking_lot = { version = "0.12", features = ["send_guard"] }
pin-project = "1.0"
prometheus = "0.13"
Expand Down
14 changes: 7 additions & 7 deletions core/src/telemetry/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -582,13 +582,13 @@ impl MemoryGaugeU64 {
pub fn build_otlp_metric_exporter(
opts: OtelCollectorOptions,
) -> Result<CoreOtelMeter, anyhow::Error> {
let exporter = opentelemetry_otlp::MetricsExporter::new(
opentelemetry_otlp::TonicExporterBuilder::default()
.with_endpoint(opts.url.to_string())
.with_metadata(MetadataMap::from_headers((&opts.headers).try_into()?)),
Box::new(metric_temporality_to_selector(opts.metric_temporality)),
Box::<SDKAggSelector>::default(),
)?;
let exporter = opentelemetry_otlp::TonicExporterBuilder::default()
.with_endpoint(opts.url.to_string())
.with_metadata(MetadataMap::from_headers((&opts.headers).try_into()?))
.build_metrics_exporter(
Box::<SDKAggSelector>::default(),
Box::new(metric_temporality_to_selector(opts.metric_temporality)),
)?;
let reader = PeriodicReader::builder(exporter, runtime::Tokio)
.with_interval(opts.metric_periodicity)
.build();
Expand Down
10 changes: 6 additions & 4 deletions core/src/telemetry/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ pub use metrics::{

pub use log_export::{CoreLogBuffer, CoreLogBufferedConsumer, CoreLogStreamConsumer};

use crate::telemetry::log_export::CoreLogConsumerLayer;
use crate::telemetry::metrics::PrefixedMetricsMeter;
use crate::telemetry::{log_export::CoreLogConsumerLayer, metrics::PrefixedMetricsMeter};
use itertools::Itertools;
use once_cell::sync::OnceCell;
use opentelemetry::{sdk::Resource, KeyValue};
use opentelemetry_sdk::metrics::{data::Temporality, reader::TemporalitySelector, InstrumentKind};
use opentelemetry::KeyValue;
use opentelemetry_sdk::{
metrics::{data::Temporality, reader::TemporalitySelector, InstrumentKind},
Resource,
};
use parking_lot::Mutex;
use std::{
cell::RefCell,
Expand Down

0 comments on commit a1351da

Please sign in to comment.