lib/elastic_apm/transport/user_agent.rb in elastic-apm-4.4.0 vs lib/elastic_apm/transport/user_agent.rb in elastic-apm-4.5.0
- old
+ new
@@ -35,15 +35,21 @@
def build(config)
service = Metadata::ServiceInfo.new(config)
[
"elastic-apm-ruby/#{@version}",
- HTTP::Request::USER_AGENT,
- [
- service.runtime.name,
- service.runtime.version
- ].join('/')
- ].join(' ')
+ formatted_service_info(service)
+ ].compact.join(' ')
+ end
+
+ def formatted_service_info(service)
+ if service.name
+ "(#{[
+ service.name,
+ service.version
+ ].compact.join(' ')
+ })"
+ end
end
end
end
end