Skip to content

Commit

Permalink
added project and key to IsActive function
Browse files Browse the repository at this point in the history
  • Loading branch information
JoelNygren-Norce committed Nov 20, 2024
1 parent 6c850df commit 4af7b8b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion HzMemoryCache/Diagnostics/Activities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ private static IEnumerable<KeyValuePair<string, object>> GetCommonTags(string? k

public static Activity? StartActivityWithCommonTags(this ActivitySource source, string activityName, string project, bool async = false, string? key = null, string? pattern = null, bool? sendNotification = null)
{
if (source.HasListeners() == false || !HzCacheTracesInstrumentationOptions.Instance.IsActive(activityName))
if (source.HasListeners() == false || !HzCacheTracesInstrumentationOptions.Instance.IsActive(activityName, project, key))
return null;

return source.StartActivity(
Expand Down
2 changes: 1 addition & 1 deletion HzMemoryCache/Diagnostics/HzCacheDiagnostics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
public static class HzCacheDiagnostics
{
public const string HzCacheVersion = "0.0.6";
public const string HzCacheVersion = "0.0.9";
public const string ActivitySourceName = "HzMemoryCache";
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
using System;
using static HzCache.Diagnostics.Activities;

namespace HzCache.Diagnostics
{
public class HzCacheTracesInstrumentationOptions
{
public static HzCacheTracesInstrumentationOptions Instance { get; } = new();
public Func<string, bool> Active { private get; set; }
public Func<string, string, string, bool> Active { private get; set; }

public bool IsActive(string activityName) => Active(activityName);
public bool IsActive(string activityName,string project, string? key) => Active(activityName, project, key);
}
}

0 comments on commit 4af7b8b

Please sign in to comment.