[sdk] Ignore event counters in SelfDiagnosticsEventListener (#5046)

This commit is contained in:
Mikel Blanchard 2023-11-13 17:07:29 -08:00 committed by GitHub
parent 78ab35cefd
commit ecb5dc8732
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -318,7 +318,12 @@ internal sealed class SelfDiagnosticsEventListener : EventListener
/// <param name="eventData">Data of the EventSource event.</param>
protected override void OnEventWritten(EventWrittenEventArgs eventData)
{
this.WriteEvent(eventData.Message, eventData.Payload);
// Note: The EventSource check here works around a bug in EventListener.
// See: https://github.com/open-telemetry/opentelemetry-dotnet/pull/5046
if (eventData.EventSource.Name.StartsWith(EventSourceNamePrefix, StringComparison.OrdinalIgnoreCase))
{
this.WriteEvent(eventData.Message, eventData.Payload);
}
}
private void Dispose(bool disposing)