-
Notifications
You must be signed in to change notification settings - Fork 227
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
feat: exit spans, infer destination.service.resource #2458
Conversation
This adds the explicit concept of "exit spans" -- spans the represent an outgoing call to a downstream service. An exit span doesn't have child spans. (Technically it can have spans of the same type+subtype, but this agent doesn't have any cases of that.) An exit span is explicitly marked at creation time by setting the `exitSpan` option to true. https://github.com/elastic/apm/blob/master/specs/agents/tracing-spans.md#exit-spans For exit spans the 'span.context.destination.service.resource' is automatically inferred from other context. This can be overriden with the new `span.setDestinationService(resource)`. https://github.com/elastic/apm/blob/master/specs/agents/tracing-spans-destination.md Fixes: #2103
💔 Build Failed
Expand to view the summary
Build stats
Test stats 🧪
Steps errorsExpand to view the steps failures
|
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
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
This adds the explicit concept of "exit spans" -- spans the represent an
outgoing call to a downstream service. An exit span doesn't have child
spans. (Technically it can have spans of the same type+subtype, but this
agent doesn't have any cases of that.) An exit span is explicitly marked
at creation time by setting the
exitSpan
option to true.https://github.com/elastic/apm/blob/master/specs/agents/tracing-spans.md#exit-spans
For exit spans the 'span.context.destination.service.resource' is
automatically inferred from other context. This can be overriden with
the new
span.setDestinationService(resource)
.https://github.com/elastic/apm/blob/master/specs/agents/tracing-spans-destination.md
Fixes: #2103
Checklist