@@ -15,28 +15,22 @@ internal sealed class ComponentsMetrics : IDisposable
1515
1616 private readonly Counter < long > _navigationCount ;
1717
18- private readonly Histogram < double > _eventSyncDuration ;
19- private readonly Histogram < double > _eventAsyncDuration ;
18+ private readonly Histogram < double > _eventDuration ;
2019 private readonly Counter < long > _eventException ;
2120
22- private readonly Histogram < double > _parametersSyncDuration ;
23- private readonly Histogram < double > _parametersAsyncDuration ;
21+ private readonly Histogram < double > _parametersDuration ;
2422 private readonly Counter < long > _parametersException ;
2523
26- private readonly Histogram < double > _diffDuration ;
27-
2824 private readonly Histogram < double > _batchDuration ;
2925 private readonly Counter < long > _batchException ;
3026
3127 public bool IsNavigationEnabled => _navigationCount . Enabled ;
3228
33- public bool IsEventDurationEnabled => _eventSyncDuration . Enabled || _eventAsyncDuration . Enabled ;
29+ public bool IsEventDurationEnabled => _eventDuration . Enabled ;
3430 public bool IsEventExceptionEnabled => _eventException . Enabled ;
3531
36- public bool IsStateDurationEnabled => _parametersSyncDuration . Enabled || _parametersAsyncDuration . Enabled ;
37- public bool IsStateExceptionEnabled => _parametersException . Enabled ;
38-
39- public bool IsDiffDurationEnabled => _diffDuration . Enabled ;
32+ public bool IsParametersDurationEnabled => _parametersDuration . Enabled ;
33+ public bool IsParametersExceptionEnabled => _parametersException . Enabled ;
4034
4135 public bool IsBatchDurationEnabled => _batchDuration . Enabled ;
4236 public bool IsBatchExceptionEnabled => _batchException . Enabled ;
@@ -52,46 +46,28 @@ public ComponentsMetrics(IMeterFactory meterFactory)
5246 unit : "{exceptions}" ,
5347 description : "Total number of route changes." ) ;
5448
55- _eventSyncDuration = _meter . CreateHistogram (
56- "aspnetcore.components.event.synchronous.duration" ,
57- unit : "s" ,
58- description : "Duration of processing browser event synchronously." ,
59- advice : new InstrumentAdvice < double > { HistogramBucketBoundaries = MetricsConstants . ShortSecondsBucketBoundaries } ) ;
60-
61- _eventAsyncDuration = _meter . CreateHistogram (
62- "aspnetcore.components.event.asynchronous.duration" ,
49+ _eventDuration = _meter . CreateHistogram (
50+ "aspnetcore.components.event.duration" ,
6351 unit : "s" ,
64- description : "Duration of processing browser event asynchronously ." ,
52+ description : "Duration of processing browser event." ,
6553 advice : new InstrumentAdvice < double > { HistogramBucketBoundaries = MetricsConstants . ShortSecondsBucketBoundaries } ) ;
6654
6755 _eventException = _meter . CreateCounter < long > (
6856 "aspnetcore.components.event.exception" ,
6957 unit : "{exceptions}" ,
7058 description : "Total number of exceptions during browser event processing." ) ;
7159
72- _parametersSyncDuration = _meter . CreateHistogram (
73- "aspnetcore.components.parameters.synchronous. duration" ,
60+ _parametersDuration = _meter . CreateHistogram (
61+ "aspnetcore.components.parameters.duration" ,
7462 unit : "s" ,
75- description : "Duration of processing component parameters synchronously." ,
76- advice : new InstrumentAdvice < double > { HistogramBucketBoundaries = MetricsConstants . ShortSecondsBucketBoundaries } ) ;
77-
78- _parametersAsyncDuration = _meter . CreateHistogram (
79- "aspnetcore.components.parameters.asynchronous.duration" ,
80- unit : "s" ,
81- description : "Duration of processing component parameters asynchronously." ,
63+ description : "Duration of processing component parameters." ,
8264 advice : new InstrumentAdvice < double > { HistogramBucketBoundaries = MetricsConstants . ShortSecondsBucketBoundaries } ) ;
8365
8466 _parametersException = _meter . CreateCounter < long > (
8567 "aspnetcore.components.parameters.exception" ,
8668 unit : "{exceptions}" ,
8769 description : "Total number of exceptions during processing component parameters." ) ;
8870
89- _diffDuration = _meter . CreateHistogram (
90- "aspnetcore.components.rendering.diff.duration" ,
91- unit : "s" ,
92- description : "Duration of rendering component HTML diff." ,
93- advice : new InstrumentAdvice < double > { HistogramBucketBoundaries = MetricsConstants . ShortSecondsBucketBoundaries } ) ;
94-
9571 _batchDuration = _meter . CreateHistogram (
9672 "aspnetcore.components.rendering.batch.duration" ,
9773 unit : "s" ,
@@ -115,19 +91,6 @@ public void Navigation(string componentType, string route)
11591 _navigationCount . Add ( 1 , tags ) ;
11692 }
11793
118- public void EventDurationSync ( long startTimestamp , string ? componentType , string ? methodName , string ? attributeName )
119- {
120- var tags = new TagList
121- {
122- { "component.type" , componentType ?? "unknown" } ,
123- { "component.method" , methodName ?? "unknown" } ,
124- { "attribute.name" , attributeName ?? "unknown" }
125- } ;
126-
127- var duration = Stopwatch . GetElapsedTime ( startTimestamp ) ;
128- _eventSyncDuration . Record ( duration . TotalSeconds , tags ) ;
129- }
130-
13194 public async Task CaptureEventDurationAsync ( Task task , long startTimestamp , string ? componentType , string ? methodName , string ? attributeName )
13295 {
13396 try
@@ -142,25 +105,14 @@ public async Task CaptureEventDurationAsync(Task task, long startTimestamp, stri
142105 } ;
143106
144107 var duration = Stopwatch . GetElapsedTime ( startTimestamp ) ;
145- _eventAsyncDuration . Record ( duration . TotalSeconds , tags ) ;
108+ _eventDuration . Record ( duration . TotalSeconds , tags ) ;
146109 }
147110 catch
148111 {
149112 // none
150113 }
151114 }
152115
153- public void ParametersDurationSync ( long startTimestamp , string ? componentType )
154- {
155- var tags = new TagList
156- {
157- { "component.type" , componentType ?? "unknown" } ,
158- } ;
159-
160- var duration = Stopwatch . GetElapsedTime ( startTimestamp ) ;
161- _parametersSyncDuration . Record ( duration . TotalSeconds , tags ) ;
162- }
163-
164116 public async Task CaptureParametersDurationAsync ( Task task , long startTimestamp , string ? componentType )
165117 {
166118 try
@@ -173,26 +125,14 @@ public async Task CaptureParametersDurationAsync(Task task, long startTimestamp,
173125 } ;
174126
175127 var duration = Stopwatch . GetElapsedTime ( startTimestamp ) ;
176- _parametersAsyncDuration . Record ( duration . TotalSeconds , tags ) ;
128+ _parametersDuration . Record ( duration . TotalSeconds , tags ) ;
177129 }
178130 catch
179131 {
180132 // none
181133 }
182134 }
183135
184- public void DiffDuration ( long startTimestamp , string ? componentType , int diffLength )
185- {
186- var tags = new TagList
187- {
188- { "component.type" , componentType ?? "unknown" } ,
189- { "diff.length.bucket" , BucketEditLength ( diffLength ) }
190- } ;
191-
192- var duration = Stopwatch . GetElapsedTime ( startTimestamp ) ;
193- _diffDuration . Record ( duration . TotalSeconds , tags ) ;
194- }
195-
196136 public void BatchDuration ( long startTimestamp , int diffLength )
197137 {
198138 var tags = new TagList
0 commit comments