Skip to content

Conversation

JamesNK
Copy link
Member

@JamesNK JamesNK commented Jul 29, 2025

Based on feedback at open-telemetry/semantic-conventions#2508

Also pluralizes the counter names which makes them more consistent with other ASP.NET Core counters.

User metrics:

  • Change aspnetcore.identity.user.create, aspnetcore.identity.user.update, aspnetcore.identity.user.delete names to have .duration suffix. Change from counters to histograms
  • Rename aspnetcore.identity.user.check_password to aspnetcore.identity.user.check_password_attempts
  • Rename aspnetcore.identity.user.verify_token to aspnetcore.identity.user.verify_token_attempts
  • Rename aspnetcore.identity.user.generate_token to aspnetcore.identity.user.generated_tokens

Sign in metrics:

  • Change aspnetcore.identity.sign_in.authenticate to aspnetcore.identity.sign_in.authenticate.duration and from counter to histogram
  • Change aspnetcore.identity.sign_in.remember_two_factor to aspnetcore.identity.sign_in.two_factor_clients_remembered
  • Change aspnetcore.identity.sign_in.forget_two_factor to aspnetcore.identity.sign_in.two_factor_clients_forgotten
  • Change aspnetcore.identity.sign_in.check_password to aspnetcore.identity.sign_in.check_password_attempts
  • Change aspnetcore.identity.sign_in.sign_in to aspnetcore.identity.sign_in.sign_ins
  • Change aspnetcore.identity.sign_in.sign_out to aspnetcore.identity.sign_in.sign_outs

Metadata:

  • Rename aspnetcore.identity.authentication_scheme to aspnetcore.authentication.scheme (shared with AuthN metrics)
  • Rename aspnetcore.identity.sign_in.is_persistent to aspnetcore.authentication.is_persistent (in case AuthN metrics also records it)

@Copilot Copilot AI review requested due to automatic review settings July 29, 2025 05:42
@github-actions github-actions bot added the area-identity Includes: Identity and providers label Jul 29, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the ASP.NET Core Identity metrics with significant naming and type changes based on user feedback. The changes focus on converting timing operations from counters to histograms with duration suffixes, and renaming several metrics for clarity and consistency.

Key changes:

  • Convert create/update/delete user operations from counters to histograms tracking duration
  • Rename metrics to be more descriptive (e.g., adding "attempts" suffix for password checks)
  • Update SignInManager metrics with better naming conventions

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/Shared/ValueStopwatch/ValueStopwatch.cs Refactored timing logic to support duration measurements
src/Identity/test/Shared/MetricsHelpers.cs Added helper method for validating duration metrics
src/Identity/test/Identity.Test/UserManagerTest.cs Updated test assertions to validate histogram duration metrics
src/Identity/test/Identity.Test/SignInManagerTest.cs Updated test metric collectors for renamed SignInManager metrics
src/Identity/Extensions.Core/src/UserUpdateType.cs Renamed UserName enum value to SetUserName
src/Identity/Extensions.Core/src/UserManagerMetrics.cs Converted counters to histograms and updated metric names
src/Identity/Extensions.Core/src/UserManager.cs Added timestamp tracking for duration measurements
src/Identity/Extensions.Core/src/Microsoft.Extensions.Identity.Core.csproj Added ValueStopwatch shared source reference
src/Identity/Core/src/SignInManagerMetrics.cs Updated SignInManager metric names and types
src/Identity/Core/src/SignInManager.cs Added timestamp tracking for authenticate duration
src/Identity/Core/src/Microsoft.AspNetCore.Identity.csproj Added ValueStopwatch shared source reference

Copy link
Member

@MackinnonBuck MackinnonBuck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@JamesNK JamesNK enabled auto-merge (squash) August 7, 2025 01:34
@JamesNK JamesNK merged commit e9d6075 into main Aug 7, 2025
29 checks passed
@JamesNK JamesNK deleted the jamesnk/metrics-feedback branch August 7, 2025 04:07
@dotnet-policy-service dotnet-policy-service bot added this to the 10.0-rc1 milestone Aug 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-identity Includes: Identity and providers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants