Skip to content

Commit

Permalink
Update spies to use new service.target.name/type
Browse files Browse the repository at this point in the history
  • Loading branch information
Justin George committed Jul 19, 2022
1 parent cd0df69 commit 9aaaafb
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 9 deletions.
5 changes: 2 additions & 3 deletions lib/elastic_apm/spies/azure_storage_table.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@ def instrument(operation_name, table_name = nil, service:)
action = formatted_op_name(operation_name)
account_name = account_name_from_storage_table_host(service.storage_service_host[:primary])

destination = ElasticAPM::Span::Context::Destination.from_uri(service.storage_service_host[:primary])
destination.service.resource = "#{SUBTYPE}/#{account_name}"
resource = "#{SUBTYPE}/#{account_name}"

context = ElasticAPM::Span::Context.new(destination: destination)
context = ElasticAPM::Span::Context.new(destination: {service: {resource: resource}}, service: {target: {name: account_name, type: SUBTYPE}})

ElasticAPM.with_span(span_name, TYPE, subtype: SUBTYPE, action: action, context: context) do
ElasticAPM::Spies.without_faraday do
Expand Down
8 changes: 6 additions & 2 deletions lib/elastic_apm/spies/dynamo_db.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,14 @@ def self.prepended(mod)
address: config.endpoint.host,
port: config.endpoint.port,
service: {
name: SUBTYPE,
type: TYPE,
resource: SUBTYPE },
cloud: { region: config.region }
},
service: {
target: {
name: config.region,
type: SUBTYPE
}
}
)

Expand Down
6 changes: 5 additions & 1 deletion lib/elastic_apm/spies/elasticsearch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,12 @@ def perform_request(method, path, *args, &block)
db: { statement: statement.reduce({}, :merge).to_json },
destination: {
service: {
name: SUBTYPE,
resource: SUBTYPE,
}
},
service: {
target: {
name: SUBTYPE,
type: TYPE
}
}
Expand Down
10 changes: 7 additions & 3 deletions lib/elastic_apm/spies/mongo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,15 @@ def build_context(event)
type: 'mongodb',
user: nil
},
service: {
target: {
name: event.database_name,
type: SUBTYPE
}
},
destination: {
service: {
name: SUBTYPE,
resource: SUBTYPE,
type: TYPE
resource: SUBTYPE
}
}
)
Expand Down

0 comments on commit 9aaaafb

Please sign in to comment.