-
Notifications
You must be signed in to change notification settings - Fork 369
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
Move Rails span resource setting to beginning of request #1626
Merged
ivoanjo
merged 1 commit into
master
from
ivoanjo/rails-set-resource-at-beginning-of-request
Aug 4, 2021
Merged
Move Rails span resource setting to beginning of request #1626
ivoanjo
merged 1 commit into
master
from
ivoanjo/rails-set-resource-at-beginning-of-request
Aug 4, 2021
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
As of #1623, the profiler records the `resource` of the root span, on top of the span id and trace id during sampling. Also, as discusssed in the description of #1623 (in the "Getting the correct `resource`" section) integrations where the `resource` is only set at the end pose an extra challenge, as the request may not be finished in time for the `resource` to be included in the profiler payload. This means that the profiler may miss the `resource` for some of the requests, depending on timing of when the sampling happens and when the request finishes. (Note that in this case, the trace id and span id will still be propagated, so the samples will always be able to be tied back to the trace that originated them; it's just the `resource` that will not be included in the profiler data). To avoid this issue for many of our customers, let's move the Rails `resource` setting to the beginning of the request, thus avoiding the issue altogether for the Rails (action_pack/action_controller) integration.
ivoanjo
added a commit
that referenced
this pull request
Aug 3, 2021
As of #1623, the profiler records the `resource` of the root span, on top of the span id and trace id during sampling. Also, as discusssed in the description of #1623 (in the "Getting the correct `resource`" section) integrations where the `resource` is only set at the end pose an extra challenge, as the request may not be finished in time for the `resource` to be included in the profiler payload. This means that the profiler may miss the `resource` for some of the requests, depending on timing of when the sampling happens and when the request finishes. (Note that in this case, the trace id and span id will still be propagated, so the samples will always be able to be tied back to the trace that originated them; it's just the `resource` that will not be included in the profiler data). To avoid this issue for many of our customers, let's set the Sinatra `resource` setting to the beginning of the request, thus avoiding the issue altogether for Sinatra. Note that I did not touch the existing code to set the resource at the end, which had a quite scary TODO (lines 47-64) and seemed like something I shouldn't touch. Note 2: This is similar to what we did in #1626 for the Rails integration.
marcotc
approved these changes
Aug 3, 2021
ivoanjo
added a commit
that referenced
this pull request
Aug 4, 2021
As of #1623, the profiler records the `resource` of the root span, on top of the span id and trace id during sampling. Also, as discusssed in the description of #1623 (in the "Getting the correct `resource`" section) integrations where the `resource` is only set at the end pose an extra challenge, as the request may not be finished in time for the `resource` to be included in the profiler payload. This means that the profiler may miss the `resource` for some of the requests, depending on timing of when the sampling happens and when the request finishes. (Note that in this case, the trace id and span id will still be propagated, so the samples will always be able to be tied back to the trace that originated them; it's just the `resource` that will not be included in the profiler data). To avoid this issue for many of our customers, let's move the Grape `resource` setting to the beginning of the request, thus avoiding the issue altogether for this integration. (Note: This is similar to what we did for Rails in #1626 and Sinatra in #1628)
ivoanjo
added a commit
that referenced
this pull request
Aug 4, 2021
As of #1623, the profiler records the `resource` of the root span, on top of the span id and trace id during sampling. Also, as discusssed in the description of #1623 (in the "Getting the correct `resource`" section) integrations where the `resource` is only set at the end pose an extra challenge, as the request may not be finished in time for the `resource` to be included in the profiler payload. This means that the profiler may miss the `resource` for some of the requests, depending on timing of when the sampling happens and when the request finishes. (Note that in this case, the trace id and span id will still be propagated, so the samples will always be able to be tied back to the trace that originated them; it's just the `resource` that will not be included in the profiler data). To avoid this issue for many of our customers, let's move the Grape `resource` setting to the beginning of the request, thus avoiding the issue altogether for this integration. (Note: This is similar to what we did for Rails in #1626 and Sinatra in #1628)
This was referenced Aug 4, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
As of #1623, the profiler records the
resource
of the root span, on top of the span id and trace id during sampling.Also, as discusssed in the description of #1623 (in the "Getting the correct
resource
" section) integrations where theresource
is only set at the end pose an extra challenge, as the request may not be finished in time for theresource
to be included in the profiler payload.This means that the profiler may miss the
resource
for some of the requests, depending on timing of when the sampling happens and when the request finishes.(Note that in this case, the trace id and span id will still be propagated, so the samples will always be able to be tied back to the trace that originated them; it's just the
resource
that will not be included in the profiler data).To avoid this issue for many of our customers, let's move the Rails
resource
setting to the beginning of the request, thus avoiding the issue altogether for the Rails (action_pack/action_controller) integration.