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

[Metrics] error.type doesn't report Exception.FullName #93302

Closed
antonfirsov opened this issue Oct 10, 2023 · 9 comments
Closed

[Metrics] error.type doesn't report Exception.FullName #93302

antonfirsov opened this issue Oct 10, 2023 · 9 comments
Assignees
Milestone

Comments

@antonfirsov
Copy link
Member

antonfirsov commented Oct 10, 2023

http.client.request.duration's error.type contains Exception.Name for cases which do not map to HttpRequestError values, which is inconsistent with aspnet's implementation that reports Exception.FullName -- see dotnet/aspnetcore#51084.

The wording of the .NET Metrics spec, is somewhat ambivalent:

When error.type attribute is reported, it contains one of HTTP Request errors, a full exception type, or a string representation of received status code.

As #93254 (comment) pointed out, this could also mean to "use HttpRequestException instead of just 'Http' or 'HttpException'". Moreover, reporting the full name doesn't bring any value, the set of exceptions we can see here is limited, collisions are not expected.

I assume this is not the case with aspnet, where exceptions may come from an arbitrarily large set. My recommendation would be to leave and document the current behaviors as-is.

@JamesNK @noahfalk we should make a decision ASAP.

@ghost ghost added the untriaged New issue has not been triaged by the area owner label Oct 10, 2023
@ghost
Copy link

ghost commented Oct 10, 2023

Tagging subscribers to this area: @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

Issue Details

http.client.request.duration's error.type contains Exception.Name for cases which do not map to HttpRequestError values, which inconsistent with aspnet's implementation that reports Exception.FullName -- see dotnet/aspnetcore#51084.

The wording of the .NET Metrics spec, is somewhat ambivalent:

When error.type attribute is reported, it contains one of HTTP Request errors, a full exception type, or a string representation of received status code.

As #93254 (comment) pointed out, this could also mean to "use HttpRequestException instead of just 'Http' or 'HttpException'". Moreover, reporting the full name doesn't bring any value, the set of exceptions we can see here is limited, collisions are not expected.

I assume this is not the case with aspnet, where exceptions may come from an arbitrarily large set. My recommendation would be to leave and document the current behaviors as-is.

@JamesNK @noahfalk we should make a decision this ASAP.

Author: antonfirsov
Assignees: -
Labels:

area-System.Net.Http

Milestone: -

@lmolkova
Copy link

No opinion here, just adding a few points:

  • changing attribute value later would NOT be breaking from OTel perspective
  • it might(?) be possible to get custom exceptions if users provide custom certificate check callback (maybe there are other cases?)

@noahfalk
Copy link
Member

My preference would be to use FullName. I recognize it doesn't provide much value in terms of error disambiguation on this metric, but I do think it could provide value for consistency across metrics. If an engineer was writing queries to process metrics from different parts of .NET it would be a simpler mental model for them if the exception names reported in error.type are always FullName rather than some metrics use Name and others use FullName.

@JamesNK
Copy link
Member

JamesNK commented Oct 10, 2023

+1 for consistency.

@antonfirsov antonfirsov added this to the 8.0.0 milestone Oct 10, 2023
@antonfirsov antonfirsov removed the untriaged New issue has not been triaged by the area owner label Oct 10, 2023
@antonfirsov
Copy link
Member Author

Ok. Gonna add this to #93254, and raise a separate PR for the HTTP part.

@MihaZupan
Copy link
Member

Are we saying FullName is the right choice here? We could also change ASP.NET to use Name to get consistency instead :)

@antonfirsov
Copy link
Member Author

@MihaZupan I considered proposing that option, but I assume ASP.NET logs FullName because they have to handle arbitrary exceptions and want to avoid ambiguity caused by name collisions. If it's not the case (unlikely), we could have a discussion whether using Name is better accross the .NET stack, and change aspnet instead, but IMO we are too late in the release cycle to carry out this discussion in an async way and implement+bacport ASP.NET changes. To avoid risking the sync-up for GA, I prefer to proceed with the current plan.

@JamesNK can you elaborate on your choice of using FullName so we have higher confidence that we are doing the right thing?

@JamesNK
Copy link
Member

JamesNK commented Oct 11, 2023

have to handle arbitrary exceptions and want to avoid ambiguity caused by name collisions

Yes. A TaskException could mean the built-in exception or a custom TaskException exception thrown from a calendar app that allows people to schedule tasks. Those exceptions would be intermingled.

error.type doesn't mention whether the exception type must be fully qualified. I'll poke the semantic conventions people to clarify the spec. I do see that exception.type does explicitly say the type should be fully qualified.

@ghost ghost added in-pr There is an active PR which will close this issue when it is merged and removed in-pr There is an active PR which will close this issue when it is merged labels Oct 12, 2023
@antonfirsov
Copy link
Member Author

antonfirsov commented Oct 16, 2023

Fixed by #93414 in release/8.0, and by #93254 in main (9.0).

@ghost ghost locked as resolved and limited conversation to collaborators Nov 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants