Skip to content

Commit

Permalink
Merge branch 'main' into set_instrumentation_scope
Browse files Browse the repository at this point in the history
  • Loading branch information
lalitb committed Jun 13, 2024
2 parents 60bd794 + 66e3ea5 commit 804d79e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ tokio-stream = "0.1.1"
tracing = { version = "0.1", default-features = false }
tracing-core = { version = "0.1", default-features = false }
tracing-subscriber = { version = "0.3", default-features = false }
url = { version = "2.2", default-features = false }
url = { version = "=2.5.0", default-features = false } #pinning the version supporting rustc 1.65
9 changes: 3 additions & 6 deletions opentelemetry-otlp/examples/basic-otlp-http/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,15 @@ fn init_tracer_provider() -> Result<sdktrace::TracerProvider, TraceError> {
}

fn init_metrics() -> Result<opentelemetry_sdk::metrics::SdkMeterProvider, MetricsError> {
let provider = opentelemetry_otlp::new_pipeline()
opentelemetry_otlp::new_pipeline()
.metrics(opentelemetry_sdk::runtime::Tokio)
.with_exporter(
opentelemetry_otlp::new_exporter()
.http()
.with_endpoint("http://localhost:4318/v1/metrics"),
)
.with_resource(RESOURCE.clone())
.build();
match provider {
Ok(provider) => Ok(provider),
Err(err) => Err(err),
}
.build()
}

#[tokio::main]
Expand All @@ -85,6 +81,7 @@ async fn main() -> Result<(), Box<dyn Error + Send + Sync + 'static>> {
);

let meter_provider = result.unwrap();
global::set_meter_provider(meter_provider.clone());

// Opentelemetry will not provide a global API to manage the logger
// provider. Application users must manage the lifecycle of the logger
Expand Down

0 comments on commit 804d79e

Please sign in to comment.