Comments (12)
The GraphQL
object is request-scoped, so it's created on every request. You'll need to implement a https://github.com/graphql-java/graphql-java-servlet/blob/master/src/main/java/graphql/servlet/InstrumentationProvider.java bean that returns the tracing instrumentation.
from graphql-spring-boot.
Hi @apottere,
Thank you for your response, but I have create an implementation of the InstrumentProvider :
public class GraphQLInstrumentationProvider implements InstrumentationProvider { @Override public Instrumentation getInstrumentation() { return new TracingInstrumentation(); } }
and I also provide the bean,
@Bean InstrumentationProvider instrumentationProvider() { return new GraphQLInstrumentationProvider(); }
I'll try to include some detail of my sample code :
my schema only contain
type Query { allLinks: [Link] } type Link { id: ID! url: String! description: String }
my request :
{ allLinks{ id } }
my response :
{ "data": { "allLinks": [ { "id": "1" } ] } }
Is there anything else that i missed ?
from graphql-spring-boot.
No, that should work. Is it injecting the InstrumentationProvider into your servlet?
from graphql-spring-boot.
Hi @apottere ,
I think it suppose to provide the InstrumentationProvider bean to the servlet, but as i see in the documentation, http://graphql-java.readthedocs.io/en/v6/instrumentation.html
The instrumentation should be set into the GraphQL object, that's why at first i tried to create the bean for GraphQL object, but since the GraphQL object is request-scoped, i'm not sure how to add it.
from graphql-spring-boot.
The GraphQL
object is created by the servlet when it gets a request.
from graphql-spring-boot.
Hi @apottere,
I'm still unable to provide the TracingInstrumentation to the GraphQL object.
I have created my implementation and provide the Bean.
could you give me example of how to injecting the Instrumentatio Provider?
or Is it possible to keep this issue open so I can get insight from some people that has tried this before?
Thank you
from graphql-spring-boot.
Sorry, I was mistaken - you can just add your instrumentation as a bean and it should be picked up:
@Bean
Instrumentation instrumentation() {
return new TracingInstrumentation();
}
from graphql-spring-boot.
hi @apottere ,
Did that work for you ?
Since i have tried it, i also have tried provided the TracingInstrumentation as bean before, but there is no change at all.
from graphql-spring-boot.
Yes, I tried it in an example project and hit a breakpoint in the TracingInstrumentation
from graphql-spring-boot.
Hi @apottere
Yes, I also tried to debug and hit a breakpoint at GraphQLWebAutoConfiguration which the Tracing Instrumentation has been added to GraphQLServlet bean.
Yet there is no change to my Json Response, there is no extra tracing data under extensions.
Thank you 👍
from graphql-spring-boot.
Fixed,
It's because of older version of version of graphql-java-servlet as pointed by eric taix at Stackoverflow 😅
Thank you
from graphql-spring-boot.
Sorry, I was mistaken - you can just add your instrumentation as a bean and it should be picked up:
@Bean Instrumentation instrumentation() { return new TracingInstrumentation(); }
Hi @apottere , can this be found in any documentation? are there any detailed documents about which beans can be injected to Spring?
Thanks.
from graphql-spring-boot.
Related Issues (20)
- Customize SimpleDataFetcherExceptionHandler to avoid logException for certain errors HOT 1
- Spring Boot Graphql Remove duplicates from the Response
- SpringDoc bean name conflict error HOT 1
- Latest 15.0.0 version is not compatible with Spring boot 3.0.2 and spring security 6.0.1 HOT 3
- Possibility to add authorization headers to the GraphQLTestSubscription HOT 14
- How to set the bearer token dynamically in graphql-spring-boot playground
- different data response for nullable and non-nullable responses
- @connection not working after Spring Boot and graphql upgrade HOT 1
- CVE-2023-28867 affects all recent versions (including v15)
- `ErrorHandlerSupplier` not always initialized when we first need it
- Query returning the result of previously timed out query
- Support check origin for websocket to secure against cross-site attacks
- Support CSRF on websockets to secure against cross-site attacks
- When upgrading to Spring Boot 3.1.0 we get in the response the tracing information under extensions HOT 2
- MetricsInstrumentation does not implement updated API of TracingInstrumentation provided by graphql-java
- Maven seems to confuse graphql-java version HOT 4
- Request scoped beans aren't accessible in mutation and query resolvers
- Virtual threads support
- Cannot disable tracing response with graphql-spring-boot-starter version 15 HOT 4
- No qualifying bean of type 'com.graphql.spring.boot.test.GraphQLTestTemplate' available : graphql-spring-boot-starter-test:jar:15.0.0
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from graphql-spring-boot.