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

Add user_principals and auth_principals to metrics #5723

Merged
merged 4 commits into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions backend/canisters/identity/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [unreleased]

### Changed

- Add `user_principals` and `auth_principals` to metrics ([#5723](https://github.com/open-chat-labs/open-chat/pull/5723))

## [[2.0.1148](https://github.com/open-chat-labs/open-chat/releases/tag/v2.0.1148-identity)] - 2024-04-23

### Changed
Expand Down
4 changes: 4 additions & 0 deletions backend/canisters/identity/impl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ impl RuntimeState {
cycles_balance: self.env.cycles_balance(),
wasm_version: WASM_VERSION.with_borrow(|v| **v),
git_commit_id: utils::git::git_commit_id().to_string(),
user_principals: self.data.user_principals.user_principals_count(),
auth_principals: self.data.user_principals.auth_principals_count(),
legacy_principals: self.data.legacy_principals.len() as u32,
principal_migration_job_enabled: self.data.principal_migration_job_enabled,
canister_ids: CanisterIds {
Expand Down Expand Up @@ -172,6 +174,8 @@ pub struct Metrics {
pub cycles_balance: Cycles,
pub wasm_version: BuildVersion,
pub git_commit_id: String,
pub user_principals: u32,
pub auth_principals: u32,
pub legacy_principals: u32,
pub principal_migration_job_enabled: bool,
pub canister_ids: CanisterIds,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,12 @@ impl UserPrincipals {
})
})
}

pub fn user_principals_count(&self) -> u32 {
self.user_principals.len() as u32
}

pub fn auth_principals_count(&self) -> u32 {
self.auth_principals.len() as u32
}
}
Loading