Graphql-laravel: Is there any way to tag request in Telescope?

Created on 1 Jul 2020  ·  3Comments  ·  Source: rebing/graphql-laravel

Versions:

  • graphql-laravel Version: ^5.0
  • Laravel Version: 7.0
  • PHP Version: 7.3

Question:

Is there any way to tag request in Telescope?
The telescope provides a feature to assign custom tag any request.
Currently in the telescope dashboard shows all the GraphQL query as /graphql.
It is really hard to debug a particular query.

help wanted question

All 3 comments

I don't use telescope so can't help much 🤷‍♀️

I use this:

Telescope::tag(function (IncomingEntry $entry) {
            if (($entry->type === EntryType::REQUEST) && (null !== ($operationName = request()->input('operationName')))) {
                return ['GraphQL:'.$operationName];
            }
            if (($entry->type === EntryType::REQUEST) && (null !== ($operationName = request()->header('x-apollo-operation-name')))) {
                return ['GraphQL:'.$operationName];
            }
            return [];
        });

Thanks a lot, @illambo For code snippet.
I will try this way 🙂

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AdrianCarreno picture AdrianCarreno  ·  5Comments

edgarsn picture edgarsn  ·  4Comments

Artem-Schander picture Artem-Schander  ·  7Comments

chrispage1 picture chrispage1  ·  4Comments

drmax24 picture drmax24  ·  6Comments