1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-23 00:22:19 +01:00

feat: metrics for password and scim enabled (#8730)

This commit is contained in:
Mateusz Kwasniewski 2024-11-13 10:07:06 +01:00 committed by GitHub
parent 7feba0c4d4
commit bb0403d551
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 34 additions and 0 deletions

View File

@ -219,6 +219,22 @@ export class InstanceStatsService {
return settings?.enabled || false;
}
async hasPasswordAuth(): Promise<boolean> {
const settings = await this.settingStore.get<{ disabled: boolean }>(
'unleash.auth.simple',
);
return settings?.disabled !== false;
}
async hasSCIM(): Promise<boolean> {
const settings = await this.settingStore.get<{ enabled: boolean }>(
'scim',
);
return settings?.enabled || false;
}
async getStats(): Promise<InstanceStats> {
const versionInfo = await this.versionService.getVersionInfo();
const [
@ -239,6 +255,8 @@ export class InstanceStatsService {
strategies,
SAMLenabled,
OIDCenabled,
passwordAuthEnabled,
SCIMenabled,
clientApps,
featureExports,
featureImports,
@ -265,6 +283,8 @@ export class InstanceStatsService {
this.strategiesCount(),
this.hasSAML(),
this.hasOIDC(),
this.hasPasswordAuth(),
this.hasSCIM(),
this.appCount ? this.appCount : this.getLabeledAppCounts(),
this.eventStore.deprecatedFilteredCount({
type: FEATURES_EXPORTED,

View File

@ -407,6 +407,20 @@ export function registerPrometheusMetrics(
map: (result) => ({ value: result ? 1 : 0 }),
});
dbMetrics.registerGaugeDbMetric({
name: 'password_auth',
help: 'Whether password auth is enabled',
query: () => instanceStatsService.hasPasswordAuth(),
map: (result) => ({ value: result ? 1 : 0 }),
});
dbMetrics.registerGaugeDbMetric({
name: 'scim_enabled',
help: 'Whether SCIM is enabled',
query: () => instanceStatsService.hasSCIM(),
map: (result) => ({ value: result ? 1 : 0 }),
});
const clientSdkVersionUsage = createCounter({
name: 'client_sdk_versions',
help: 'Which sdk versions are being used',