Fix transaction name in Starlette and FastAPI#2341
Merged
antonpirker merged 29 commits intoSep 6, 2023
Merged
Conversation
…up-asgi-starlette
antonpirker
marked this pull request as ready for review
September 4, 2023 10:43
antonpirker
deleted the
antonpirker/fix-transaction-name-in-starlette-and-fastapi
branch
September 6, 2023 07:55
sentrivana
pushed a commit
that referenced
this pull request
Sep 18, 2023
Set the url as a transaction name instead of 'generic ASGI request' in the beginning, so traces_sampler has something to work with that is more meaningful than 'generic ASGI request'. Closes #2262 Closes #2263 New Behaviour: Note: transaction names can be two styles, "url" or "endpoint". (set by the transaction_style parameter of the Integrations) Note 2: See also @pytest.mark.parametrize decorator in the new tests as reference. vanilla ASGI: set URL instead of always "generic ASGI request" Starlette: normal request: transaction name is function name or route (depending on transaction_style setting) traces_sampler: always receives the raw URL as the transaction name (no matter the transaction_style setting. because we do not know more at the time the traces_sampler is called.) requests that end in a middleware (like 404, CORS): the functions name or the raw URL (depending on transaction_style setting) FastAPI normal request: transaction name is function name or route (depending on transaction_style setting) traces_sampler: always receives the raw URL as the transaction name (no matter the transaction_style setting. because we do not know more at the time the traces_sampler is called.) requests that end in a middleware (like 404, CORS): the functions name or the raw URL (depending on transaction_style setting) There used to be "generic ASGI request" transactions being created at the server startup (when a "lifespan" ASGI message was received.) Those transactions are not created anymore. (we can think of creating propper "Server was started/stopped" transactions in the future)
This file contains hidden or 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
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.
Set the url as a transaction name instead of 'generic ASGI request' in the beginning, so traces_sampler has something to work with that is more meaningful than 'generic ASGI request'.
Closes #2262
Closes #2263
New Behaviour:
Note: transaction names can be two styles, "url" or "endpoint". (set by the
transaction_styleparameter of the Integrations)Note 2: See also
@pytest.mark.parametrizedecorator in the new tests as reference.transaction_stylesetting)traces_sampler: always receives the raw URL as the transaction name (no matter thetransaction_stylesetting. because we do not know more at the time the traces_sampler is called.)transaction_stylesetting)transaction_stylesetting)traces_sampler: always receives the raw URL as the transaction name (no matter thetransaction_stylesetting. because we do not know more at the time the traces_sampler is called.)transaction_stylesetting)