clj-otel

Sam H 2023-11-17T17:40:59.729319Z

Possible bug with the code here: https://github.com/steffan-westcott/clj-otel/blob/0.2.4.1/clj-otel-api/src/steffan_westcott/clj_otel/api/trace/http.clj#L466

(add-route-data! (:request-method request) path {:context server-span-context})
if server-span-context is nil causing you to pass in
{:context nil}
https://github.com/steffan-westcott/clj-otel/blob/0.2.4.1/clj-otel-api/src/steffan_westcott/clj_otel/api/trace/http.clj#L121 The :or get executed so you get a "default" context,
{:keys [context app-root]
     :or   {context (context/dyn)}}
Here's a small example that replicates what I am seeing.
(defn test-or
    [{:keys [this-is-nil this-is-not] :or {this-is-nil 1 this-is-not 2}}]
    {:this-is-nil this-is-nil
     :this-is-not this-is-not})

  (test-or {:this-is-nil nil})
  ;; => {:this-is-nil nil, :this-is-not 2}
  (test-or {})
  ;; => {:this-is-nil 1, :this-is-not 2}
Btw, any plans to update the interceptors to work with reitit? Also many thanks for the work on this project πŸ™

2023-11-18T13:38:54.584629Z

Ah, it’s probably due to me just using the router-interceptor by itself. Tho I needed to adapt the code to pull out the path from the request due to a slight difference in reitit. Also the other interceptors had issues due to the :error functions being 2 arity vs retits 1 arity

steffan 2023-11-17T22:31:15.975419Z

Thank you for your interest in clj-otel πŸ€— β€’ server-span-context should never be nil if the server-span-interceptors are correctly applied in your application. See https://cljdoc.org/d/com.github.steffan-westcott/clj-otel-api/0.2.4.1/doc/guides#_use_pedestal_interceptors_for_server_span_support on constructing the interceptors for a Pedestal HTTP service with server span support. You can also look at the microservices interceptor examples for more. Would you happen to have an example application where this is not working as expected? β€’ I should be able to add route data support for Reitit with Pedestal, I had not considered this before. I had assumed Reitit implemented Pedestal's Router protocol, but it seems not to be the case.

Sam H 2023-11-20T09:16:22.867349Z

^^ that was when using the server-span-interceptors in a reitit app

Sam H 2023-11-20T12:00:05.640119Z

actually, the root of the issue is using https://github.com/metosin/sieppari#differences-to-pedestal Which has a slight difference to how the error handlers are defined