32 {
33 lock (this)
34 {
35 double num = 0.0;
36 try
37 {
39 }
40 catch (Exception ex)
41 {
42 ReportOutOfBandMessage(
"ERROR: Exception during EventCounter " + base.Name +
" metricProvider callback: " + ex.Message);
43 }
44 CounterPayload counterPayload = new CounterPayload();
45 counterPayload.Name = base.Name;
46 counterPayload.DisplayName = base.DisplayName ?? "";
47 counterPayload.Count = 1;
48 counterPayload.IntervalSec = intervalSec;
49 counterPayload.Series = $"Interval={pollingIntervalMillisec}";
50 counterPayload.CounterType = "Mean";
51 counterPayload.Mean = num;
52 counterPayload.Max = num;
53 counterPayload.Min = num;
55 counterPayload.StandardDeviation = 0.0;
56 counterPayload.DisplayUnits = base.DisplayUnits ?? "";
58 base.EventSource.Write("EventCounters", new EventSourceOptions
59 {
60 Level = EventLevel.LogAlways
61 }, new PollingPayloadType(counterPayload));
62 }
63 }
string GetMetadataString()
void ReportOutOfBandMessage(string message)
readonly Func< double > _metricProvider