-
Notifications
You must be signed in to change notification settings - Fork 179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add App Insights Dependency Tracking #51
Comments
Do you guys think you will add support for this? |
i really don't think thats a good idea... at least not bluntly put as such... my redis logs about 14 million operations per hour (avg of 4 operations per millisecond) and i'm operating from a single 2 core 3gb ram PaaS... that would affect me in 3 ways:
|
I'm currently bypasses this problem using a custom implementation for track events in my Application Insights. My code seems like this: /// <summary>
///
/// </summary>
public class RedisFacade : IRedisFacade {
private readonly IDatabaseAsync _cache;
private readonly TelemetryClient _telemetry;
private readonly Stopwatch _watch;
private const string Redis = "REDIS";
private readonly string _redisHost;
/// <summary>
///
/// </summary>
/// <param name="multiplexer"></param>
/// <param name="options"></param>
/// <param name="telemetry"></param>
public RedisFacade(IConnectionMultiplexer multiplexer, IOptions<ConnectionsOptions> options,
TelemetryClient telemetry) {
_cache = multiplexer.GetDatabase();
_telemetry = telemetry;
_watch = new Stopwatch();
_redisHost = "myredishost:6379";
}
/// <summary>
///
/// </summary>
/// <param name="method"></param>
/// <param name="func"></param>
/// <typeparam name="T"></typeparam>
/// <returns></returns>
private async Task<T> ExecuteWithTracking<T>(string method, Func<Task<T>> func) {
var start = DateTimeOffset.Now;
if (_watch.IsRunning)
_watch.Restart();
else
_watch.Start();
var result = await func().ConfigureAwait(false);
_watch.Stop();
var end = _watch.Elapsed;
_telemetry.TrackDependency(Redis, _redisHost,
method, string.Empty, start, end, string.Empty, true);
return result;
}
/// <summary>
///
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
public async Task<RedisValue> StringGetAsync(RedisKey key) {
return await ExecuteWithTracking("StringGetAsync", () => _cache.StringGetAsync(key))
.ConfigureAwait(false);
}
/// <summary>
///
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
public async Task<bool> KeyExistsAsync(RedisKey key) {
return await ExecuteWithTracking("KeyExistsAsync", () => _cache.KeyExistsAsync(key))
.ConfigureAwait(false);
}
} My Application Insights Application Map: |
@andre-castro-garcia, is IRedisFacade your own abstraction? If not, how do we inject this abstraction into RedisSessionStateProvider.cs to make sure everything goes through this override. |
Currently, Redis does not use Dependency Tracking for Application Insights, and we have seen many issues related to Redis timeouts and network latency that would be much easier to debug and see if dependency tracking was built into this provider.
The text was updated successfully, but these errors were encountered: