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

Publicado em: 11 Outubro 2020
no canal de: 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


Nesta página do site você pode assistir ao vídeo on-line Spring Boot GraphQL Tutorial #24 - Instrumentation (Request Logging) duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário Philip Starritt 11 Outubro 2020, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 5,194 vezes e gostou 52 espectadores. Boa visualização!