opentelemetry-cpp
opentelemetry-cpp copied to clipboard
Need a way to set 'key' field in jaeger span logs
Is your feature request related to a problem? In Opentracing, it was possible to set the 'key' field in span logs, since the api took an array of key value pairs: Span->Log({ { key, value } })
However, in opentelemetry's AddEvent api, you can only set a single log string, or optionally a timestamp and tags... there doesn't seem to be a way to get equivalent behavior as opentracing.
example: "logs": [ { "timestamp": 1691424565488606, "fields": [ { "key": "event", <--- How to set this? "type": "string", <--- Or this? "value": "log" }
Describe the solution you'd like A way to set the key field in jaeger span log
Describe alternatives you've considered Seen the AddEvent overloads in class span
Can't you set the key-value using attributes argument below:
void AddEvent(nostd::string_view name,
opentelemetry::common::SystemTimestamp timestamp,
const opentelemetry::common::KeyValueIterable &attributes) noexcept override;
Probably I didn't understand your question, if you can elaborate more?
@lalitb - sorry for the late reply, so your saying, something like
AddEvent("event", opentelemetry::common::SystemTimestamp(), "log")
Would translate to key : value for jaeger? I'll try that and get back to you, but right off the first problem is why would a log be of type 'keyvalueiterable'?
To use this, I need to change my log string to some sort of array structure so it's constructible by KeyValueInterableView?
@VivekSubr It would be mapped as mentioned here -
https://github.com/open-telemetry/opentelemetry-specification/blob/v1.26.0/specification/trace/sdk_exporters/jaeger.md#events
But Jaeger exporter has been removed and you should be using OTLP exporter for this. Let us know if you have any further questions.
This issue was marked as stale due to lack of activity.