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

Set metadata from :router_dispatch stop events #99

Merged
merged 5 commits into from
Aug 22, 2024

Conversation

jeffkreeftmeijer
Copy link
Member

@jeffkreeftmeijer jeffkreeftmeijer commented Aug 21, 2024

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

@jeffkreeftmeijer jeffkreeftmeijer added the bug Something isn't working label Aug 21, 2024
@jeffkreeftmeijer jeffkreeftmeijer self-assigned this Aug 21, 2024
@backlog-helper
Copy link

backlog-helper bot commented Aug 21, 2024

✔️ All good!

New issue guide | Backlog management | Rules | Feedback

@jeffkreeftmeijer jeffkreeftmeijer force-pushed the endpoint-events branch 2 times, most recently from dbc1487 to c368311 Compare August 21, 2024 07:38
@jeffkreeftmeijer jeffkreeftmeijer force-pushed the endpoint-events branch 2 times, most recently from 7c7ac07 to 267c6c3 Compare August 21, 2024 08:00
Some Phoenix apps appear not to fire the :endpoint events, which
causes the span to remain without any metadata. This patch makes sure
the metadata is set by also setting it from the :router_dispatch stop
event.
Because we're now setting span data in router dispatch stop events,
don't also set them in endpoint stop events. This reverts to the
situation before 2.4.0, where data was always set through the router
dispatch events because we didn't track endpoint events at all.
Set request metadata in :router_dispatch events to support Phoenix
apps that don't fire :endpoint events.
@jeffkreeftmeijer jeffkreeftmeijer merged commit 53ffd75 into main Aug 22, 2024
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants