From 11eae691ba91c2e36ce7cbdab18bf5a60a4fb9c8 Mon Sep 17 00:00:00 2001 From: Tim Campbell Date: Mon, 23 Sep 2024 10:55:35 +0200 Subject: [PATCH] Feature more otel customization (#31998) --- config/initializers/opentelemetry.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/config/initializers/opentelemetry.rb b/config/initializers/opentelemetry.rb index d121a95a36..8edce03b90 100644 --- a/config/initializers/opentelemetry.rb +++ b/config/initializers/opentelemetry.rb @@ -56,12 +56,13 @@ if ENV.keys.any? { |name| name.match?(/OTEL_.*_ENDPOINT/) } }, }) - prefix = ENV.fetch('OTEL_SERVICE_NAME_PREFIX', 'mastodon') + prefix = ENV.fetch('OTEL_SERVICE_NAME_PREFIX', 'mastodon') + separator = ENV.fetch('OTEL_SERVICE_NAME_SEPARATOR', '/') c.service_name = case $PROGRAM_NAME - when /puma/ then "#{prefix}/web" + when /puma/ then "#{prefix}#{separator}web" else - "#{prefix}/#{$PROGRAM_NAME.split('/').last}" + "#{prefix}#{separator}#{$PROGRAM_NAME.split('/').last}" end c.service_version = Mastodon::Version.to_s end