Skip to content

Commit

Permalink
Merge pull request dora-rs#461 from dora-rs/fix-meter-conflict
Browse files Browse the repository at this point in the history
Fix meter conflict
  • Loading branch information
haixuanTao authored Apr 8, 2024
2 parents 7764ae7 + bf82a97 commit 9508fbb
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 45 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.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ Feel free to reach out if you have any questions!
Quickest way:

```bash
cargo install dora-cli
pip install dora-rs ## For Python API
cargo install dora-cli # In case of issues, you can try to add `--locked`
pip install dora-rs # For Python API

dora --help
```
Expand Down
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 9508fbb

Please sign in to comment.