open-telemetry / opentelemetry-java-instrumentation

OpenTelemetry auto-instrumentation and instrumentation libraries for Java
https://opentelemetry.io
Apache License 2.0
1.9k stars 826 forks source link

Server span not generating in clojure project using java auto instrumentation #7507

Open schandrasekaran-mdsol opened 1 year ago

schandrasekaran-mdsol commented 1 year ago

I have integrated opentelemetry-java-instrumentation version 1.21.0 with required configuration & docker file setup. I could see the client spans are exporting properly using logging & otlp exporter, but the server spans are not generating. Below are the environment variables has been used: export OTEL_SERVICE_NAME=myservice export OTEL_METRICS_EXPORTER=none export OTEL_TRACES_EXPORTER=logging,otlp export JAVA_OPTS="-javaagent:opentelemetry-javaagent.jar" export OTEL_EXPORTER_OTLP_ENDPOINT= the end point

Below is the sample http client span log: [otel.javaagent 2022-12-29 11:20:09:201 +0000] [worker-3] INFO io.opentelemetry.exporter.logging.LoggingSpanExporter - 'HTTP GET' : 0c01602032b4d32799cb9063ee1yyuuy67 b75b268527gfgfg67 CLIENT [tracer: io.opentelemetry.apache-httpclient-4.0:1.21.0-alpha] AttributesMap{data={http.url=https:// domain url **/my-service?q=, thread.id=24, thread.name=worker-3, http.method=GET, net.peer.name=**.net, net.transport=ip_tcp, http.status_code=200, http.flavor=1.1}, totalAddedValues=integer}

Sample DB span log: [otel.javaagent 2023-01-02 06:19:35:898 +0000] [worker-4] INFO io.opentelemetry.exporter.logging.LoggingSpanExporter - 'INSERT *.tablename' : 1e3cc49e8a223a6g688e3625866b64789 3284cd1f222678uh CLIENT [tracer: io.opentelemetry.jdbc:1.21.0-alpha] AttributesMap{data= ** }

The framework details: Clojure CLI version 1.10.3.1069 java11-jdk Leiningen 2.8.1 Web server: Luminus version "2.9.12.79"

Kindly help me to understand & resolve the issue.

trask commented 1 year ago

hi @schandrasekaran-mdsol! what http server library/framework (and version) are you using? just want to check first whether it's one that the OpenTelemetry Java agent instruments: https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/docs/supported-libraries.md#libraries--frameworks

schandrasekaran-mdsol commented 1 year ago

Hi @trask, Thanks for the response. Please refer the below details:

I am using "luminus.http-server" - version "2.9.12.79".
Reference: https://luminusweb.com/docs/guestbook https://github.com/luminus-framework (luminus-http-kit "0.1.6").

https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/docs/supported-libraries.md#libraries--frameworks -> Looks OpenTelemetry not supports luminus.

But still I am wondering how I got client spans for the same. Also, the tracer for that is apache-httpclient -> CLIENT [tracer: io.opentelemetry.apache-httpclient-4.0:1.21.0-alpha]

mateuszrzeszutek commented 1 year ago

Currently we don't instrument luminus, neither do we instrument httpkit (which you seem to be using in your project). This'll require new instrumentations for either one (or both) of them.

Can you try replacing luminus-http-kit with luminus-undertow (we do have an instrumentation for Undertow) and see if it generates server spans?

But still I am wondering how I got client spans for the same. Also, the tracer for that is apache-httpclient -> CLIENT [tracer: io.opentelemetry.apache-httpclient-4.0:1.21.0-alpha]

Probably whatever HTTP client you're using is actually a wrapper over the Apache HTTP client - which we instrument.

schandrasekaran-mdsol commented 1 year ago

Sure @mateuszrzeszutek . I will try with "luminus-undertow". Thanks for your response.

Let's keep this ticket open now.

schandrasekaran-mdsol commented 1 year ago

Thanks @mateuszrzeszutek . Server spans are generating properly now using "luminus-undertow".