Open kaushikm02 opened 1 year ago
As you haven't provided much detail, I am limited to a general answer.
I would suggest that you get automatic instrumentation working first. Automatic instrumentation is provided by the OpenTelemetry instrumentation agent, not clj-otel
. There is a short guide to running your application with the instrumentation agent in the documentation. The agent supports a wide variety of HTTP server and client libraries.
For inbound requests, your Clojure GraphQL server will likely use an HTTP server to expose the endpoints. For outbound requests, you will likely be using an HTTP client. The fact you are using GraphQL and not REST is irrelevant, as the instrumentation agent works with the HTTP server and client libraries underneath.
For example, say you used lacinia-pedestal
for the server and clj-http
for client requests. These use Jetty for the HTTP server and Apache HTTPClient for the HTTP client, both of which are supported by the instrumentation agent.
@steffan-westcott We can not use automatic instrumentation as we have some limitation towards the byte-code converstion. I have to go with manual instrumentation. While doing so, will the library take care of the traceparent header to be passed to the downstream service or we have to pass the traceparent manually in the header to the downstream calls?
traceparent
is used in the W3C Trace Context propagation protocol. Support for W3C Trace Context is included and enabled by default in clj-otel
, though for manual instrumentation you will need to write a couple of lines of code to actually use it.
Context propagation is implemented by reading (extracting) and writing (injecting) HTTP headers. For manual instrumentation, you need to make use of clj-otel
features to ensure the context is extracted from incoming HTTP requests, and the (modified) context is injected into outgoing HTTP requests.
clj-otel
Ring middleware and Pedestal interceptors. The middleware and interceptors perform extraction by using the function headers->merged-contextWe have a graphql API written in Clojure and have used this library successfully. We're using graphql-java but were using Walmart Labs Lacinia. Both were instrumented using this library. If you have specific questions about implementation, I might be able to provide information on our setup.
Could you please share the link to the repo just for viewing?? @brett-bim
We don't have a public repo with that info. We run the API with the latest opentelemetry-javaagent.jar which has autoinstrumentation for graphql included. This provides spans that include attributes like the graphql query and others.
Hi @steffan-westcott.. I have a clojure graphql server (NOT a REST base server)which is an orchestration micro service. In my service, there are multiple outbound calls happening. I tried to instrument the service using the clj-otel(both automatic and manual) as mentioned in the tutorial. I am not seeing the traces properly in case of automatic instrumentation and not seeing the traces at all for manual instrumentation. Can you help me with this? is it even possible to instrument the clojure-graphql service with clj-otel as it is not a typical REST base server???