Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

otlp exporter exception #16

Closed
flyingmachine opened this issue Aug 19, 2024 · 2 comments
Closed

otlp exporter exception #16

flyingmachine opened this issue Aug 19, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@flyingmachine
Copy link

I'm seeing the following logged when I try to log a trace:

[otel.javaagent 2024-08-19 15:32:05:900 -0400] [BatchSpanProcessor_WorkerThread-1] WARN io.opentelemetry.sdk.trace.export.BatchSpanProcessor - Exporter threw an Exception
java.lang.ClassCastException: class java.lang.Integer cannot be cast to class java.lang.Long (java.lang.Integer and java.lang.Long are in module java.base of loader 'bootstrap')
at io.opentelemetry.exporter.internal.otlp.KeyValueMarshaler.create(KeyValueMarshaler.java:83)
at io.opentelemetry.exporter.internal.otlp.KeyValueMarshaler.access$000(KeyValueMarshaler.java:28)
at io.opentelemetry.exporter.internal.otlp.KeyValueMarshaler$1.accept(KeyValueMarshaler.java:63)
at io.opentelemetry.exporter.internal.otlp.KeyValueMarshaler$1.accept(KeyValueMarshaler.java:58)
at java.base/java.util.HashMap.forEach(HashMap.java:1337)
at io.opentelemetry.sdk.internal.AttributesMap.forEach(AttributesMap.java:88)
at io.opentelemetry.exporter.internal.otlp.KeyValueMarshaler.createForAttributes(KeyValueMarshaler.java:57)
at io.opentelemetry.exporter.internal.otlp.traces.SpanMarshaler.create(SpanMarshaler.java:46)
at io.opentelemetry.exporter.internal.marshal.MarshalerUtil.groupByResourceAndScope(MarshalerUtil.java:68)
at io.opentelemetry.exporter.internal.otlp.traces.ResourceSpansMarshaler.groupByResourceAndScope(ResourceSpansMarshaler.java:96)
at io.opentelemetry.exporter.internal.otlp.traces.ResourceSpansMarshaler.create(ResourceSpansMarshaler.java:37)
at io.opentelemetry.exporter.internal.otlp.traces.TraceRequestMarshaler.create(TraceRequestMarshaler.java:32)
at io.opentelemetry.exporter.otlp.http.trace.OtlpHttpSpanExporter.export(OtlpHttpSpanExporter.java:101)
at io.opentelemetry.sdk.trace.export.BatchSpanProcessor$Worker.exportCurrentBatch(BatchSpanProcessor.java:340)
at io.opentelemetry.sdk.trace.export.BatchSpanProcessor$Worker.run(BatchSpanProcessor.java:258)
at java.base/java.lang.Thread.run(Thread.java:829)

I have my project configured to use the otel java agent and to export traces as OTLP. Happy to share more details! Hacking open_telemetry.clj to coerce signal lines to longs seems to remedy it:

(let [ak-uid  (io.opentelemetry.api.common.AttributeKey/stringKey "uid")
      ak-ns   (io.opentelemetry.api.common.AttributeKey/stringKey "ns")
      ak-line (io.opentelemetry.api.common.AttributeKey/longKey   "line")]

  (defn- span-attrs
    "Returns `io.opentelemetry.api.common.Attributes` or nil."
    [uid signal]
    (prn "line" (type (get signal :line)))
    (if uid
      (if-let   [ns   (get signal :ns)]
        (if-let [line (get signal :line)]
          (Attributes/of ak-uid (str uid), ak-ns ns, ak-line (long line))
          (Attributes/of ak-uid (str uid), ak-ns ns))
        (Attributes/of   ak-uid (str uid)))

      (if-let   [ns   (get signal :ns)]
        (if-let [line (get signal :line)]
          (Attributes/of ak-ns ns, ak-line (long line))
          (Attributes/of ak-ns ns))
        nil))))
@ptaoussanis ptaoussanis added the bug Something isn't working label Aug 19, 2024
@ptaoussanis ptaoussanis self-assigned this Aug 19, 2024
@ptaoussanis
Copy link
Member

@flyingmachine Hey Daniel, thanks a lot for the report (and for identifying the issue!).

Does the OTLP exporter seem to work okay otherwise? If so, I'll cut a new release with your fix first thing tomorrow 👍

@flyingmachine
Copy link
Author

flyingmachine commented Aug 20, 2024

Hey Peter! I’m not at my computer at the moment to try this out but the addition of :_otel-context was preventing handle-tracing! from being called, as far as I could tell. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants