StackExchangeRedis support for uniquely instrumenting multiple Redis connections #1997
Labels
comp:instrumentation.stackexchangeredis
Things related to OpenTelemetry.Instrumentation.StackExchangeRedis
enhancement
New feature or request
Component
OpenTelemetry.Instrumentation.StackExchangeRedis
Is your feature request related to a problem?
We have an application that uses a single Redis server for multiple purposes (e.g. caching and SignalR). If we try to call
.AddRedisInstrumentation
for each of our different Redis connections, we end up with duplicate spans in our traces.The
ActivityName
andActivitySource
inStackExchangeRedisConnectionInstrumentation
are the same for all Redis connections that are instrumented, rather than being able to support unique names/sources per Redis connection.Being able to support "unique" instrumentation per Redis connection would prevent the duplicate spans we're currently experiencing. Further, it would allow us to specify different options (e.g.
Enrich
actions) for each connection as needed.What is the expected behavior?
Ideally, each call to
.AddRedisInstrumentation
could effectively configure instrumentation that is unique per Redis connection if the consumer of theOpenTelemetry.Instrumentation.StackExchangeRedis
library chooses to go this route.The default behavior (all Redis connections are instrumented the same) would still be an option. This per-connection instrumentation I'm requesting would simply be optional.
Which alternative solutions or features have you considered?
I tried different instrumentation approaches using the library, but was unable to get the desired result. I either ended up with traces that seemed to be missing spans for calls related to certain Redis connections/commands, or traces with duplicate spans for a given Redis command.
Additional context
I've messed around with the code a bit to try to get a working PoC. I do have it working, but there may be a more elegant way to provide this support.
I'm happy to submit a PR for this and have folks much more familiar with the code to have a look.
The text was updated successfully, but these errors were encountered: