Skip to content

Commit

Permalink
Fix conflict in meter name
Browse files Browse the repository at this point in the history
  • Loading branch information
haixuanTao committed Apr 8, 2024
1 parent 2dc33e8 commit ea6d63a
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 43 deletions.
89 changes: 53 additions & 36 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions libraries/extensions/telemetry/metrics/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ license.workspace = true
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
opentelemetry = { version = "0.21", features = ["metrics"] }
opentelemetry-otlp = { version = "0.14.0", features = ["tonic", "metrics"] }
opentelemetry_sdk = { version = "0.21", features = ["rt-tokio", "metrics"] }
opentelemetry = { version = "0.22.0", features = ["metrics"] }
opentelemetry-otlp = { version = "0.15.0", features = ["tonic", "metrics"] }
opentelemetry_sdk = { version = "0.22.0", features = ["rt-tokio", "metrics"] }
eyre = "0.6.12"
opentelemetry-system-metrics = { version = "0.1.6" }
opentelemetry-system-metrics = { version = "0.1.8" }
6 changes: 3 additions & 3 deletions libraries/extensions/telemetry/metrics/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ use std::time::Duration;
use eyre::{Context, Result};
use opentelemetry::metrics::{self, MeterProvider as _};
use opentelemetry_otlp::{ExportConfig, WithExportConfig};
use opentelemetry_sdk::{metrics::MeterProvider, runtime};
use opentelemetry_sdk::{metrics::SdkMeterProvider, runtime};
use opentelemetry_system_metrics::init_process_observer;
/// Init opentelemetry meter
///
/// Use the default Opentelemetry exporter with default config
/// TODO: Make Opentelemetry configurable
///
pub fn init_metrics() -> metrics::Result<MeterProvider> {
pub fn init_metrics() -> metrics::Result<SdkMeterProvider> {
let endpoint = std::env::var("OTEL_EXPORTER_OTLP_METRICS_ENDPOINT")
.unwrap_or_else(|_| "http://localhost:4317".to_string());
let export_config = ExportConfig {
Expand All @@ -41,7 +41,7 @@ pub fn init_metrics() -> metrics::Result<MeterProvider> {
.build()
}

pub fn init_meter_provider(meter_id: String) -> Result<MeterProvider> {
pub fn init_meter_provider(meter_id: String) -> Result<SdkMeterProvider> {
let meter_provider = init_metrics().context("Could not create opentelemetry meter")?;
let meter = meter_provider.meter(meter_id);
let _ = init_process_observer(meter).context("could not initiale system metrics observer")?;
Expand Down

0 comments on commit ea6d63a

Please sign in to comment.