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

Veröffentlicht am: 11 Oktober 2020
auf dem Kanal: 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


Auf dieser Seite können Sie das Online-Video Spring Boot GraphQL Tutorial #24 - Instrumentation (Request Logging) mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Philip Starritt 11 Oktober 2020 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 5,194 Mal angesehen und es wurde von 52 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!