Skip to content

Commit

Permalink
Update opentelemtry dependencies for version bump
Browse files Browse the repository at this point in the history
  • Loading branch information
nick-mobilecoin committed Nov 7, 2023
1 parent deaa135 commit 816f079
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 47 deletions.
60 changes: 18 additions & 42 deletions Cargo.lock

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

3 changes: 2 additions & 1 deletion util/telemetry/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ cfg-if = "1.0"
displaydoc = "0.2"
hostname = "0.3.1"
opentelemetry = "0.21.0"
opentelemetry-jaeger = { version = "0.19.0", features = ["reqwest_rustls_collector_client"], optional = true }
opentelemetry-jaeger = { version = "0.20.0", features = ["reqwest_rustls_collector_client"], optional = true }
opentelemetry_sdk = "0.21.0"
9 changes: 5 additions & 4 deletions util/telemetry/src/jaeger.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use displaydoc::Display;
use opentelemetry::{sdk, trace::TraceError, KeyValue};
use opentelemetry::{trace::TraceError, KeyValue};
use opentelemetry_sdk::{trace, Resource};

#[derive(Debug, Display)]
pub enum Error {
Expand All @@ -15,7 +16,7 @@ pub enum Error {

/// Set up a default tracer with no additional tags.
/// Telemetry is enabled iff env.MC_TELEMETRY is set to "1" or "true".
pub fn setup_default_tracer(service_name: &str) -> Result<Option<sdk::trace::Tracer>, Error> {
pub fn setup_default_tracer(service_name: &str) -> Result<Option<trace::Tracer>, Error> {
setup_default_tracer_with_tags(service_name, &[])
}

Expand All @@ -24,7 +25,7 @@ pub fn setup_default_tracer(service_name: &str) -> Result<Option<sdk::trace::Tra
pub fn setup_default_tracer_with_tags(
service_name: &str,
extra_tags: &[(&'static str, String)],
) -> Result<Option<sdk::trace::Tracer>, Error> {
) -> Result<Option<trace::Tracer>, Error> {
let telemetry_enabled = std::env::var("MC_TELEMETRY")
.map(|val| val == "1" || val.to_lowercase() == "true")
.unwrap_or(false);
Expand All @@ -47,7 +48,7 @@ pub fn setup_default_tracer_with_tags(

opentelemetry_jaeger::new_agent_pipeline()
.with_service_name(service_name)
.with_trace_config(sdk::trace::Config::default().with_resource(sdk::Resource::new(tags)))
.with_trace_config(trace::Config::default().with_resource(Resource::new(tags)))
.install_simple()
.map_err(Error::Trace)
.map(Some)
Expand Down

0 comments on commit 816f079

Please sign in to comment.