Setting transaction name doesn't work from child span.
See original GitHub issueEnvironment
How do you use Sentry? Sentry SaaS (sentry.io)
Which SDK and version? Python/Django: django-sentry-1.13.5, sentry-sdk-1.3.0 (also tried sentry-sdk-1.1.0)
Steps to Reproduce
We’re using Sentry in Django and Graphene (for GraphQL support). We would like to set the transaction name based on GraphQL operation name.
urlpatterns = [
# ...snip
path(
'graphql',
csrf_exempt(MyGraphQLView.as_view(graphiql=settings.GRAPHIQL_ENABLED)),
),
]
class MyGraphQLView(graphene_django.views.GraphQLView):
def execute_graphql_request(
self, request, data, query, variables, operation_name, show_graphiql=False
):
with sentry_sdk.configure_scope() as scope:
transaction_name = f'graphql.{operation_name}' # graphql.OperationName
scope.transaction = transaction_name
# This works:
scope._span._containing_transaction.name = transaction_name
return super().execute_graphql_request(
request, data, query, variables, operation_name, show_graphiql
)
From the trace view in Sentry, the GraphQLView span is nested several spans down (in Django middlewares). From my understanding of the sentry documentation: set transaction name It seems like the scope.transaction = 'name'
setter should be enough, but doesn’t seem to work from child spans.
Expected Result
Sentry transaction name updated to graphql.OperationName
.
Actual Result
Sentry transaction name stays as /graphql
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Span records missing transaction.name
I believe the issue is that not all Span records have their transaction.name attribute set. As an example,. There is one Transaction record...
Read more >Some spans are missing in a transaction and span parent ...
Some spans are missing in a transaction and span parent child relationship (Child span starting position) is incorrect in APM Timeline. #1088.
Read more >HTTP spans doesn't show the full information about the request
Hi! I'm using Opentelemetry + Elastic. The problem that I'm facing is that the http requests child spans doesn't show the full information....
Read more >Guidelines for Performance Monitoring
The Span class stores each individual span in a trace. The Transaction class is like a span, with a few key differences: Transactions...
Read more >Using Transactions in Quarkus
You don't need to worry about setting it up most of the time as ... child, String giftDescription) { // some transaction work...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m in the middle of some tasks and I can’t check right now, but will hopefully be able to later in the week.
Hi, @CoatedMoose. While you’re not wrong in your expectation, given the docs, making
scope.transaction = new_name
work means you’re relying on the weird type mismatch between thetransaction
getter and setter. Much better to doscope.transaction.name
, both because it makes more sense and because it future-proofs you for the day when we finally fix that mismatch.I’ll fix the docs to reflect this.