clj-otel

enn 2025-10-08T12:57:36.217929Z

Hello, I'm trying to get clj-otel working to send Datomic metrics (as gauges) to a local receiver on 127.0.0.1:4317. Everything seems OK and I don't get errors, but I also don't see the metrics in the receiver's logs. I'm invoking Datomic like so:

java -server -cp resources:datomic-transactor-pro-1.0.7394.jar:lib/* -Xmx8G -Xms1g -javaagent:/home/jett/opentelemetry-javaagent.jar -Dotel.service.name=<my-service-name> -Dotel.traces.exporter=none -Dotel.logs.exporter=none -Dotel.exporter.otlp.traces.protocol=grpc clojure.main --main datomic.launcher postgres-transactor.properties
I had to add -Dotel.exporter.oltp.traces.protocol=grpc because my receiver does not support OLTP over HTTP. Do I also need to set -Dotel.metrics.exporter to some value?

steffan 2025-10-08T14:07:46.042169Z

The default for system property otel.metrics.exporter is otlp, so I think what you have is fine. You may want to review the other autoconfiguration properties for metrics https://opentelemetry.io/docs/languages/java/configuration/#properties-metrics

👀 1
steffan 2025-10-08T14:09:27.831769Z

In particular, otel.exporter.otlp.endpoint. If localhost is not known, then that might be an issue.

steffan 2025-10-08T14:47:51.897809Z

Ah, I think I've spotted the issue; you need -Dotel.exporter.otlp.protocol=grpc not -Dotel.exporter.otlp.traces.protocol=grpc

steffan 2025-10-08T14:48:55.643719Z

This is assuming you need grpc on all signals, not just traces

steffan 2025-10-08T14:51:14.157659Z

The instrumentation agent settings use http/protobuf as the default protocol, unlike the SDK, which uses grpc as the default protocol 🤷🏼‍♂️

enn 2025-10-08T16:04:33.700759Z

Thank you! I was looking at the SDK docs which talked about grpc being the default and I couldn't understand why it would make a difference to set it explicitly. When I set it for metrics or for all signals does seem to work.

enn 2025-10-08T16:07:49.552969Z

I also had a question about https://github.com/steffan-westcott/clj-otel/blob/master/doc/guides.adoc#configure-and-run-an-application-with-telemetry. Do options 2 and 3 not require the additional jar passed to -javaagent (i.e. all the dependencies can be packaged directly in an uberjar)?

enn 2025-10-08T16:08:13.188909Z

(assuming I need only manual instrumentation)

steffan 2025-10-08T16:30:30.289719Z

• Option 1 is about using the agent; this needs the -javaagent option on the command line • Options 2-4 do not involve the agent; no -javaagent option is used here

steffan 2025-10-08T18:31:59.555639Z

The linked sections walk you through the dependencies you'll need. You could put them (with transitive dependencies) in an uberjar if you want.

enn 2025-10-08T18:52:11.850769Z

Thank you--really appreciate all the help here. I (obviously) have a lot to learn about the otel ecosystem but it's great to have so much flexibility.

🙇🏼 1