opentelemetry-cpp icon indicating copy to clipboard operation
opentelemetry-cpp copied to clipboard

Need a way to set 'key' field in jaeger span logs

Open VivekSubr opened this issue 2 years ago • 4 comments

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

VivekSubr avatar Sep 07 '23 06:09 VivekSubr

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 avatar Sep 08 '23 07:09 lalitb

@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 avatar Sep 28 '23 06:09 VivekSubr

@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.

lalitb avatar Nov 02 '23 05:11 lalitb

This issue was marked as stale due to lack of activity.

github-actions[bot] avatar Jan 02 '24 01:01 github-actions[bot]