Skip to content

Commit

Permalink
Add the evict reason as a metric tag so we can categorize the evict r…
Browse files Browse the repository at this point in the history
…eason. (#195)

* Add the evict reason as a metric tag so we can categorize the evict reason

---------

Co-authored-by: Joseph Shook <[email protected]>
Co-authored-by: Jody Donetti <[email protected]>
  • Loading branch information
3 people authored Feb 8, 2024
1 parent 90ac853 commit 80484d0
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public bool HasEvictionSubscribers()

internal void OnEviction(string operationId, string key, EvictionReason reason, object? value)
{
Metrics.CounterMemoryEvict.Maybe()?.AddWithCommonTags(1, _cache.CacheName, _cache.InstanceId);
Metrics.CounterMemoryEvict.Maybe()?.AddWithCommonTags(1, _cache.CacheName, _cache.InstanceId, new KeyValuePair<string, object?>("fusioncache.memory.evict_reason", reason.ToString()));

Eviction?.SafeExecute(operationId, key, _cache, () => new FusionCacheEntryEvictionEventArgs(key, reason, value), nameof(Eviction), _logger, _errorsLogLevel, _syncExecution);
}
Expand Down

0 comments on commit 80484d0

Please sign in to comment.