Skip to content

Commit 1c61f50

Browse files
committed
feedback
1 parent 96f1d6a commit 1c61f50

File tree

5 files changed

+16
-10
lines changed

5 files changed

+16
-10
lines changed

src/Components/Components/src/ComponentsActivitySource.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ namespace Microsoft.AspNetCore.Components;
1111
internal class ComponentsActivitySource
1212
{
1313
internal const string Name = "Microsoft.AspNetCore.Components";
14-
internal const string OnCircuitName = $"{Name}.OnCircuit";
15-
internal const string OnRouteName = $"{Name}.OnRoute";
16-
internal const string OnEventName = $"{Name}.OnEvent";
14+
internal const string OnCircuitName = $"{Name}.CircuitStart";
15+
internal const string OnRouteName = $"{Name}.RouteChange";
16+
internal const string OnEventName = $"{Name}.Event";
1717

1818
private ActivityContext _httpContext;
1919
private ActivityContext _circuitContext;
@@ -146,7 +146,7 @@ public void FailCircuitActivity(Activity? activity, Exception ex)
146146
}
147147
}
148148

149-
activity.DisplayName = $"Event {attributeName ?? "[unknown]"} -> {componentType ?? "[unknown]"}.{methodName ?? "[unknown]"}";
149+
activity.DisplayName = $"Event {attributeName ?? "[unknown attribute]"} -> {componentType ?? "[unknown component]"}.{methodName ?? "[unknown method]"}";
150150
activity.Start();
151151
}
152152
return activity;

src/Components/Components/src/ComponentsMetrics.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public ComponentsMetrics(IMeterFactory meterFactory)
6464
"aspnetcore.components.update_parameters.duration",
6565
unit: "s",
6666
description: "Duration of processing component parameters.",
67-
advice: new InstrumentAdvice<double> { HistogramBucketBoundaries = MetricsConstants.ShortSecondsBucketBoundaries });
67+
advice: new InstrumentAdvice<double> { HistogramBucketBoundaries = MetricsConstants.BlazorParametersUpdateSecondsBucketBoundaries });
6868

6969
_parametersException = _lifeCycleMeter.CreateCounter<long>(
7070
"aspnetcore.components.update_parameters.exceptions",
@@ -75,7 +75,7 @@ public ComponentsMetrics(IMeterFactory meterFactory)
7575
"aspnetcore.components.rendering.batch.duration",
7676
unit: "s",
7777
description: "Duration of rendering batch.",
78-
advice: new InstrumentAdvice<double> { HistogramBucketBoundaries = MetricsConstants.ShortSecondsBucketBoundaries });
78+
advice: new InstrumentAdvice<double> { HistogramBucketBoundaries = MetricsConstants.BlazorBatchDiffSecondsBucketBoundaries });
7979

8080
_batchException = _lifeCycleMeter.CreateCounter<long>(
8181
"aspnetcore.components.rendering.batch.exceptions",
@@ -140,7 +140,7 @@ public void BatchDuration(long startTimestamp, int diffLength)
140140
{
141141
var tags = new TagList
142142
{
143-
{ "diff.length.bucket", BucketEditLength(diffLength) }
143+
{ "diff.approximate.length", BucketEditLength(diffLength) }
144144
};
145145

146146
var duration = Stopwatch.GetElapsedTime(startTimestamp);

src/Components/Components/test/ComponentsMetricsTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public void BatchDuration_RecordsDuration()
9494

9595
Assert.Single(measurements);
9696
Assert.True(measurements[0].Value > 0);
97-
Assert.Equal(50, measurements[0].Tags["diff.length.bucket"]);
97+
Assert.Equal(50, measurements[0].Tags["diff.approximate.length"]);
9898
}
9999

100100
[Fact]

src/Components/Server/src/Circuits/CircuitMetrics.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public CircuitMetrics(IMeterFactory meterFactory)
4242
"aspnetcore.components.circuits.duration",
4343
unit: "s",
4444
description: "Duration of circuit.",
45-
advice: new InstrumentAdvice<double> { HistogramBucketBoundaries = MetricsConstants.VeryLongSecondsBucketBoundaries });
45+
advice: new InstrumentAdvice<double> { HistogramBucketBoundaries = MetricsConstants.BlazorCircuitSecondsBucketBoundaries });
4646
}
4747

4848
public void OnCircuitOpened()

src/Shared/Metrics/MetricsConstants.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ internal static class MetricsConstants
1111
// Not based on a standard. Larger bucket sizes for longer lasting operations, e.g. HTTP connection duration. See https://github.com/open-telemetry/semantic-conventions/issues/336
1212
public static readonly IReadOnlyList<double> LongSecondsBucketBoundaries = [0.01, 0.02, 0.05, 0.1, 0.2, 0.5, 1, 2, 5, 10, 30, 60, 120, 300];
1313

14+
// For blazor rendering, which should be very fast.
15+
public static readonly IReadOnlyList<double> BlazorParametersUpdateSecondsBucketBoundaries = [0.000001, 0.00001, 0.0001, 0.001, 0.005, 0.01, 0.025, 0.05, 0.075, 0.1, 0.25, 0.5, 0.75, 1, 2.5, 5, 7.5, 10];
16+
17+
// For blazor rendering, which should be very fast.
18+
public static readonly IReadOnlyList<double> BlazorBatchDiffSecondsBucketBoundaries = [0.000001, 0.00001, 0.0001, 0.001, 0.01, 0.1, 1];
19+
1420
// For blazor circuit sessions, which can last a long time.
15-
public static readonly IReadOnlyList<double> VeryLongSecondsBucketBoundaries = [1, 10, 30, 1 * 60, 2 * 60, 3 * 60, 4 * 60, 5 * 60, 6 * 60, 7 * 60, 8 * 60, 9 * 60, 10 * 60, 1 * 60 * 60, 2 * 60 * 60, 3 * 60 * 60, 6 * 60 * 60, 12 * 60 * 60, 24 * 60 * 60];
21+
public static readonly IReadOnlyList<double> BlazorCircuitSecondsBucketBoundaries = [1, 3, 10, 30, 1 * 60, 3 * 60, 10 * 60, 30 * 60, 1 * 60 * 60, 3 * 60 * 60, 10 * 60 * 60, 24 * 60 * 60];
1622
}

0 commit comments

Comments
 (0)