Name relay service for otel

This commit is contained in:
Aode (lion) 2021-09-18 13:55:11 -05:00
parent 5e24bb06a7
commit 82371d4a65

View file

@ -1,4 +1,5 @@
use actix_web::{web, App, HttpServer};
use opentelemetry::{sdk::Resource, KeyValue};
use opentelemetry_otlp::WithExportConfig;
use tracing_actix_web::TracingLogger;
use tracing_error::ErrorLayer;
@ -46,8 +47,12 @@ async fn main() -> Result<(), anyhow::Error> {
.with(format_layer);
if let Some(url) = config.opentelemetry_url() {
let tracer = opentelemetry_otlp::new_pipeline()
let tracer =
opentelemetry_otlp::new_pipeline()
.tracing()
.with_trace_config(opentelemetry::sdk::trace::config().with_resource(
Resource::new(vec![KeyValue::new("service.name", config.software_name())]),
))
.with_exporter(
opentelemetry_otlp::new_exporter()
.tonic()