Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"mongodb-core" module instrumentation is missing "destination" context #1897

Closed
trentm opened this issue Nov 26, 2020 · 0 comments · Fixed by #2882
Closed

"mongodb-core" module instrumentation is missing "destination" context #1897

trentm opened this issue Nov 26, 2020 · 0 comments · Fixed by #2882
Labels
agent-nodejs Make available for APM Agents project planning.

Comments

@trentm
Copy link
Member

trentm commented Nov 26, 2020

Similar to #1892 the instrumentation for mongodb-core is missing "destination" context.

@github-actions github-actions bot added the agent-nodejs Make available for APM Agents project planning. label Nov 26, 2020
@trentm trentm closed this as completed in 6826d9b Sep 14, 2022
PeterEinberger pushed a commit to fpm-git/apm-agent-nodejs that referenced this issue Aug 20, 2024
This adds the new `span.context.service.target.{type,name}` fields for
improved granularity on backend services data in exit spans. This data is
used for "Service Maps" and "Dependencies" in the Kibana APM app.

All instrumentations have been updated to set appropriate service target
values.  `service.target.*` is typically inferred automatically from other
span data, so much of the instrumentation work was in adding other span
fields, most commonly `span.context.db.instance`. The one current exception
to the general inference algorithm is S3 spans, for which the spec'd
`service.target.name` doesn't follow the general pattern.

A new, public `span.setServiceTarget(type, name)` API has been added (this is
a "SHOULD" in the spec).

The new fields will replace the (now deprecated)
`span.context.destination.service.*` fields. In the current stage of
transition:

- `destination.service.{type,name}` are set to the empty string. They are no
  longer used, but the intake API v2 schema up to 7.13 require them to be
  set.
- Setting `destination.service.resource` directly is discouraged. Typically
  it is inferred from `service.target.*` values when a span is ended. Again
  the one exception is S3 spans.

The not-public-but-available-because-JavaScript `span.setDestinationContext`
has been deprecated (using it will `process.emitWarning()`) and replaced with
an internal `span._setDestinationContext()`.

As part of this change, improvements have been made to some module
instrumentations:

- `redis` and `ioredis`: `span.type` has changed from "cache" to "db" per
  spec (https://github.com/elastic/apm/blob/main/specs/agents/tracing-instrumentation-db.md#redis)
- `mongodb`: `span.action` used to be "query", now it will be the mongodb
  command name, e.g. "find", "insert".
- `mongodb` and `mongodb-core`: `span.db.instance` is now set to the database
  name (elastic#1494)
- `mysql` and `mysql2`: `span.db.{instance,user}` are now populated.
- `@elastic/elasticsearch`: The cluster name is heuristically determined for
  Elastic Cloud deployments and used for `db.instance`.
- `sqs`: `span.destination.{address,port}` are now populated.
- `pg`: `span.db.{instance,user}` are now populated.
- `cassandra-driver`: the Cassandra keyspace is captured for service target
  data, if available.
- OpenTelemetry Bridge: OTel spans with kind PRODUCER and CLIENT are now
  handled as exit spans (e.g. span compression could apply).

Closes: elastic#2621
Closes: elastic#2822
Closes: elastic#1494
Closes: elastic#1897
Closes: elastic#2103
Obsoletes: elastic#2458
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
agent-nodejs Make available for APM Agents project planning.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant