dotnet / dotnet/aspnetcore

`error.type` attribute value of `http.server.request.duration` metric

Open
#51,620 5 comments 0 reactions 1 assignee Claimed by @JamesNK View on GitHub
area-networking
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 10h
Merged PRs (30d)
281

Description

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Describe the bug

The value of `error.type` attribute on `http.server.request.duration` does not take the status code in to account as per the [spec](https://github.com/open-telemetry/semantic-conventions/blob/main/docs/http/http-metrics.md#metric-httpserverrequestduration)

> If response status code was sent or received and status indicates an error according to [HTTP span status definition](https://github.com/open-telemetry/semantic-conventions/blob/main/docs/http/http-spans.md), error.type SHOULD be set to the status code number (represented as a string), an exception type (if thrown) or a component-specific error identifier.

Src link: https://github.com/dotnet/aspnetcore/blob/e497b5adb5b0a5facb02445ea6953eb6ea67ae23/src/Hosting/Hosting/src/Internal/HostingMetrics.cs#L72-L77

### Expected Behavior

`error.type` is set to Status Code value as per spec.

### Steps To Reproduce

_No response_

### Exceptions (if any)

_No response_

### .NET Version

.NET8

### Anything else?

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.