Skip to content

Commit

Permalink
Update opentelemetry
Browse files Browse the repository at this point in the history
  • Loading branch information
randomairborne committed Dec 1, 2024
1 parent a00f731 commit d8b4811
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 60 deletions.
88 changes: 45 additions & 43 deletions Cargo.lock

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

10 changes: 5 additions & 5 deletions xpd-gateway/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ tokio = { version = "1", features = ["rt-multi-thread", "macros", "signal"] }
tokio-util = { version = "0.7", features = ["rt"] }

# tracing and logging
opentelemetry-otlp = { version = "0.26.0", features = ["reqwest-rustls-webpki-roots", "http-proto"] }
opentelemetry_sdk = { version = "0.26.0", features = ["rt-tokio"] }
opentelemetry-semantic-conventions = "0.26.0"
opentelemetry-appender-tracing = "0.26.0"
opentelemetry-otlp = { version = "0.27.0", features = ["reqwest-rustls-webpki-roots", "http-proto"] }
opentelemetry_sdk = { version = "0.27.0", features = ["rt-tokio"] }
opentelemetry-semantic-conventions = "0.27.0"
opentelemetry-appender-tracing = "0.27.0"
tracing-subscriber = "0.3"
opentelemetry = "0.26.0"
opentelemetry = "0.27.0"
base64 = "0.22"

tracing = "0.1"
Expand Down
24 changes: 12 additions & 12 deletions xpd-gateway/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use base64::{
};
use opentelemetry::KeyValue;
use opentelemetry_appender_tracing::layer::OpenTelemetryTracingBridge;
use opentelemetry_otlp::WithExportConfig;
use opentelemetry_otlp::{LogExporter, WithExportConfig, WithHttpConfig};
use opentelemetry_sdk::{logs::LoggerProvider, Resource};
use sqlx::PgPool;
use tokio_util::{sync::CancellationToken, task::TaskTracker};
Expand Down Expand Up @@ -317,19 +317,19 @@ fn make_otlp(endpoint: &str) -> LoggerProvider {

let headers = make_otlp_headers();

let exporter = LogExporter::builder()
.with_http()
.with_endpoint(endpoint)
.with_headers(headers)
.with_http_client(reqwest::Client::new())
.build()
.unwrap();

// Create a new OpenTelemetry trace pipeline that prints to stdout
opentelemetry_otlp::new_pipeline()
.logging()
LoggerProvider::builder()
.with_resource(svc_name.clone())
.with_exporter(
opentelemetry_otlp::new_exporter()
.http()
.with_endpoint(endpoint)
.with_headers(headers)
.with_http_client(reqwest::Client::new()),
)
.install_batch(opentelemetry_sdk::runtime::Tokio)
.unwrap()
.with_batch_exporter(exporter, opentelemetry_sdk::runtime::Tokio)
.build()
}

fn make_otlp_headers() -> HashMap<String, String> {
Expand Down

0 comments on commit d8b4811

Please sign in to comment.