Skip to content

Conversation

@TBeeren
Copy link
Contributor

@TBeeren TBeeren commented Dec 15, 2025

Before submitting a pull request, please take a look at our
Contributing guidelines and verify:

  • If you've added code that should be tested, please add tests.
  • Ensure your code lints and the test suite passes (yarn lint) & (yarn test).

Closes: #18499

@andreiborza andreiborza changed the title feat(browser) Added persisted ops integration in graphqlClient javasc… feat(browser) Added persisted ops integration in graphqlClient javascript Dec 15, 2025
@andreiborza andreiborza changed the title feat(browser) Added persisted ops integration in graphqlClient javascript feat(browser): Added persisted ops integration in graphqlClient javascript Dec 15, 2025
The isPersistedRequest type guard now validates that sha256Hash and version
properties exist in the persistedQuery object, preventing undefined values
from being set as span attributes and breadcrumb data.

Added tests for edge cases:
- Empty persistedQuery object
- Missing sha256Hash property
- Missing version property

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Comment on lines 95 to 96
span.setAttribute('graphql.persistedQuery.sha256Hash', graphqlBody.extensions.persistedQuery.sha256Hash);
span.setAttribute('graphql.persistedQuery.version', graphqlBody.extensions.persistedQuery.version);
Copy link
Member

Choose a reason for hiding this comment

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

h: OpenTelemetry semantic convention are snake_case, I think we should go with graphql.persisted_query.hash.sha256 and graphql.persisted_query.version to be more in line with semconvs.

Comment on lines 131 to 132
data['graphql.persistedQuery.sha256Hash'] = graphqlBody.extensions.persistedQuery.sha256Hash;
data['graphql.persistedQuery.version'] = graphqlBody.extensions.persistedQuery.version;
Copy link
Member

Choose a reason for hiding this comment

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

h: Same here, let's get snake_case going and prefix the hash

Copy link
Member

@andreiborza andreiborza left a comment

Choose a reason for hiding this comment

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

This looks good to me, I'll take over making the suggested changes and fixing the tests.

Thanks for the contribution!

@TBeeren
Copy link
Contributor Author

TBeeren commented Dec 15, 2025

Awesome, thanks a lot for the collaboration and velocity! You're quick haha. This helps a ton, so thanks for looking into this.
@andreiborza

@andreiborza andreiborza changed the title feat(browser): Added persisted ops integration in graphqlClient javascript feat(browser): Add support for GraphQL persisted operations Dec 15, 2025
@andreiborza andreiborza force-pushed the feat/graphql-persisted-operations branch from e319da1 to e5e38fa Compare December 15, 2025 14:32
Comment on lines 249 to 253
const requestBody = JSON.parse(payload);

if (isStandardRequest(requestBody)) {
return requestBody;
}

This comment was marked as outdated.

Copy link
Member

@andreiborza andreiborza left a comment

Choose a reason for hiding this comment

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

Thanks again for the contribution!

@andreiborza andreiborza merged commit d1b86bd into getsentry:develop Dec 15, 2025
143 checks passed
onurtemizkan pushed a commit that referenced this pull request Dec 15, 2025
Closes: #18499

---------

Co-authored-by: tbeeren <tbeeren@bol.com>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-authored-by: Andrei Borza <andrei.borza@sentry.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support Persisted Operations on the JavaScript GraphqlClientIntegration SDK

2 participants