Skip to content

ScopeMetrics without InstrumentationScope causes NullReferenceException in dashboard #8970

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

Open
1 task done
WIStudent opened this issue Apr 25, 2025 · 0 comments · May be fixed by #9028
Open
1 task done

ScopeMetrics without InstrumentationScope causes NullReferenceException in dashboard #8970

WIStudent opened this issue Apr 25, 2025 · 0 comments · May be fixed by #9028
Assignees
Milestone

Comments

@WIStudent
Copy link

WIStudent commented Apr 25, 2025

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

I am using the dashboard as a standalone docker container (Aspire version: 9.1.0+2a8f48ea5811f317a26405eb315aa315cc9e3cea) and trying to push some metrics using OTLP/HTTP to /v1/metrics. The metrics are generated and pushed by the micrometer-registry-otlp library, which does not add an InstrumentationScope to the ScopeMetrics. This should be valid according to OpenTelemetry's protobuf definition

message ScopeMetrics {
  // The instrumentation scope information for the metrics in this message.
  // Semantically when InstrumentationScope isn't set, it is equivalent with
  // an empty instrumentation scope name (unknown).
  opentelemetry.proto.common.v1.InstrumentationScope scope = 1;

but causes a NullReferenceException in the Aspire dashboard:

info: Aspire.Dashboard.Otlp.Storage.TelemetryRepository[0]
      Error adding metric instrument hibernate.cache.update.timestamps.requests.
      System.NullReferenceException: Object reference not set to an instance of an object.
        at Aspire.Dashboard.Otlp.Model.OtlpApplication.AddMetrics(AddContext context, RepeatedField`1 scopeMetrics) in /_/src/Aspire.Dashboard/Otlp/Model/OtlpApplication.cs:line 62

var instrumentKey = new OtlpInstrumentKey(sm.Scope.Name, metric.Name);

does not seem to consider the case where sm.Scope can be null.

Expected Behavior

Should parse the metric without throwing an exception.

Steps To Reproduce

See above

Exceptions (if any)

System.NullReferenceException

.NET Version info

No response

Anything else?

No response

@JamesNK JamesNK self-assigned this Apr 29, 2025
@JamesNK JamesNK added this to the 9.3 milestone Apr 29, 2025
@JamesNK JamesNK linked a pull request Apr 30, 2025 that will close this issue
16 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants