Skip to content

Support Persisted Operations on the JavaScript GraphqlClientIntegration SDK #18499

Description

@TBeeren

Problem Statement

Problem

The graphqlClientIntegration currently only extracts operation information from the query field in GraphQL requests. This means persisted operations aren't tracked - a common production optimization where clients send only operationName and a hash instead of the full query string.

Current behavior:
✅ Request with query: Creates span with operation name
❌ Request with persisted operation (no query field): No span created or missing operation details
Example persisted operation request:

{
  "operationName": "GetUser",
  "variables": { "id": "123" },
  "extensions": {
    "persistedQuery": {
      "version": 1,
      "sha256Hash": "abc123..."
    }
  }
}

Use Case

We're using this in production at a large e-commerce platform with 100+ frontend developers. Persisted operations reduce payload size and improve security. This change gives us both benefits.

Solution Brainstorm

Solution

  1. Detect persisted operations: Check for operationName when query is missing
  2. Create descriptive span names: Use "persisted {operationName}" format
  3. Add operation attribute: Store operation name without the full query body
  4. Maintain backward compatibility: Normal query-based requests work exactly as before

Changes:

  • Extract operation name from request body when query field is absent
  • Add span attribute for operation name on persisted queries
  • Update span description to indicate persisted operations

Additional Context

No response

Priority

React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions