Set metadata from :router_dispatch stop events #99
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.
Since #90, which was released as 2.4.0, we've started supporting Phoenix's /endpoint/ events, which put us a bit higher in the stack, allowing us to get data from pipeline plugs, for example. It also moved setting root span metadata from an event named
[:phoenix, :router_dispatch, :stop]
to the newly added[:phoenix, :endpoint, :stop]
.We've learned since that some applications don't publish the endpoint events. We're still figuring out in which situations that happens, but we know that the integration works even if we don't have an endpoint event, as it will automatically fall back to using the router dispatch event as the root span. However, since we set the request metadata on the endpoint event (which doesn't fire for some apps), the metadata got omitted resulting in spans without names, which get dropped by the agent.
This patch moves the metadata setting back to the :router_dipatch :stop event, which we know all apps have.
https://app.intercom.com/a/inbox/yzor8gyw/inbox/admin/4356044/conversation/16410700348100?view=List
https://app.intercom.com/a/inbox/yzor8gyw/inbox/conversation/16410700349323#part_id=comment-16410700349323-21909570290