Elastic.Apm.StackExchange.Redis targets the StackExchange.Redis package - so if you use redis via StackExchange.Redis, then I it should work. Your code snippet does not tell much, but based on services.AddStackExchangeRedisCache I suspect you use this package.
You need to have access to the IConnectionMultiplexer from Redis and call .UseElasticApm on it (that method is in the Elastic.Apm.StackExchange.Redis package.
Do you have access to IConnectionMultiplexer over the options variable? If so, then just call the method - if you don't, then I suggest the approach should be that you try to figure out how you can have access to the IConnectionMultiplexer so you can register the APM Agent with it.
As far as I see I don't have access to the IConnectionMulitplexer over the options variable. But it seems to be possible to access an property called 'ConnectionMultiplexerFactory' over the options variable. I tried to use this but unfortunately with no success. The first line of code results in a NullReferenceException.
Do you have any idea how to get this working? It would be wonderful if you would have an code snippet for me so that I can have a look at it and try to adapt my code. Hint: I have some business logic services which expect an IDistributedCache (from Microsoft.Extensions.Caching.Distributed) in their constructor and they get this via dependency injection - this way is needed also in future.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.