[PR #5498] [MERGED] Fix embedded IdP metrics to count local and generic OIDC users #26012

Closed
opened 2026-08-05 07:06:46 -04:00 by saavagebueno · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/5498
Author: @braginini
Created: 3/4/2026
Status: Merged
Merged: 3/4/2026
Merged by: @braginini

Base: mainHead: fix/selfhosted-idp-metrics-report


📝 Commits (1)

  • 6d5593e Fix embedded IdP metrics to count local and generic OIDC users

📊 Changes

2 files changed (+29 additions, -11 deletions)

View changed files

📝 management/server/metrics/selfhosted.go (+5 -2)
📝 management/server/metrics/selfhosted_test.go (+24 -9)

📄 Description

Entire-Checkpoint: 39f0b252e2a9

Describe your changes

  • Fix extractIdpType to return "local" for local connector IDs instead of "oidc", and "oidc" for generic OIDC connectors (bare xid, no type prefix)

    • Include local users in embeddedIdpTypes map so embedded_idp_count and embedded_idp_users_local metrics are emitted
    • Add generic OIDC user (no-prefix connector) to test data to cover all three connector types

    What was broken

    • embedded_idp_count excluded local as a type, understating the number of configured IdP types
    • No embedded_idp_users_local metric was emitted despite local users being tracked separately
    • extractIdpType("local") would have returned "oidc" (wrong) if ever called directly

Stack

Checklist

  • Is it a bug fix
  • Is a typo/documentation fix
  • Is a feature enhancement
  • It is a refactor
  • Created tests that fail without the change (if possible)

By submitting this pull request, you confirm that you have read and agree to the terms of the Contributor License Agreement.

Documentation

Select exactly one:

  • I added/updated documentation for this change
  • Documentation is not needed for this change (explain why)

Docs PR URL (required if "docs added" is checked)

Paste the PR link from https://github.com/netbirdio/docs here:

https://github.com/netbirdio/docs/pull/__

Summary by CodeRabbit

Bug Fixes

  • Improved metrics tracking for embedded Identity Provider types in self-hosted deployments.
  • Enhanced distinction between local and OIDC identity providers in telemetry data collection.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbirdio/netbird/pull/5498 **Author:** [@braginini](https://github.com/braginini) **Created:** 3/4/2026 **Status:** ✅ Merged **Merged:** 3/4/2026 **Merged by:** [@braginini](https://github.com/braginini) **Base:** `main` ← **Head:** `fix/selfhosted-idp-metrics-report` --- ### 📝 Commits (1) - [`6d5593e`](https://github.com/netbirdio/netbird/commit/6d5593ebd74818391a0a18b284cf4ea0d5417f51) Fix embedded IdP metrics to count local and generic OIDC users ### 📊 Changes **2 files changed** (+29 additions, -11 deletions) <details> <summary>View changed files</summary> 📝 `management/server/metrics/selfhosted.go` (+5 -2) 📝 `management/server/metrics/selfhosted_test.go` (+24 -9) </details> ### 📄 Description Entire-Checkpoint: 39f0b252e2a9 ## Describe your changes - Fix extractIdpType to return "local" for local connector IDs instead of "oidc", and "oidc" for generic OIDC connectors (bare xid, no type prefix) - Include local users in embeddedIdpTypes map so embedded_idp_count and embedded_idp_users_local metrics are emitted - Add generic OIDC user (no-prefix connector) to test data to cover all three connector types What was broken - embedded_idp_count excluded local as a type, understating the number of configured IdP types - No embedded_idp_users_local metric was emitted despite local users being tracked separately - extractIdpType("local") would have returned "oidc" (wrong) if ever called directly ## Issue ticket number and link ## Stack <!-- branch-stack --> ### Checklist - [x] Is it a bug fix - [ ] Is a typo/documentation fix - [ ] Is a feature enhancement - [ ] It is a refactor - [ ] Created tests that fail without the change (if possible) > By submitting this pull request, you confirm that you have read and agree to the terms of the [Contributor License Agreement](https://github.com/netbirdio/netbird/blob/main/CONTRIBUTOR_LICENSE_AGREEMENT.md). ## Documentation Select exactly one: - [ ] I added/updated documentation for this change - [x] Documentation is **not needed** for this change (explain why) ### Docs PR URL (required if "docs added" is checked) Paste the PR link from https://github.com/netbirdio/docs here: https://github.com/netbirdio/docs/pull/__ <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Bug Fixes * Improved metrics tracking for embedded Identity Provider types in self-hosted deployments. * Enhanced distinction between local and OIDC identity providers in telemetry data collection. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
saavagebueno added the pull-request label 2026-08-05 07:06:46 -04:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DYNR/netbird#26012