cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to get values/requests from graphql ?

Zimmer
Participant

Hello, 
 I have an issue with I can't get requests which are toward to graphql. It simply shows only https://example.com/graphql   and when you click on the link you can find the request inside like https://example.com/graphql/18293/product

How to clean up the rule in a way to show all requests instead of only graphql?

Thanks. 

Best regards,
Vakho
15 REPLIES 15

gilgi
DynaMight Champion
DynaMight Champion

Hi @Zimmer ,

 

I know your pain.. can you tell which technologies and libraries we use. We have a customer running graphql in java and using the expediagroup library.

We've managed to find a method that returns the operation name of the query.

 

It was on the com.expediagroup.graphql.client.types.GraphQLClientRequest class and the method was getOperationName.

 

Ince we've had it we changed thebrequest names based on the values.

 

Hope this helps.

We're using ASP.NET Core 😞 still no luck with the solution.. sigh.

Best regards,
Vakho

Hi @gilgi 

 

we are using kickstart GraphQL for our springboot api (https://github.com/graphql-java-kickstart/graphql-spring-boot) .

Is there any way we can get the operation names (query and mutation names ) ?

 

Thanks

If you will find the solution, please share it with the community also. 
Thanks 🙂 

Best regards,
Vakho

gilgi
DynaMight Champion
DynaMight Champion

It seems like if you look at https://github.com/graphql-java-kickstart/graphql-spring-boot/blob/master/graphql-kickstart-spring-w... you'll see that you can actuallyu create a request attribute on graphql.kickstart.spring.webflux.GraphQLController.executeRequest and capture the first two parameters. The first one is the query and the second one is the operation name.

 

once you do that you can also rename your requests based on either values.

 

On another note, We found out that at least in the expedia version, the network protocol used in the http commands was gql. Once replaced by http or https (as this is an open source packaged), Dynatrace supported this out of the box.

 

One last thing: in the link you've sent I've seen that it is using Apolo Server. I've seen posts that describe OpenTelemtry support for Apolo Server. This could alos be a viable solution as the OneAgent automatically can collect OpenTelemtry data.

 

Hope I've managed to help.

Hi @gilgi  could you please correct the GitHub link it goes to a 404 page not found. there is, comma at the end of the link
Thanks

Best regards,
Vakho

Hi @Zimmer,

I've edited the link, it should work now 🙂

If you have any questions about the Community, you can contact me at maciej.neumann@dynatrace.com

Zimmer
Participant

I still don't understand how to get values from the payload in the header there is only https://example.com:8443/graphql request but in the payload, there is information that I want to catch with dynatrace like this :

{"variables":{"from":"CAD","to":"USD"},"query":"query ($from: String, $to: String) {\n currencyRates(from: $from, to: $to) {\n currency\n buyRate\n currencyId\n nBGRate\n sellRate\n}\n}\n"}

Still, no luck, can't get it from the backend (.NET) or from the frontend which is based on Angular 9. 

Best regards,
Vakho

gilgi
DynaMight Champion
DynaMight Champion

@Zimmer as you cannot parse the payload itself, you must get the values from the server side. Whice graphql library are you using?

We are using .NET library GraphQL v 4.2.0  have you had any experience with that? I appreciate your support.

Best regards,
Vakho

gilgi
DynaMight Champion
DynaMight Champion

Looking at the source code in Git (hopefully this is the right one), I would try to create 2 request attributes:

1. On GraphQL.Execution.IExecutionContext.Operation (which is the operation Name)

2. On GraphQL.Execution.IExecutionContext.Document (Which is the request itself) 

 

Hope this helps.

Could you guide me or share your experience regarding the Frontend side? How do I catch the values which are in payload for further manipulation? 
Frontend application is written on AngularJS 

thanks

Best regards,
Vakho

gilgi
DynaMight Champion
DynaMight Champion

Hi,

There is no way to capture the payload from the client side without writing your own js code to capture the interesting data and then utilize the Dynatrace JS sdk to send it back. What I would try to look for is to find out where the paylaod is being constructed on the server side and then define a request attribute. On the application definition pages you could then create user action property to gather value from this request attribute.

Hi gilgi,
Yeah, that's exactly what we did and it worked fine. We're continuing testing let's see what we can get more from it.

Thank you for your suggestions and help🤙

Best regards,
Vakho

Featured Posts