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

[META 659] Backend dependencies granularity for NoSQL and Messaging #2822

Closed
elastic-apm-tech opened this issue Jul 13, 2022 · 0 comments · Fixed by #2882
Closed

[META 659] Backend dependencies granularity for NoSQL and Messaging #2822

elastic-apm-tech opened this issue Jul 13, 2022 · 0 comments · Fixed by #2882
Assignees
Labels
agent-nodejs Make available for APM Agents project planning.
Milestone

Comments

@elastic-apm-tech
Copy link

See meta issue for the description and details:

@github-actions github-actions bot added the agent-nodejs Make available for APM Agents project planning. label Jul 13, 2022
@trentm trentm added this to the 8.5 milestone Jul 28, 2022
@trentm trentm self-assigned this Sep 6, 2022
trentm added a commit that referenced this issue Sep 14, 2022
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 (#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: #2621
Closes: #2822
Closes: #1494
Closes: #1897
Closes: #2103
Obsoletes: #2458
fpm-peter 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.

2 participants