gateway: add operation_name field for task polling #1590
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of change
Each new project task gets created in the context of a parent span. With open telemetry, this boils down to spans linked through context propagation, which can be easily visualized with Datadog in APM Traces. What is difficult though is to filter spans based on the relationship between them (which should get easier after the GA of [1], thanks @Kazy for pointing me to the article), so that only a certain selection of spans can be returned and counted for certain metrics.
In my specific case, I want to filter for all spans created by the
poll
function of aProjectTask
that has an attribute calledctx.operation_name
. This attribute is attached to the span only in case the result of thepoll
function isTaskResult::Done(_)
. This is relevant becauseProjectTask
s are created and driven in the background as a result of gateway APIs handlers, the ambulance, andfind_or_start_project
. For now, the only difference I am interested in is determining the number of spans that have thectx.operation_name
attribute equal tocreate_project
. In this way, Datadog will also be able to count allProjectTasks
that end with aTaskResult::Done(_)
and that is started by an operation calledcreate_project
.How has this been tested? (if applicable)
Tested with Jaeger, and the field shows up.