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:
parent
7feba0c4d4
commit
bb0403d551
@ -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,
|
||||
|
@ -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',
|
||||
|
Loading…
Reference in New Issue
Block a user