Created
December 5, 2025 07:05
-
-
Save wullemsb/c70d1af521bef658edab08c6c6b37204 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [EventSource(Name = "MyCompany.MyApp")] | |
| public sealed class MyEventSource : EventSource | |
| { | |
| public static readonly MyEventSource Log = new MyEventSource(); | |
| private EventCounter _requestCounter; | |
| private PollingCounter _queueLengthCounter; | |
| private MyEventSource() | |
| { | |
| _requestCounter = new EventCounter("request-count", this); | |
| _queueLengthCounter = new PollingCounter("queue-length", this, | |
| () => GetQueueLength()); | |
| } | |
| public void RecordRequest() | |
| { | |
| _requestCounter.WriteMetric(1); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment