Pierre-Lannoy / wp-decalog

Capture and log events, metrics and traces on your site. Make WordPress observable - finally!
https://perfops.one/
GNU General Public License v3.0
64 stars 8 forks source link

Support custom Jaeger tags #28

Closed stevapple closed 1 year ago

stevapple commented 2 years ago

Is your feature request related to a problem? Please describe. The Jaeger endpoint I’m given is shared by multiple users, and it will classify different applications by token tag. Currently wp-decalog cannot specify custom tags, so I’m not able to use the service.

Describe the solution you'd like Allow users to set custom Jaeger tags.

Describe alternatives you've considered Can’t think of any alternative yet.

Additional context I’ve opened a PR on the Jaeger client library for supporting client-level tag configuration. Before that work is done, we can workaround by setting the tags on each spans.

Pierre-Lannoy commented 2 years ago

Hello @stevapple ! I see your issue on the client library. As soon as it is solved, I will implement it in DecaLog.

Thanks for the suggestion.

stevapple commented 2 years ago

I checked the source and found that Decalog is not using the Jaeger client, but instead constructing a Thrift payload directly?

Then we shouldn’t need such feature. The only solution is to manually append the tags in Decalog\Handler\ AbstractTracingHandler:jaeger_format.

Pierre-Lannoy commented 1 year ago

Hello @stevapple ! Sorry for this late answer… If I understand well what you're suggesting, the best way to do what you want to achieve is to allow to set custom tags at the logger creation (as key/value pairs) and propagate it for all spans before sending. Am I right?

stevapple commented 1 year ago

I think yes:)

Pierre-Lannoy commented 1 year ago

OK, understood. I will try to do it for 3.6 version of the plugin which will be ready for WP 6.1 release…

Pierre-Lannoy commented 1 year ago

Hello! Version 3.6.0 is released. Could you confirm it fixes your issue? Thanks 😉

stevapple commented 1 year ago

Is there a way I can manually trigger / debug a trace to verify that it works? I didn't see reported traces in my APM dashboard, but I'm not sure which part goes wrong (or everything works as intended).

Pierre-Lannoy commented 1 year ago

You have to specify it in the logger settings:

Capture d’écran 2022-10-06 à 11 15 19
stevapple commented 1 year ago

I used Jaeger and its log level is fixed to emergency. Is that why I’m not seeing any traces? Any way to change the behavior?

Pierre-Lannoy commented 1 year ago

There's no "log level" in traces. Traces are collections of spans with tags. And, as all tracers I know, Jaegger do not manipulate the "concept" of log level (except for its own debugging). So, I do not understand… What do you want to achieve?

stevapple commented 1 year ago

🤔So… I can see events being processed by Decalog, but there’s no reports on my APM dashboard, so it’s reasonable to assume there’s something wrong in the middle, right?

Then is there anyway to debug?

Pierre-Lannoy commented 1 year ago

Well, I definitely do not understand: at which service do you send events?

stevapple commented 1 year ago

Wait, must I add custom events through SDK to get spans? Is there built-in spans injected for WordPress and PHP?

Pierre-Lannoy commented 1 year ago

Of course there is 😉 but I think it's not currently the issue. Please, can you confirm what you want to send to your apm: events or traces?

stevapple commented 1 year ago

I think there’re only (nested) spans in Jaeger/OpenTelemetry? A trace is a collection of spans with the same trace ID.

Pierre-Lannoy commented 1 year ago

Yes, that's why I doesn't understand why you stated about "log level" and emergency - and events processed by DecaLog. I must admit I'm a bit puzzled…

In DecaLog, if you have created a Jaeger logger, with the right parameters (ie. right service URL and right tags with at least the token tag for your case), you will see traces in Jaeger. Is it not the case for you?

Pierre-Lannoy commented 1 year ago

I close this due to inactivity and because, from my side, change is done and working.