Skip to content

Conversation

marcotc
Copy link
Member

@marcotc marcotc commented Aug 19, 2025

What does this PR do?
This PR adds the span responsible for generating service page metrics to the graphql.execute span, which represents a single GraphQL operation execution.
This allows for toggling the APM service service page between, for example, rack.request and graphql.execute.
The default today is to prioritize graphql.execute as the primary operation, but this wasn't working for Ruby because there were no metrics to populate the the service page with. This PR fixes that.

The service page will look something like this, with GraphQL operations in the Resources tab (instead of POST /graphql):

Screenshot 2025-08-19 at 3 43 21 PM

This PR also a changes in the resource name for the graphql.execute, from just the operation name (simpleQuery) to operation type + operation name (query simpleQuery). This aligns closely with the desired grouping pattern for GraphQL operations, and prevents conflicts when a mutation and query have the same name.
This is a non-breaking change because the graphql.execute span could not be monitored on, since there were no metrics generated for it (we won't be able to change it this easily anymore 🙂).

Change log entry
Yes. * Added: Generate metrics for GraphQL operation execution. * Changed: The graphql.execute span resource now includes the operation type.

@marcotc marcotc self-assigned this Aug 19, 2025
@marcotc marcotc added the integrations Involves tracing integrations label Aug 19, 2025
@marcotc marcotc requested review from a team as code owners August 19, 2025 22:50
Copy link

github-actions bot commented Aug 19, 2025

Thank you for updating Change log entry section 👏

Visited at: 2025-08-19 22:52:31 UTC

@pr-commenter
Copy link

pr-commenter bot commented Aug 19, 2025

Benchmarks

Benchmark execution time: 2025-08-19 23:21:01

Comparing candidate commit b4e1ba9 in PR branch marcotc/graphql-fix-type with baseline commit 2aa94dd in branch master.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 44 metrics, 2 unstable metrics.

Copy link

codecov bot commented Aug 19, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.54%. Comparing base (2aa94dd) to head (b4e1ba9).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4862      +/-   ##
==========================================
- Coverage   97.55%   97.54%   -0.02%     
==========================================
  Files        1507     1507              
  Lines       89763    89770       +7     
  Branches     4753     4755       +2     
==========================================
- Hits        87567    87564       -3     
- Misses       2196     2206      +10     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

lambda { |span|
# Ensure this span can be aggregated by in the Datadog App, and generates RED metrics.
span.set_tag(Tracing::Metadata::Ext::TAG_KIND, Tracing::Metadata::Ext::SpanKind::TAG_SERVER)
span.set_tag('span.kind', 'server')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these two lines doing the same thing?

Copy link
Member

@Strech Strech left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome 👏🏼

P.S still need to eliminate extra tag kind setter

@vpellan
Copy link
Contributor

vpellan commented Sep 2, 2025

LGTM, beside the duplicate tag !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integrations Involves tracing integrations tracing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants