Spring Boot GraphQL Tutorial #24 - Instrumentation (Request Logging)

Pubblicato il: 11 ottobre 2020
sul canale di: Philip Starritt
5,194
52

GraphQL Instrumentation allows you to inject code that can observe the execution of a query and also change the runtime behaviour. Let's take advantage of this to log the graphql request's query, variables, any exceptions thrown and execution time.


To do this we create a spring bean of type graphql.execution.instrumentation.Instrumentation.
To remove boilerplace no-op code, we override no-op SimpleInstrumentation implementation and just override the beginExecution method.


We then return a SimpleInstrumentationContext with an whenCompleted callable containing our duration logic and log message.

It is possible that multiple Instrumentation objects are in one graphql server.


In the next video, I demo the TracingInstrumentation that will capture the execution time of the fields and place the results into the graphql response.

See you in the next video!

Cheers!
Philip


GraphQL Instrumentation: https://www.graphql-java.com/document...


Spring Boot GraphQL Java: https://github.com/graphql-java-kicks...


Good article on graphql paypal instrumentation:   / graphql-instrumenting-your-api-and-unlocki...  


Image on thumbnail: https://wallhaven.cc/w/ymepyg


In questa pagina del sito puoi guardare il video online Spring Boot GraphQL Tutorial #24 - Instrumentation (Request Logging) della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Philip Starritt 11 ottobre 2020, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 5,194 volte e gli è piaciuto 52 spettatori. Buona visione!