Skip to content

Commit 9b3f2a6

Browse files
committed
feat(telemetry): initialize EventSource in Enable method
1 parent d93adb6 commit 9b3f2a6

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/HttpUserAgentParser.MemoryCache/Telemetry/HttpUserAgentParserMemoryCacheTelemetry.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,11 @@ public static bool IsCacheSizeEnabled
5252
/// <summary>
5353
/// Enables EventCounter telemetry for the MemoryCache provider.
5454
/// </summary>
55-
public static void Enable() => Interlocked.Or(ref s_enabledFlags, EventCountersFlag);
55+
public static void Enable()
56+
{
57+
_ = HttpUserAgentParserMemoryCacheEventSource.Log;
58+
Interlocked.Or(ref s_enabledFlags, EventCountersFlag);
59+
}
5660

5761
/// <summary>
5862
/// Enables native System.Diagnostics.Metrics telemetry for the MemoryCache provider.

src/HttpUserAgentParser/Telemetry/HttpUserAgentParserTelemetry.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,11 @@ public static bool IsCacheSizeEnabled
6060
/// <summary>
6161
/// Enables core EventCounter telemetry for the parser.
6262
/// </summary>
63-
public static void Enable() => Interlocked.Or(ref s_enabledFlags, EventCountersFlag);
63+
public static void Enable()
64+
{
65+
_ = HttpUserAgentParserEventSource.Log;
66+
Interlocked.Or(ref s_enabledFlags, EventCountersFlag);
67+
}
6468

6569
/// <summary>
6670
/// Enables native System.Diagnostics.Metrics telemetry for the parser.

0 commit comments

Comments
 (0)