Class: NewRelic::Agent::OpenTelemetry::DatastoreTranslator
- Inherits:
-
BaseTranslator
- Object
- BaseTranslator
- NewRelic::Agent::OpenTelemetry::DatastoreTranslator
show all
- Defined in:
- lib/new_relic/agent/opentelemetry/translators/datastore_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/datastore_translator.rb', line 16
def add_specialized_attributes(result: {}, name: nil, attributes: nil, instrumentation_scope: nil)
operation = parse_operation(name, attributes)
result[:for_segment_api][:operation] = operation if operation
result
end
|
.parse_operation(name, attributes) ⇒ Object
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/new_relic/agent/opentelemetry/translators/datastore_translator.rb', line 23
def parse_operation(name, attributes)
operation = attributes['db.operation.name'] || attributes['db.operation']
return operation if operation
name_downcased = name&.downcase
return name_downcased if NewRelic::Agent::Database::KNOWN_OPERATIONS.include?(name_downcased)
sql = attributes['db.query.text'] || attributes['db.statement']
NewRelic::Agent::Database.parse_operation_from_query(sql) if sql
end
|