Coorelation with logs generated via Lograge #1289
-
Hi, is there any way i can correlate the traces with rails logs generated via lograge gem using context propagation. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Hi! Thanks for raising this! We currently do not have the lograge gem instrumented (you can see all of our available instrumentation in the |
Beta Was this translation helpful? Give feedback.
-
I have not used lograge before but I imagine you could do something like this: config.lograge.custom_options = lambda do |event|
span = OpenTelemetry::Trace.current_span
{ "trace_id" => span.context.hex_trace_id, "span_id" => span.context.hex_span_id }
end Or with the propagation API, however that will inject attributes for all of the propagators you have configured, which may not be ideal: config.lograge.custom_options = lambda do |event|
{}.tap do |carrier|
OpenTelemetry.propagation.inject(carrier)
end
end |
Beta Was this translation helpful? Give feedback.
I have not used lograge before but I imagine you could do something like this:
Or with the propagation API, however that will inject attributes for all of the propagators you have configured, which may not be ideal: