Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dashboard Metrics tab crashes on NaN values #629

Closed
eerhardt opened this issue Nov 1, 2023 · 1 comment · Fixed by #645
Closed

Dashboard Metrics tab crashes on NaN values #629

eerhardt opened this issue Nov 1, 2023 · 1 comment · Fixed by #645
Assignees

Comments

@eerhardt
Copy link
Member

eerhardt commented Nov 1, 2023

When working on #442, I ran into an issue with the prepared_ratio instrument from Npgsql. It seems this instrument can emit NaN for values, which then crash our dashboard:

warn: Microsoft.AspNetCore.Components.Server.Circuits.RemoteRenderer[100]
      Unhandled exception rendering component: .NET number values such as positive and negative infinity cannot be written as valid JSON. To make it work when using 'JsonSerializer', consider specifying 'JsonNumberHandling.AllowNamedFloatingPointLiterals' (see https://docs.microsoft.com/dotnet/api/system.text.json.serialization.jsonnumberhandling).
      System.ArgumentException: .NET number values such as positive and negative infinity cannot be written as valid JSON. To make it work when using 'JsonSerializer', consider specifying 'JsonNumberHandling.AllowNamedFloatingPointLiterals' (see https://docs.microsoft.com/dotnet/api/system.text.json.serialization.jsonnumberhandling).
         at System.Text.Json.ThrowHelper.ThrowArgumentException_ValueNotSupported()
         at System.Text.Json.Serialization.JsonCollectionConverter`2.OnTryWrite(Utf8JsonWriter writer, TCollection value, JsonSerializerOptions options, WriteStack& state)
         at System.Text.Json.Serialization.JsonConverter`1.TryWrite(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state)
         at System.Text.Json.Serialization.Metadata.JsonPropertyInfo`1.GetMemberAndWriteJson(Object obj, WriteStack& state, Utf8JsonWriter writer)
         at System.Text.Json.Serialization.Converters.ObjectDefaultConverter`1.OnTryWrite(Utf8JsonWriter writer, T value, JsonSerializerOptions options, WriteStack& state)
         at System.Text.Json.Serialization.JsonConverter`1.TryWrite(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state)
         at System.Text.Json.Serialization.Converters.ArrayConverter`2.OnWriteResume(Utf8JsonWriter writer, TElement[] array, JsonSerializerOptions options, WriteStack& state)
         at System.Text.Json.Serialization.JsonCollectionConverter`2.OnTryWrite(Utf8JsonWriter writer, TCollection value, JsonSerializerOptions options, WriteStack& state)
         at System.Text.Json.Serialization.JsonConverter`1.TryWrite(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state)
         at System.Text.Json.Serialization.JsonConverter`1.TryWriteAsObject(Utf8JsonWriter writer, Object value, JsonSerializerOptions options, WriteStack& state)
         at System.Text.Json.Serialization.JsonConverter`1.TryWrite(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state)
         at System.Text.Json.Serialization.JsonCollectionConverter`2.OnTryWrite(Utf8JsonWriter writer, TCollection value, JsonSerializerOptions options, WriteStack& state)
         at System.Text.Json.Serialization.JsonConverter`1.TryWrite(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state)
         at System.Text.Json.Serialization.JsonConverter`1.WriteCore(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state)
         at System.Text.Json.Serialization.Metadata.JsonTypeInfo`1.Serialize(Utf8JsonWriter writer, T& rootValue, Object rootValueBoxed)
         at System.Text.Json.JsonSerializer.WriteString[TValue](TValue& value, JsonTypeInfo`1 jsonTypeInfo)
         at Microsoft.JSInterop.JSRuntime.InvokeAsync[TValue](Int64 targetInstanceId, String identifier, CancellationToken cancellationToken, Object[] args)
         at Microsoft.JSInterop.JSRuntime.InvokeAsync[TValue](Int64 targetInstanceId, String identifier, Object[] args)
         at Microsoft.JSInterop.JSRuntimeExtensions.InvokeVoidAsync(IJSRuntime jsRuntime, String identifier, Object[] args)
         at Aspire.Dashboard.Components.PlotlyChart.UpdateChart(Boolean tickUpdate, DateTime inProgressDataTime) in C:\git\aspire\src\Aspire.Dashboard\Components\Controls\PlotlyChart.razor.cs:line 411
         at Aspire.Dashboard.Components.PlotlyChart.OnAfterRenderAsync(Boolean firstRender) in C:\git\aspire\src\Aspire.Dashboard\Components\Controls\PlotlyChart.razor.cs:line 61

We should ensure NaN values coming from instruments don't crash the dashboard.

When we fix this issue, we should add the prepared_ratio instrument by default. I had to disable it so users didn't crash their apps just by navigating to this instrument.

cc @JamesNK

eerhardt added a commit that referenced this issue Nov 1, 2023
Need to disable the prepared_ratio instrument until #629 is fixed.

Fix #442
eerhardt added a commit that referenced this issue Nov 1, 2023
* Allow for configuring DbContextOptions in EF Components

Fix #438

* Enable Npgsql Meter instead of using EventCounters

Need to disable the prepared_ratio instrument until #629 is fixed.

Fix #442

* Update Telemetry doc for updated Metrics
eerhardt added a commit that referenced this issue Nov 1, 2023
* Allow for configuring DbContextOptions in EF Components

Fix #438

* Enable Npgsql Meter instead of using EventCounters

Need to disable the prepared_ratio instrument until #629 is fixed.

Fix #442

* Update Telemetry doc for updated Metrics
joperezr pushed a commit that referenced this issue Nov 1, 2023
* Allow for configuring DbContextOptions in EF Components

Fix #438

* Enable Npgsql Meter instead of using EventCounters

Need to disable the prepared_ratio instrument until #629 is fixed.

Fix #442

* Update Telemetry doc for updated Metrics
@dbreshears dbreshears added this to the preview-1 week milestone Nov 2, 2023
@JamesNK
Copy link
Member

JamesNK commented Nov 2, 2023

Created an issue for npgsql: npgsql/npgsql#5369
cc @roji

Will still fix inside Aspire.

joperezr added a commit that referenced this issue Nov 14, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Apr 30, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants