Skip to content

Incorrect operation body shown in Insights #8161

Description

@jetocotoje

Hi, we have set up usage data/insights sending from Hive Router to the Hive Console, but we have encountered issues with the operation body being incorrect.
It seems that when we send a GraphQL document containing more than one operation and select a specific one (non-first) using operationName, it always shows the first query body regardless of what operationName contains.

I tried the same setup with the Hive Gateway, but it seems to be producing the same (invalid) results.

Minimal reproduction:

  1. Create a new project in Console and generate required tokens (1x for registry, 1x for hive telemetry)
  2. Download the official SWAPI schema from https://github.com/graphql/swapi-graphql/blob/master/schema.graphql
  3. Configure supergraph.yaml with
federation_version: =2.3.2
subgraphs:
  swapi:
    routing_url: https://graphql.org/graphql/
    schema:
      file: ./schema.graphql
  1. rover supergraph compose --config ./supergraph.yaml > supergraph.graphql
  2. hive schema:publish --target "..." --registry.accessToken "..." --author "Test" --commit "test" ./supergraph.graphql
  3. Configure Router's router.config.yaml with
supergraph:
  source: file
  path: ./supergraph.graphql
telemetry:
  hive:
    token:  ...
    target: ...
    usage_reporting:
      enabled: true
    tracing:
      enabled: true
  1. Run the Router
    docker run -p 4000:4000 -v ./supergraph.graphql:/app/supergraph.graphql -v ./router.config.yaml:/app/router.config.yaml ghcr.io/graphql-hive/router:latest
  2. Send a query containing at least two operations and select the non-first one in operationName
curl 'http://localhost:4000/graphql' \
        -H 'accept: application/graphql-response+json, application/json, multipart/mixed' \
        -H 'content-type: application/json' \
        --data-raw '{"query":"query first{__typename} query second{allFilms{totalCount}}","operationName":"second"}'
  1. Observe "Insights" in the Console application showing the first operation body in the second operations/traces.

Note that this is not reproducible using the Web IDE bundled with Router as it always only sends the part of the body relevant to the selected operation instead of the whole document.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions