DataDog / dd-trace-js

JavaScript APM Tracer
https://docs.datadoghq.com/tracing/
Other
640 stars 303 forks source link

Add support for custom hooks in Redis plugin #1168

Open opeyemi-paystack opened 3 years ago

opeyemi-paystack commented 3 years ago

Hi!

A use-case we have is to graph origin service and endpoints to a Redis service. However, we've been informed that it's not possible to graph @trace.origin.resource_name APM queries in a dashboard. There are two possible solutions:

  1. A custom hook in the Redis plugin, so we can set a custom span tag with the origin resource name. Of course this would probably require being able to get the root span in the hook, as I doubt the parameters passed into the hook callback would be req and res since it's not a http plugin.

  2. The plugin taking care of this by default, by setting tags which contain the origin command (e.g. http.request, web.request) and the origin resource name (e.g. post_/transaction etc). The origin service is already intuitive since the redis service is named from it.

Happy to hear any other ways this can be resolved.

Cheers!

rochdev commented 3 years ago

A custom hook in the Redis plugin, so we can set a custom span tag with the origin resource name.

Definitely something we've been looking at doing. The main blocker for this one has been figuring out what should be passed to the hook, but otherwise it shouldn't be too difficult to add.

The plugin taking care of this by default, by setting tags

We are planning to add the origin tags automatically in a later release. I don't have a timeline but it should happen in the next few months.

opeyemi-paystack commented 3 years ago

Thanks @rochdev!

How can we stay informed so we know when this has been done?

rochdev commented 3 years ago

Right now these are generated in the backend but we'll be moving them to the tracer, so you'll see it in the release notes.

rochdev commented 3 years ago

@opeyemi-paystack Are you using redis or ioredis?

opeyemi-paystack commented 3 years ago

@rochdev I am using redis.

opeyemi-paystack commented 3 years ago

@rochdev when this is added, will we be able to use it to filter in Analytics? Or will it behave like the current origin tag, which can't?

Screenshot 2020-11-30 at 7 00 36 PM
opeyemi-paystack commented 3 years ago

Hey @rochdev, is there any update on this? Been looking forward for some months now.

jorgemaroto-eb commented 3 years ago

+1! I would like to add a TimeSeries graph to my dashboard with the latencies for different resource_names, but filtering these to which are called from my specific service.

Any information would be appreciated! :)

opeyemi-paystack commented 2 years ago

Hey @rochdev, is there any update on this?

rochdev commented 2 years ago

@opeyemi-paystack No update right now unfortunately. Since it's unclear at this point when this will be implemented in the backend as originally mentioned, I'd like to understand a bit better your use case to make sure a hook would actually work. Do you just need to add the HTTP route to the Redis span as a tag? If that's the case, can you give more details about how you will be using this in the UI?