Allow to customise the OTEL service name prefix (#30322)

pull/30325/head
Renaud Chaput 2024-05-16 11:28:10 +02:00 committed by GitHub
parent 65e82211cd
commit 283a891e92
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 2 deletions

View File

@ -53,10 +53,12 @@ if ENV.keys.any? { |name| name.match?(/OTEL_.*_ENDPOINT/) }
},
})
prefix = ENV.fetch('OTEL_SERVICE_NAME_PREFIX', 'mastodon')
c.service_name = case $PROGRAM_NAME
when /puma/ then 'mastodon/web'
when /puma/ then "#{prefix}/web"
else
"mastodon/#{$PROGRAM_NAME.split('/').last}"
"#{prefix}/#{$PROGRAM_NAME.split('/').last}"
end
c.service_version = Mastodon::Version.to_s
end