Class: NewRelic::Agent::OpenTelemetry::HttpClientTranslator
- Inherits:
-
BaseTranslator
- Object
- BaseTranslator
- NewRelic::Agent::OpenTelemetry::HttpClientTranslator
show all
- Defined in:
- lib/new_relic/agent/opentelemetry/translators/http_client_translator.rb
Constant Summary
AttributeMappings::DATASTORE_MAPPINGS, AttributeMappings::DEFAULT_DESTINATIONS, AttributeMappings::HTTP_CLIENT_MAPPINGS, AttributeMappings::HTTP_SERVER_MAPPINGS
Class Method Summary
collapse
translate
Class Method Details
.add_specialized_attributes(result: {}, name: nil, attributes: nil, instrumentation_scope: nil) ⇒ Object
16
17
18
19
20
21
|
# File 'lib/new_relic/agent/opentelemetry/translators/http_client_translator.rb', line 16
def add_specialized_attributes(result: {}, name: nil, attributes: nil, instrumentation_scope: nil)
uri = build_uri(attributes)
result[:for_segment_api][:uri] = uri if uri
result
end
|
.build_uri(attributes) ⇒ Object
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/new_relic/agent/opentelemetry/translators/http_client_translator.rb', line 23
def build_uri(attributes)
scheme = attributes['url.scheme'] || attributes['http.scheme']
host = attributes['server.address'] || attributes['net.peer.name']
port = attributes['server.port'] || attributes['net.peer.port']
path = attributes['url.path'] || attributes['http.target'] || NewRelic::SLASH
if [scheme, host, port, path].any?(&:nil?)
attributes['url.full'] || attributes['http.url']
else
"#{scheme}://#{host}:#{port}#{path}"
end
end
|