diff --git a/src/lib/features/instance-stats/instance-stats-service.ts b/src/lib/features/instance-stats/instance-stats-service.ts index e7d4a64f3272..04d845cc5619 100644 --- a/src/lib/features/instance-stats/instance-stats-service.ts +++ b/src/lib/features/instance-stats/instance-stats-service.ts @@ -219,6 +219,22 @@ export class InstanceStatsService { return settings?.enabled || false; } + async hasPasswordAuth(): Promise { + const settings = await this.settingStore.get<{ disabled: boolean }>( + 'unleash.auth.simple', + ); + + return settings?.disabled !== false; + } + + async hasSCIM(): Promise { + const settings = await this.settingStore.get<{ enabled: boolean }>( + 'scim', + ); + + return settings?.enabled || false; + } + async getStats(): Promise { 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, diff --git a/src/lib/metrics.ts b/src/lib/metrics.ts index 90f2e8b05c55..003c69e5d353 100644 --- a/src/lib/metrics.ts +++ b/src/lib/metrics.ts @@ -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',