dotnet / dotnet/aspnetcore

Add authentication failure reason to AuthN metrics

Open
#60,467 0 comments 0 reactions 0 assignees View on GitHub
area-auth
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 10h
Merged PRs (30d)
281

Description

When authentication fails, the `aspnetcore.authentication.request.duration` histogram only includes the type of the exception that resulted in the failure. This doesn't provide very useful information about _why_ authentication failed.

We should consider updating the `error.type` tag or adding a new tag (maybe `aspnetcore.authentication.failure_reason`) to specify a well-known reason why the authentication handler failed to authenticate. This tag would only apply to the `aspnetcore.authentication.request.duration` histogram.

See also: https://github.com/dotnet/aspnetcore/pull/59557#issuecomment-2593768863

Contributor guide

Open the contributing guide

Research direction

Start by locating the implementation of the aspnetcore.authentication.request.duration histogram and read the discussion in pull request 59557. Determine the agreed authentication failure reasons and whether they belong in error.type or a new tag; done means the selected tag is emitted only for this histogram with coverage for the relevant failure cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
observability
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.