Created
December 5, 2025 08:02
-
-
Save wullemsb/e43ca6e7a3275cd467aad06b35898bd9 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
| public class RequestsMeter | |
| { | |
| private static readonly Meter s_meter = new Meter("MyCompany.MyApp.Requests", "1.0.0"); | |
| private static readonly Counter<long> s_requestCounter = | |
| s_meter.CreateCounter<long>("request-count", description: "Total number of requests"); | |
| private static readonly ObservableGauge<int> s_queueLengthGauge = | |
| s_meter.CreateObservableGauge("queue-length", | |
| () => GetQueueLength(), | |
| description: "Current queue length"); | |
| public static void RecordRequest() | |
| { | |
| s_requestCounter.Add(1); | |
| } | |
| private static int GetQueueLength() | |
| { | |
| // TODO: Add implementation | |
| return Random.Shared.Next(0, 100); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment