2022-04-28 10:57:52 +02:00
|
|
|
import fetch from 'make-fetch-happen';
|
2023-06-13 15:54:20 +02:00
|
|
|
import {
|
|
|
|
IContextFieldStore,
|
|
|
|
IEnvironmentStore,
|
|
|
|
IEventStore,
|
|
|
|
IFeatureStrategiesStore,
|
|
|
|
IFeatureToggleStore,
|
|
|
|
IGroupStore,
|
|
|
|
IProjectStore,
|
|
|
|
IRoleStore,
|
|
|
|
ISegmentStore,
|
|
|
|
IUnleashStores,
|
|
|
|
IUserStore,
|
|
|
|
} from '../types/stores';
|
2021-04-22 10:07:10 +02:00
|
|
|
import { IUnleashConfig } from '../types/option';
|
|
|
|
import version from '../util/version';
|
|
|
|
import { Logger } from '../logger';
|
2021-08-12 15:04:37 +02:00
|
|
|
import { ISettingStore } from '../types/stores/settings-store';
|
2021-11-02 15:13:46 +01:00
|
|
|
import { hoursToMilliseconds } from 'date-fns';
|
2023-06-13 15:54:20 +02:00
|
|
|
import { IStrategyStore } from 'lib/types';
|
|
|
|
import { FEATURES_EXPORTED, FEATURES_IMPORTED } from '../types';
|
2023-08-07 15:59:29 +02:00
|
|
|
import { CUSTOM_ROOT_ROLE_TYPE } from '../util';
|
2021-04-22 10:07:10 +02:00
|
|
|
|
|
|
|
export interface IVersionInfo {
|
|
|
|
oss: string;
|
|
|
|
enterprise?: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface IVersionHolder {
|
|
|
|
current: IVersionInfo;
|
2022-08-31 08:06:25 +02:00
|
|
|
latest: Partial<IVersionInfo>;
|
2021-04-22 10:07:10 +02:00
|
|
|
isLatest: boolean;
|
|
|
|
instanceId: string;
|
|
|
|
}
|
|
|
|
|
2022-01-23 21:26:28 +01:00
|
|
|
export interface IVersionResponse {
|
|
|
|
versions: IVersionInfo;
|
|
|
|
latest: boolean;
|
|
|
|
}
|
|
|
|
|
2023-06-13 15:54:20 +02:00
|
|
|
export interface IFeatureUsageInfo {
|
|
|
|
instanceId: string;
|
|
|
|
versionOSS: string;
|
|
|
|
versionEnterprise?: string;
|
|
|
|
users: number;
|
|
|
|
featureToggles: number;
|
|
|
|
projects: number;
|
|
|
|
contextFields: number;
|
|
|
|
roles: number;
|
2023-08-07 15:59:29 +02:00
|
|
|
customRootRoles: number;
|
2023-06-13 15:54:20 +02:00
|
|
|
featureExports: number;
|
|
|
|
featureImports: number;
|
|
|
|
groups: number;
|
|
|
|
environments: number;
|
|
|
|
segments: number;
|
|
|
|
strategies: number;
|
|
|
|
SAMLenabled: boolean;
|
|
|
|
OIDCenabled: boolean;
|
|
|
|
customStrategies: number;
|
|
|
|
customStrategiesInUse: number;
|
|
|
|
}
|
|
|
|
|
2021-04-22 10:07:10 +02:00
|
|
|
export default class VersionService {
|
|
|
|
private logger: Logger;
|
|
|
|
|
2021-08-12 15:04:37 +02:00
|
|
|
private settingStore: ISettingStore;
|
2021-04-22 10:07:10 +02:00
|
|
|
|
2023-06-13 15:54:20 +02:00
|
|
|
private strategyStore: IStrategyStore;
|
|
|
|
|
|
|
|
private userStore: IUserStore;
|
|
|
|
|
|
|
|
private featureToggleStore: IFeatureToggleStore;
|
|
|
|
|
|
|
|
private projectStore: IProjectStore;
|
|
|
|
|
|
|
|
private environmentStore: IEnvironmentStore;
|
|
|
|
|
|
|
|
private contextFieldStore: IContextFieldStore;
|
|
|
|
|
|
|
|
private groupStore: IGroupStore;
|
|
|
|
|
|
|
|
private roleStore: IRoleStore;
|
|
|
|
|
|
|
|
private segmentStore: ISegmentStore;
|
|
|
|
|
|
|
|
private eventStore: IEventStore;
|
|
|
|
|
|
|
|
private featureStrategiesStore: IFeatureStrategiesStore;
|
|
|
|
|
2021-04-22 10:07:10 +02:00
|
|
|
private current: IVersionInfo;
|
|
|
|
|
|
|
|
private latest?: IVersionInfo;
|
|
|
|
|
|
|
|
private enabled: boolean;
|
|
|
|
|
2023-06-15 15:11:58 +02:00
|
|
|
private telemetryEnabled: boolean;
|
|
|
|
|
2021-04-22 10:07:10 +02:00
|
|
|
private versionCheckUrl: string;
|
|
|
|
|
|
|
|
private instanceId?: string;
|
|
|
|
|
|
|
|
private isLatest: boolean;
|
|
|
|
|
2021-05-28 11:10:24 +02:00
|
|
|
private timer: NodeJS.Timeout;
|
|
|
|
|
2021-02-19 11:13:25 +01:00
|
|
|
constructor(
|
2023-06-13 15:54:20 +02:00
|
|
|
{
|
|
|
|
settingStore,
|
|
|
|
strategyStore,
|
|
|
|
userStore,
|
|
|
|
featureToggleStore,
|
|
|
|
projectStore,
|
|
|
|
environmentStore,
|
|
|
|
contextFieldStore,
|
|
|
|
groupStore,
|
|
|
|
roleStore,
|
|
|
|
segmentStore,
|
|
|
|
eventStore,
|
|
|
|
featureStrategiesStore,
|
|
|
|
}: Pick<
|
|
|
|
IUnleashStores,
|
|
|
|
| 'settingStore'
|
|
|
|
| 'strategyStore'
|
|
|
|
| 'userStore'
|
|
|
|
| 'featureToggleStore'
|
|
|
|
| 'projectStore'
|
|
|
|
| 'environmentStore'
|
|
|
|
| 'contextFieldStore'
|
|
|
|
| 'groupStore'
|
|
|
|
| 'roleStore'
|
|
|
|
| 'segmentStore'
|
|
|
|
| 'eventStore'
|
|
|
|
| 'featureStrategiesStore'
|
|
|
|
>,
|
2021-04-22 10:07:10 +02:00
|
|
|
{
|
|
|
|
getLogger,
|
|
|
|
versionCheck,
|
2021-04-23 11:05:25 +02:00
|
|
|
enterpriseVersion,
|
2023-06-15 15:11:58 +02:00
|
|
|
telemetry,
|
2021-04-23 11:05:25 +02:00
|
|
|
}: Pick<
|
2021-08-12 15:04:37 +02:00
|
|
|
IUnleashConfig,
|
2023-06-30 11:27:54 +02:00
|
|
|
'getLogger' | 'versionCheck' | 'enterpriseVersion' | 'telemetry'
|
2021-04-23 11:05:25 +02:00
|
|
|
>,
|
2021-02-19 11:13:25 +01:00
|
|
|
) {
|
|
|
|
this.logger = getLogger('lib/services/version-service.js');
|
|
|
|
this.settingStore = settingStore;
|
2023-06-13 15:54:20 +02:00
|
|
|
this.strategyStore = strategyStore;
|
|
|
|
this.userStore = userStore;
|
|
|
|
this.featureToggleStore = featureToggleStore;
|
|
|
|
this.projectStore = projectStore;
|
|
|
|
this.environmentStore = environmentStore;
|
|
|
|
this.contextFieldStore = contextFieldStore;
|
|
|
|
this.groupStore = groupStore;
|
|
|
|
this.roleStore = roleStore;
|
|
|
|
this.segmentStore = segmentStore;
|
|
|
|
this.eventStore = eventStore;
|
|
|
|
this.featureStrategiesStore = featureStrategiesStore;
|
2021-02-19 11:13:25 +01:00
|
|
|
this.current = {
|
|
|
|
oss: version,
|
2021-04-23 11:05:25 +02:00
|
|
|
enterprise: enterpriseVersion || '',
|
2021-02-19 11:13:25 +01:00
|
|
|
};
|
2021-04-22 10:07:10 +02:00
|
|
|
this.enabled = versionCheck.enable;
|
2023-06-15 15:11:58 +02:00
|
|
|
this.telemetryEnabled = telemetry;
|
2021-04-22 10:07:10 +02:00
|
|
|
this.versionCheckUrl = versionCheck.url;
|
|
|
|
this.isLatest = true;
|
2021-03-26 14:32:27 +01:00
|
|
|
process.nextTick(() => this.setup());
|
|
|
|
}
|
|
|
|
|
2021-04-22 10:07:10 +02:00
|
|
|
async setup(): Promise<void> {
|
2021-03-26 14:32:27 +01:00
|
|
|
await this.setInstanceId();
|
2021-04-22 10:07:10 +02:00
|
|
|
await this.checkLatestVersion();
|
2021-05-28 11:10:24 +02:00
|
|
|
this.timer = setInterval(
|
|
|
|
async () => this.checkLatestVersion(),
|
2021-11-02 15:13:46 +01:00
|
|
|
hoursToMilliseconds(48),
|
2021-05-28 11:10:24 +02:00
|
|
|
);
|
|
|
|
this.timer.unref();
|
2021-02-19 11:13:25 +01:00
|
|
|
}
|
|
|
|
|
2021-04-22 10:07:10 +02:00
|
|
|
async setInstanceId(): Promise<void> {
|
2021-03-15 08:46:03 +01:00
|
|
|
try {
|
2021-02-19 11:13:25 +01:00
|
|
|
const { id } = await this.settingStore.get('instanceInfo');
|
2021-02-22 14:21:23 +01:00
|
|
|
this.instanceId = id;
|
2021-03-15 08:46:03 +01:00
|
|
|
} catch (err) {
|
|
|
|
this.logger.warn('Could not find instanceInfo');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-04-22 10:07:10 +02:00
|
|
|
async checkLatestVersion(): Promise<void> {
|
2021-03-15 08:46:03 +01:00
|
|
|
if (this.enabled) {
|
2021-02-19 11:13:25 +01:00
|
|
|
try {
|
2023-06-13 15:54:20 +02:00
|
|
|
const versionPayload: any = {
|
|
|
|
versions: this.current,
|
|
|
|
instanceId: this.instanceId,
|
|
|
|
};
|
|
|
|
|
2023-06-30 11:27:54 +02:00
|
|
|
if (this.telemetryEnabled) {
|
2023-06-13 15:54:20 +02:00
|
|
|
const featureInfo = await this.getFeatureUsageInfo();
|
|
|
|
versionPayload.featureInfo = featureInfo;
|
|
|
|
}
|
2021-03-26 14:32:27 +01:00
|
|
|
const res = await fetch(this.versionCheckUrl, {
|
2021-02-19 11:13:25 +01:00
|
|
|
method: 'POST',
|
2023-06-13 15:54:20 +02:00
|
|
|
body: JSON.stringify(versionPayload),
|
2021-02-19 11:13:25 +01:00
|
|
|
headers: { 'Content-Type': 'application/json' },
|
2021-03-26 14:32:27 +01:00
|
|
|
});
|
|
|
|
if (res.ok) {
|
2022-01-23 21:26:28 +01:00
|
|
|
const data = (await res.json()) as IVersionResponse;
|
2021-03-26 14:32:27 +01:00
|
|
|
this.latest = {
|
|
|
|
oss: data.versions.oss,
|
|
|
|
enterprise: data.versions.enterprise,
|
|
|
|
};
|
|
|
|
this.isLatest = data.latest;
|
|
|
|
} else {
|
|
|
|
this.logger.info(
|
|
|
|
`Could not check newest version. Status: ${res.status}`,
|
|
|
|
);
|
|
|
|
}
|
2021-02-19 11:13:25 +01:00
|
|
|
} catch (err) {
|
|
|
|
this.logger.info('Could not check newest version', err);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-06-13 15:54:20 +02:00
|
|
|
async getFeatureUsageInfo(): Promise<IFeatureUsageInfo> {
|
|
|
|
const [
|
|
|
|
featureToggles,
|
|
|
|
users,
|
|
|
|
projects,
|
|
|
|
contextFields,
|
|
|
|
groups,
|
|
|
|
roles,
|
2023-08-07 15:59:29 +02:00
|
|
|
customRootRoles,
|
feat: add prom metric for total custom root roles in use (#4438)
https://linear.app/unleash/issue/2-1311/add-a-new-prometheus-metric-with-custom-root-roles-in-use
As a follow-up to https://github.com/Unleash/unleash/pull/4435, this PR
adds a metric for total custom root roles in use by at least one entity:
users, service accounts, groups.
`custom_root_roles_in_use_total`
Output from `http://localhost:4242/internal-backstage/prometheus`:
```
# HELP process_cpu_user_seconds_total Total user CPU time spent in seconds.
# TYPE process_cpu_user_seconds_total counter
process_cpu_user_seconds_total 0.060755
# HELP process_cpu_system_seconds_total Total system CPU time spent in seconds.
# TYPE process_cpu_system_seconds_total counter
process_cpu_system_seconds_total 0.01666
# HELP process_cpu_seconds_total Total user and system CPU time spent in seconds.
# TYPE process_cpu_seconds_total counter
process_cpu_seconds_total 0.077415
# HELP process_start_time_seconds Start time of the process since unix epoch in seconds.
# TYPE process_start_time_seconds gauge
process_start_time_seconds 1691420275
# HELP process_resident_memory_bytes Resident memory size in bytes.
# TYPE process_resident_memory_bytes gauge
process_resident_memory_bytes 199196672
# HELP nodejs_eventloop_lag_seconds Lag of event loop in seconds.
# TYPE nodejs_eventloop_lag_seconds gauge
nodejs_eventloop_lag_seconds 0
# HELP nodejs_eventloop_lag_min_seconds The minimum recorded event loop delay.
# TYPE nodejs_eventloop_lag_min_seconds gauge
nodejs_eventloop_lag_min_seconds 0.009076736
# HELP nodejs_eventloop_lag_max_seconds The maximum recorded event loop delay.
# TYPE nodejs_eventloop_lag_max_seconds gauge
nodejs_eventloop_lag_max_seconds 0.037683199
# HELP nodejs_eventloop_lag_mean_seconds The mean of the recorded event loop delays.
# TYPE nodejs_eventloop_lag_mean_seconds gauge
nodejs_eventloop_lag_mean_seconds 0.011063251638989169
# HELP nodejs_eventloop_lag_stddev_seconds The standard deviation of the recorded event loop delays.
# TYPE nodejs_eventloop_lag_stddev_seconds gauge
nodejs_eventloop_lag_stddev_seconds 0.0013618102764025837
# HELP nodejs_eventloop_lag_p50_seconds The 50th percentile of the recorded event loop delays.
# TYPE nodejs_eventloop_lag_p50_seconds gauge
nodejs_eventloop_lag_p50_seconds 0.011051007
# HELP nodejs_eventloop_lag_p90_seconds The 90th percentile of the recorded event loop delays.
# TYPE nodejs_eventloop_lag_p90_seconds gauge
nodejs_eventloop_lag_p90_seconds 0.011321343
# HELP nodejs_eventloop_lag_p99_seconds The 99th percentile of the recorded event loop delays.
# TYPE nodejs_eventloop_lag_p99_seconds gauge
nodejs_eventloop_lag_p99_seconds 0.013688831
# HELP nodejs_active_resources Number of active resources that are currently keeping the event loop alive, grouped by async resource type.
# TYPE nodejs_active_resources gauge
nodejs_active_resources{type="FSReqCallback"} 1
nodejs_active_resources{type="TTYWrap"} 3
nodejs_active_resources{type="TCPSocketWrap"} 5
nodejs_active_resources{type="TCPServerWrap"} 1
nodejs_active_resources{type="Timeout"} 1
nodejs_active_resources{type="Immediate"} 1
# HELP nodejs_active_resources_total Total number of active resources.
# TYPE nodejs_active_resources_total gauge
nodejs_active_resources_total 12
# HELP nodejs_active_handles Number of active libuv handles grouped by handle type. Every handle type is C++ class name.
# TYPE nodejs_active_handles gauge
nodejs_active_handles{type="WriteStream"} 2
nodejs_active_handles{type="ReadStream"} 1
nodejs_active_handles{type="Socket"} 5
nodejs_active_handles{type="Server"} 1
# HELP nodejs_active_handles_total Total number of active handles.
# TYPE nodejs_active_handles_total gauge
nodejs_active_handles_total 9
# HELP nodejs_active_requests Number of active libuv requests grouped by request type. Every request type is C++ class name.
# TYPE nodejs_active_requests gauge
nodejs_active_requests{type="FSReqCallback"} 1
# HELP nodejs_active_requests_total Total number of active requests.
# TYPE nodejs_active_requests_total gauge
nodejs_active_requests_total 1
# HELP nodejs_heap_size_total_bytes Process heap size from Node.js in bytes.
# TYPE nodejs_heap_size_total_bytes gauge
nodejs_heap_size_total_bytes 118587392
# HELP nodejs_heap_size_used_bytes Process heap size used from Node.js in bytes.
# TYPE nodejs_heap_size_used_bytes gauge
nodejs_heap_size_used_bytes 89642552
# HELP nodejs_external_memory_bytes Node.js external memory size in bytes.
# TYPE nodejs_external_memory_bytes gauge
nodejs_external_memory_bytes 1601594
# HELP nodejs_heap_space_size_total_bytes Process heap space size total from Node.js in bytes.
# TYPE nodejs_heap_space_size_total_bytes gauge
nodejs_heap_space_size_total_bytes{space="read_only"} 0
nodejs_heap_space_size_total_bytes{space="old"} 70139904
nodejs_heap_space_size_total_bytes{space="code"} 3588096
nodejs_heap_space_size_total_bytes{space="map"} 2899968
nodejs_heap_space_size_total_bytes{space="large_object"} 7258112
nodejs_heap_space_size_total_bytes{space="code_large_object"} 1146880
nodejs_heap_space_size_total_bytes{space="new_large_object"} 0
nodejs_heap_space_size_total_bytes{space="new"} 33554432
# HELP nodejs_heap_space_size_used_bytes Process heap space size used from Node.js in bytes.
# TYPE nodejs_heap_space_size_used_bytes gauge
nodejs_heap_space_size_used_bytes{space="read_only"} 0
nodejs_heap_space_size_used_bytes{space="old"} 66992120
nodejs_heap_space_size_used_bytes{space="code"} 2892640
nodejs_heap_space_size_used_bytes{space="map"} 2519280
nodejs_heap_space_size_used_bytes{space="large_object"} 7026824
nodejs_heap_space_size_used_bytes{space="code_large_object"} 983200
nodejs_heap_space_size_used_bytes{space="new_large_object"} 0
nodejs_heap_space_size_used_bytes{space="new"} 9236136
# HELP nodejs_heap_space_size_available_bytes Process heap space size available from Node.js in bytes.
# TYPE nodejs_heap_space_size_available_bytes gauge
nodejs_heap_space_size_available_bytes{space="read_only"} 0
nodejs_heap_space_size_available_bytes{space="old"} 1898360
nodejs_heap_space_size_available_bytes{space="code"} 7328
nodejs_heap_space_size_available_bytes{space="map"} 327888
nodejs_heap_space_size_available_bytes{space="large_object"} 0
nodejs_heap_space_size_available_bytes{space="code_large_object"} 0
nodejs_heap_space_size_available_bytes{space="new_large_object"} 16495616
nodejs_heap_space_size_available_bytes{space="new"} 7259480
# HELP nodejs_version_info Node.js version info.
# TYPE nodejs_version_info gauge
nodejs_version_info{version="v18.16.0",major="18",minor="16",patch="0"} 1
# HELP nodejs_gc_duration_seconds Garbage collection duration by kind, one of major, minor, incremental or weakcb.
# TYPE nodejs_gc_duration_seconds histogram
# HELP http_request_duration_milliseconds App response time
# TYPE http_request_duration_milliseconds summary
# HELP db_query_duration_seconds DB query duration time
# TYPE db_query_duration_seconds summary
db_query_duration_seconds{quantile="0.1",store="api-tokens",action="getAllActive"} 0.03091475
db_query_duration_seconds{quantile="0.5",store="api-tokens",action="getAllActive"} 0.03091475
db_query_duration_seconds{quantile="0.9",store="api-tokens",action="getAllActive"} 0.03091475
db_query_duration_seconds{quantile="0.95",store="api-tokens",action="getAllActive"} 0.03091475
db_query_duration_seconds{quantile="0.99",store="api-tokens",action="getAllActive"} 0.03091475
db_query_duration_seconds_sum{store="api-tokens",action="getAllActive"} 0.03091475
db_query_duration_seconds_count{store="api-tokens",action="getAllActive"} 1
# HELP feature_toggle_update_total Number of times a toggle has been updated. Environment label would be "n/a" when it is not available, e.g. when a feature toggle is created.
# TYPE feature_toggle_update_total counter
# HELP feature_toggle_usage_total Number of times a feature toggle has been used
# TYPE feature_toggle_usage_total counter
# HELP feature_toggles_total Number of feature toggles
# TYPE feature_toggles_total gauge
feature_toggles_total{version="5.3.0"} 31
# HELP users_total Number of users
# TYPE users_total gauge
users_total 1011
# HELP projects_total Number of projects
# TYPE projects_total gauge
projects_total 4
# HELP environments_total Number of environments
# TYPE environments_total gauge
environments_total 10
# HELP groups_total Number of groups
# TYPE groups_total gauge
groups_total 5
# HELP roles_total Number of roles
# TYPE roles_total gauge
roles_total 11
# HELP custom_root_roles_total Number of custom root roles
# TYPE custom_root_roles_total gauge
custom_root_roles_total 3
# HELP custom_root_roles_in_use_total Number of custom root roles in use
# TYPE custom_root_roles_in_use_total gauge
custom_root_roles_in_use_total 2
# HELP segments_total Number of segments
# TYPE segments_total gauge
segments_total 5
# HELP context_total Number of context
# TYPE context_total gauge
context_total 7
# HELP strategies_total Number of strategies
# TYPE strategies_total gauge
strategies_total 5
# HELP client_apps_total Number of registered client apps aggregated by range by last seen
# TYPE client_apps_total gauge
client_apps_total{range="allTime"} 0
client_apps_total{range="30d"} 0
client_apps_total{range="7d"} 0
# HELP saml_enabled Whether SAML is enabled
# TYPE saml_enabled gauge
saml_enabled 1
# HELP oidc_enabled Whether OIDC is enabled
# TYPE oidc_enabled gauge
oidc_enabled 0
# HELP client_sdk_versions Which sdk versions are being used
# TYPE client_sdk_versions counter
# HELP optimal_304_diffing Count the Optimal 304 diffing with status
# TYPE optimal_304_diffing counter
# HELP db_pool_min Minimum DB pool size
# TYPE db_pool_min gauge
db_pool_min 0
# HELP db_pool_max Maximum DB pool size
# TYPE db_pool_max gauge
db_pool_max 4
# HELP db_pool_free Current free connections in DB pool
# TYPE db_pool_free gauge
db_pool_free 0
# HELP db_pool_used Current connections in use in DB pool
# TYPE db_pool_used gauge
db_pool_used 4
# HELP db_pool_pending_creates how many asynchronous create calls are running in DB pool
# TYPE db_pool_pending_creates gauge
db_pool_pending_creates 0
# HELP db_pool_pending_acquires how many acquires are waiting for a resource to be released in DB pool
# TYPE db_pool_pending_acquires gauge
db_pool_pending_acquires 24
```
2023-08-08 09:14:40 +02:00
|
|
|
customRootRolesInUse,
|
2023-06-13 15:54:20 +02:00
|
|
|
environments,
|
|
|
|
segments,
|
|
|
|
strategies,
|
|
|
|
SAMLenabled,
|
|
|
|
OIDCenabled,
|
|
|
|
featureExports,
|
|
|
|
featureImports,
|
|
|
|
] = await Promise.all([
|
|
|
|
this.featureToggleStore.count({
|
|
|
|
archived: false,
|
|
|
|
}),
|
|
|
|
this.userStore.count(),
|
|
|
|
this.projectStore.count(),
|
|
|
|
this.contextFieldStore.count(),
|
|
|
|
this.groupStore.count(),
|
|
|
|
this.roleStore.count(),
|
2023-08-07 15:59:29 +02:00
|
|
|
this.roleStore.filteredCount({
|
|
|
|
type: CUSTOM_ROOT_ROLE_TYPE,
|
|
|
|
}),
|
feat: add prom metric for total custom root roles in use (#4438)
https://linear.app/unleash/issue/2-1311/add-a-new-prometheus-metric-with-custom-root-roles-in-use
As a follow-up to https://github.com/Unleash/unleash/pull/4435, this PR
adds a metric for total custom root roles in use by at least one entity:
users, service accounts, groups.
`custom_root_roles_in_use_total`
Output from `http://localhost:4242/internal-backstage/prometheus`:
```
# HELP process_cpu_user_seconds_total Total user CPU time spent in seconds.
# TYPE process_cpu_user_seconds_total counter
process_cpu_user_seconds_total 0.060755
# HELP process_cpu_system_seconds_total Total system CPU time spent in seconds.
# TYPE process_cpu_system_seconds_total counter
process_cpu_system_seconds_total 0.01666
# HELP process_cpu_seconds_total Total user and system CPU time spent in seconds.
# TYPE process_cpu_seconds_total counter
process_cpu_seconds_total 0.077415
# HELP process_start_time_seconds Start time of the process since unix epoch in seconds.
# TYPE process_start_time_seconds gauge
process_start_time_seconds 1691420275
# HELP process_resident_memory_bytes Resident memory size in bytes.
# TYPE process_resident_memory_bytes gauge
process_resident_memory_bytes 199196672
# HELP nodejs_eventloop_lag_seconds Lag of event loop in seconds.
# TYPE nodejs_eventloop_lag_seconds gauge
nodejs_eventloop_lag_seconds 0
# HELP nodejs_eventloop_lag_min_seconds The minimum recorded event loop delay.
# TYPE nodejs_eventloop_lag_min_seconds gauge
nodejs_eventloop_lag_min_seconds 0.009076736
# HELP nodejs_eventloop_lag_max_seconds The maximum recorded event loop delay.
# TYPE nodejs_eventloop_lag_max_seconds gauge
nodejs_eventloop_lag_max_seconds 0.037683199
# HELP nodejs_eventloop_lag_mean_seconds The mean of the recorded event loop delays.
# TYPE nodejs_eventloop_lag_mean_seconds gauge
nodejs_eventloop_lag_mean_seconds 0.011063251638989169
# HELP nodejs_eventloop_lag_stddev_seconds The standard deviation of the recorded event loop delays.
# TYPE nodejs_eventloop_lag_stddev_seconds gauge
nodejs_eventloop_lag_stddev_seconds 0.0013618102764025837
# HELP nodejs_eventloop_lag_p50_seconds The 50th percentile of the recorded event loop delays.
# TYPE nodejs_eventloop_lag_p50_seconds gauge
nodejs_eventloop_lag_p50_seconds 0.011051007
# HELP nodejs_eventloop_lag_p90_seconds The 90th percentile of the recorded event loop delays.
# TYPE nodejs_eventloop_lag_p90_seconds gauge
nodejs_eventloop_lag_p90_seconds 0.011321343
# HELP nodejs_eventloop_lag_p99_seconds The 99th percentile of the recorded event loop delays.
# TYPE nodejs_eventloop_lag_p99_seconds gauge
nodejs_eventloop_lag_p99_seconds 0.013688831
# HELP nodejs_active_resources Number of active resources that are currently keeping the event loop alive, grouped by async resource type.
# TYPE nodejs_active_resources gauge
nodejs_active_resources{type="FSReqCallback"} 1
nodejs_active_resources{type="TTYWrap"} 3
nodejs_active_resources{type="TCPSocketWrap"} 5
nodejs_active_resources{type="TCPServerWrap"} 1
nodejs_active_resources{type="Timeout"} 1
nodejs_active_resources{type="Immediate"} 1
# HELP nodejs_active_resources_total Total number of active resources.
# TYPE nodejs_active_resources_total gauge
nodejs_active_resources_total 12
# HELP nodejs_active_handles Number of active libuv handles grouped by handle type. Every handle type is C++ class name.
# TYPE nodejs_active_handles gauge
nodejs_active_handles{type="WriteStream"} 2
nodejs_active_handles{type="ReadStream"} 1
nodejs_active_handles{type="Socket"} 5
nodejs_active_handles{type="Server"} 1
# HELP nodejs_active_handles_total Total number of active handles.
# TYPE nodejs_active_handles_total gauge
nodejs_active_handles_total 9
# HELP nodejs_active_requests Number of active libuv requests grouped by request type. Every request type is C++ class name.
# TYPE nodejs_active_requests gauge
nodejs_active_requests{type="FSReqCallback"} 1
# HELP nodejs_active_requests_total Total number of active requests.
# TYPE nodejs_active_requests_total gauge
nodejs_active_requests_total 1
# HELP nodejs_heap_size_total_bytes Process heap size from Node.js in bytes.
# TYPE nodejs_heap_size_total_bytes gauge
nodejs_heap_size_total_bytes 118587392
# HELP nodejs_heap_size_used_bytes Process heap size used from Node.js in bytes.
# TYPE nodejs_heap_size_used_bytes gauge
nodejs_heap_size_used_bytes 89642552
# HELP nodejs_external_memory_bytes Node.js external memory size in bytes.
# TYPE nodejs_external_memory_bytes gauge
nodejs_external_memory_bytes 1601594
# HELP nodejs_heap_space_size_total_bytes Process heap space size total from Node.js in bytes.
# TYPE nodejs_heap_space_size_total_bytes gauge
nodejs_heap_space_size_total_bytes{space="read_only"} 0
nodejs_heap_space_size_total_bytes{space="old"} 70139904
nodejs_heap_space_size_total_bytes{space="code"} 3588096
nodejs_heap_space_size_total_bytes{space="map"} 2899968
nodejs_heap_space_size_total_bytes{space="large_object"} 7258112
nodejs_heap_space_size_total_bytes{space="code_large_object"} 1146880
nodejs_heap_space_size_total_bytes{space="new_large_object"} 0
nodejs_heap_space_size_total_bytes{space="new"} 33554432
# HELP nodejs_heap_space_size_used_bytes Process heap space size used from Node.js in bytes.
# TYPE nodejs_heap_space_size_used_bytes gauge
nodejs_heap_space_size_used_bytes{space="read_only"} 0
nodejs_heap_space_size_used_bytes{space="old"} 66992120
nodejs_heap_space_size_used_bytes{space="code"} 2892640
nodejs_heap_space_size_used_bytes{space="map"} 2519280
nodejs_heap_space_size_used_bytes{space="large_object"} 7026824
nodejs_heap_space_size_used_bytes{space="code_large_object"} 983200
nodejs_heap_space_size_used_bytes{space="new_large_object"} 0
nodejs_heap_space_size_used_bytes{space="new"} 9236136
# HELP nodejs_heap_space_size_available_bytes Process heap space size available from Node.js in bytes.
# TYPE nodejs_heap_space_size_available_bytes gauge
nodejs_heap_space_size_available_bytes{space="read_only"} 0
nodejs_heap_space_size_available_bytes{space="old"} 1898360
nodejs_heap_space_size_available_bytes{space="code"} 7328
nodejs_heap_space_size_available_bytes{space="map"} 327888
nodejs_heap_space_size_available_bytes{space="large_object"} 0
nodejs_heap_space_size_available_bytes{space="code_large_object"} 0
nodejs_heap_space_size_available_bytes{space="new_large_object"} 16495616
nodejs_heap_space_size_available_bytes{space="new"} 7259480
# HELP nodejs_version_info Node.js version info.
# TYPE nodejs_version_info gauge
nodejs_version_info{version="v18.16.0",major="18",minor="16",patch="0"} 1
# HELP nodejs_gc_duration_seconds Garbage collection duration by kind, one of major, minor, incremental or weakcb.
# TYPE nodejs_gc_duration_seconds histogram
# HELP http_request_duration_milliseconds App response time
# TYPE http_request_duration_milliseconds summary
# HELP db_query_duration_seconds DB query duration time
# TYPE db_query_duration_seconds summary
db_query_duration_seconds{quantile="0.1",store="api-tokens",action="getAllActive"} 0.03091475
db_query_duration_seconds{quantile="0.5",store="api-tokens",action="getAllActive"} 0.03091475
db_query_duration_seconds{quantile="0.9",store="api-tokens",action="getAllActive"} 0.03091475
db_query_duration_seconds{quantile="0.95",store="api-tokens",action="getAllActive"} 0.03091475
db_query_duration_seconds{quantile="0.99",store="api-tokens",action="getAllActive"} 0.03091475
db_query_duration_seconds_sum{store="api-tokens",action="getAllActive"} 0.03091475
db_query_duration_seconds_count{store="api-tokens",action="getAllActive"} 1
# HELP feature_toggle_update_total Number of times a toggle has been updated. Environment label would be "n/a" when it is not available, e.g. when a feature toggle is created.
# TYPE feature_toggle_update_total counter
# HELP feature_toggle_usage_total Number of times a feature toggle has been used
# TYPE feature_toggle_usage_total counter
# HELP feature_toggles_total Number of feature toggles
# TYPE feature_toggles_total gauge
feature_toggles_total{version="5.3.0"} 31
# HELP users_total Number of users
# TYPE users_total gauge
users_total 1011
# HELP projects_total Number of projects
# TYPE projects_total gauge
projects_total 4
# HELP environments_total Number of environments
# TYPE environments_total gauge
environments_total 10
# HELP groups_total Number of groups
# TYPE groups_total gauge
groups_total 5
# HELP roles_total Number of roles
# TYPE roles_total gauge
roles_total 11
# HELP custom_root_roles_total Number of custom root roles
# TYPE custom_root_roles_total gauge
custom_root_roles_total 3
# HELP custom_root_roles_in_use_total Number of custom root roles in use
# TYPE custom_root_roles_in_use_total gauge
custom_root_roles_in_use_total 2
# HELP segments_total Number of segments
# TYPE segments_total gauge
segments_total 5
# HELP context_total Number of context
# TYPE context_total gauge
context_total 7
# HELP strategies_total Number of strategies
# TYPE strategies_total gauge
strategies_total 5
# HELP client_apps_total Number of registered client apps aggregated by range by last seen
# TYPE client_apps_total gauge
client_apps_total{range="allTime"} 0
client_apps_total{range="30d"} 0
client_apps_total{range="7d"} 0
# HELP saml_enabled Whether SAML is enabled
# TYPE saml_enabled gauge
saml_enabled 1
# HELP oidc_enabled Whether OIDC is enabled
# TYPE oidc_enabled gauge
oidc_enabled 0
# HELP client_sdk_versions Which sdk versions are being used
# TYPE client_sdk_versions counter
# HELP optimal_304_diffing Count the Optimal 304 diffing with status
# TYPE optimal_304_diffing counter
# HELP db_pool_min Minimum DB pool size
# TYPE db_pool_min gauge
db_pool_min 0
# HELP db_pool_max Maximum DB pool size
# TYPE db_pool_max gauge
db_pool_max 4
# HELP db_pool_free Current free connections in DB pool
# TYPE db_pool_free gauge
db_pool_free 0
# HELP db_pool_used Current connections in use in DB pool
# TYPE db_pool_used gauge
db_pool_used 4
# HELP db_pool_pending_creates how many asynchronous create calls are running in DB pool
# TYPE db_pool_pending_creates gauge
db_pool_pending_creates 0
# HELP db_pool_pending_acquires how many acquires are waiting for a resource to be released in DB pool
# TYPE db_pool_pending_acquires gauge
db_pool_pending_acquires 24
```
2023-08-08 09:14:40 +02:00
|
|
|
this.roleStore.filteredCountInUse({ type: CUSTOM_ROOT_ROLE_TYPE }),
|
2023-06-13 15:54:20 +02:00
|
|
|
this.environmentStore.count(),
|
|
|
|
this.segmentStore.count(),
|
|
|
|
this.strategyStore.count(),
|
|
|
|
this.hasSAML(),
|
|
|
|
this.hasOIDC(),
|
|
|
|
this.eventStore.filteredCount({ type: FEATURES_EXPORTED }),
|
|
|
|
this.eventStore.filteredCount({ type: FEATURES_IMPORTED }),
|
|
|
|
]);
|
|
|
|
const versionInfo = this.getVersionInfo();
|
|
|
|
const customStrategies =
|
|
|
|
await this.strategyStore.getEditableStrategies();
|
|
|
|
const customStrategiesInUse =
|
|
|
|
await this.featureStrategiesStore.getCustomStrategiesInUseCount();
|
|
|
|
const featureInfo = {
|
|
|
|
featureToggles,
|
|
|
|
users,
|
|
|
|
projects,
|
|
|
|
contextFields,
|
|
|
|
groups,
|
|
|
|
roles,
|
2023-08-07 15:59:29 +02:00
|
|
|
customRootRoles,
|
feat: add prom metric for total custom root roles in use (#4438)
https://linear.app/unleash/issue/2-1311/add-a-new-prometheus-metric-with-custom-root-roles-in-use
As a follow-up to https://github.com/Unleash/unleash/pull/4435, this PR
adds a metric for total custom root roles in use by at least one entity:
users, service accounts, groups.
`custom_root_roles_in_use_total`
Output from `http://localhost:4242/internal-backstage/prometheus`:
```
# HELP process_cpu_user_seconds_total Total user CPU time spent in seconds.
# TYPE process_cpu_user_seconds_total counter
process_cpu_user_seconds_total 0.060755
# HELP process_cpu_system_seconds_total Total system CPU time spent in seconds.
# TYPE process_cpu_system_seconds_total counter
process_cpu_system_seconds_total 0.01666
# HELP process_cpu_seconds_total Total user and system CPU time spent in seconds.
# TYPE process_cpu_seconds_total counter
process_cpu_seconds_total 0.077415
# HELP process_start_time_seconds Start time of the process since unix epoch in seconds.
# TYPE process_start_time_seconds gauge
process_start_time_seconds 1691420275
# HELP process_resident_memory_bytes Resident memory size in bytes.
# TYPE process_resident_memory_bytes gauge
process_resident_memory_bytes 199196672
# HELP nodejs_eventloop_lag_seconds Lag of event loop in seconds.
# TYPE nodejs_eventloop_lag_seconds gauge
nodejs_eventloop_lag_seconds 0
# HELP nodejs_eventloop_lag_min_seconds The minimum recorded event loop delay.
# TYPE nodejs_eventloop_lag_min_seconds gauge
nodejs_eventloop_lag_min_seconds 0.009076736
# HELP nodejs_eventloop_lag_max_seconds The maximum recorded event loop delay.
# TYPE nodejs_eventloop_lag_max_seconds gauge
nodejs_eventloop_lag_max_seconds 0.037683199
# HELP nodejs_eventloop_lag_mean_seconds The mean of the recorded event loop delays.
# TYPE nodejs_eventloop_lag_mean_seconds gauge
nodejs_eventloop_lag_mean_seconds 0.011063251638989169
# HELP nodejs_eventloop_lag_stddev_seconds The standard deviation of the recorded event loop delays.
# TYPE nodejs_eventloop_lag_stddev_seconds gauge
nodejs_eventloop_lag_stddev_seconds 0.0013618102764025837
# HELP nodejs_eventloop_lag_p50_seconds The 50th percentile of the recorded event loop delays.
# TYPE nodejs_eventloop_lag_p50_seconds gauge
nodejs_eventloop_lag_p50_seconds 0.011051007
# HELP nodejs_eventloop_lag_p90_seconds The 90th percentile of the recorded event loop delays.
# TYPE nodejs_eventloop_lag_p90_seconds gauge
nodejs_eventloop_lag_p90_seconds 0.011321343
# HELP nodejs_eventloop_lag_p99_seconds The 99th percentile of the recorded event loop delays.
# TYPE nodejs_eventloop_lag_p99_seconds gauge
nodejs_eventloop_lag_p99_seconds 0.013688831
# HELP nodejs_active_resources Number of active resources that are currently keeping the event loop alive, grouped by async resource type.
# TYPE nodejs_active_resources gauge
nodejs_active_resources{type="FSReqCallback"} 1
nodejs_active_resources{type="TTYWrap"} 3
nodejs_active_resources{type="TCPSocketWrap"} 5
nodejs_active_resources{type="TCPServerWrap"} 1
nodejs_active_resources{type="Timeout"} 1
nodejs_active_resources{type="Immediate"} 1
# HELP nodejs_active_resources_total Total number of active resources.
# TYPE nodejs_active_resources_total gauge
nodejs_active_resources_total 12
# HELP nodejs_active_handles Number of active libuv handles grouped by handle type. Every handle type is C++ class name.
# TYPE nodejs_active_handles gauge
nodejs_active_handles{type="WriteStream"} 2
nodejs_active_handles{type="ReadStream"} 1
nodejs_active_handles{type="Socket"} 5
nodejs_active_handles{type="Server"} 1
# HELP nodejs_active_handles_total Total number of active handles.
# TYPE nodejs_active_handles_total gauge
nodejs_active_handles_total 9
# HELP nodejs_active_requests Number of active libuv requests grouped by request type. Every request type is C++ class name.
# TYPE nodejs_active_requests gauge
nodejs_active_requests{type="FSReqCallback"} 1
# HELP nodejs_active_requests_total Total number of active requests.
# TYPE nodejs_active_requests_total gauge
nodejs_active_requests_total 1
# HELP nodejs_heap_size_total_bytes Process heap size from Node.js in bytes.
# TYPE nodejs_heap_size_total_bytes gauge
nodejs_heap_size_total_bytes 118587392
# HELP nodejs_heap_size_used_bytes Process heap size used from Node.js in bytes.
# TYPE nodejs_heap_size_used_bytes gauge
nodejs_heap_size_used_bytes 89642552
# HELP nodejs_external_memory_bytes Node.js external memory size in bytes.
# TYPE nodejs_external_memory_bytes gauge
nodejs_external_memory_bytes 1601594
# HELP nodejs_heap_space_size_total_bytes Process heap space size total from Node.js in bytes.
# TYPE nodejs_heap_space_size_total_bytes gauge
nodejs_heap_space_size_total_bytes{space="read_only"} 0
nodejs_heap_space_size_total_bytes{space="old"} 70139904
nodejs_heap_space_size_total_bytes{space="code"} 3588096
nodejs_heap_space_size_total_bytes{space="map"} 2899968
nodejs_heap_space_size_total_bytes{space="large_object"} 7258112
nodejs_heap_space_size_total_bytes{space="code_large_object"} 1146880
nodejs_heap_space_size_total_bytes{space="new_large_object"} 0
nodejs_heap_space_size_total_bytes{space="new"} 33554432
# HELP nodejs_heap_space_size_used_bytes Process heap space size used from Node.js in bytes.
# TYPE nodejs_heap_space_size_used_bytes gauge
nodejs_heap_space_size_used_bytes{space="read_only"} 0
nodejs_heap_space_size_used_bytes{space="old"} 66992120
nodejs_heap_space_size_used_bytes{space="code"} 2892640
nodejs_heap_space_size_used_bytes{space="map"} 2519280
nodejs_heap_space_size_used_bytes{space="large_object"} 7026824
nodejs_heap_space_size_used_bytes{space="code_large_object"} 983200
nodejs_heap_space_size_used_bytes{space="new_large_object"} 0
nodejs_heap_space_size_used_bytes{space="new"} 9236136
# HELP nodejs_heap_space_size_available_bytes Process heap space size available from Node.js in bytes.
# TYPE nodejs_heap_space_size_available_bytes gauge
nodejs_heap_space_size_available_bytes{space="read_only"} 0
nodejs_heap_space_size_available_bytes{space="old"} 1898360
nodejs_heap_space_size_available_bytes{space="code"} 7328
nodejs_heap_space_size_available_bytes{space="map"} 327888
nodejs_heap_space_size_available_bytes{space="large_object"} 0
nodejs_heap_space_size_available_bytes{space="code_large_object"} 0
nodejs_heap_space_size_available_bytes{space="new_large_object"} 16495616
nodejs_heap_space_size_available_bytes{space="new"} 7259480
# HELP nodejs_version_info Node.js version info.
# TYPE nodejs_version_info gauge
nodejs_version_info{version="v18.16.0",major="18",minor="16",patch="0"} 1
# HELP nodejs_gc_duration_seconds Garbage collection duration by kind, one of major, minor, incremental or weakcb.
# TYPE nodejs_gc_duration_seconds histogram
# HELP http_request_duration_milliseconds App response time
# TYPE http_request_duration_milliseconds summary
# HELP db_query_duration_seconds DB query duration time
# TYPE db_query_duration_seconds summary
db_query_duration_seconds{quantile="0.1",store="api-tokens",action="getAllActive"} 0.03091475
db_query_duration_seconds{quantile="0.5",store="api-tokens",action="getAllActive"} 0.03091475
db_query_duration_seconds{quantile="0.9",store="api-tokens",action="getAllActive"} 0.03091475
db_query_duration_seconds{quantile="0.95",store="api-tokens",action="getAllActive"} 0.03091475
db_query_duration_seconds{quantile="0.99",store="api-tokens",action="getAllActive"} 0.03091475
db_query_duration_seconds_sum{store="api-tokens",action="getAllActive"} 0.03091475
db_query_duration_seconds_count{store="api-tokens",action="getAllActive"} 1
# HELP feature_toggle_update_total Number of times a toggle has been updated. Environment label would be "n/a" when it is not available, e.g. when a feature toggle is created.
# TYPE feature_toggle_update_total counter
# HELP feature_toggle_usage_total Number of times a feature toggle has been used
# TYPE feature_toggle_usage_total counter
# HELP feature_toggles_total Number of feature toggles
# TYPE feature_toggles_total gauge
feature_toggles_total{version="5.3.0"} 31
# HELP users_total Number of users
# TYPE users_total gauge
users_total 1011
# HELP projects_total Number of projects
# TYPE projects_total gauge
projects_total 4
# HELP environments_total Number of environments
# TYPE environments_total gauge
environments_total 10
# HELP groups_total Number of groups
# TYPE groups_total gauge
groups_total 5
# HELP roles_total Number of roles
# TYPE roles_total gauge
roles_total 11
# HELP custom_root_roles_total Number of custom root roles
# TYPE custom_root_roles_total gauge
custom_root_roles_total 3
# HELP custom_root_roles_in_use_total Number of custom root roles in use
# TYPE custom_root_roles_in_use_total gauge
custom_root_roles_in_use_total 2
# HELP segments_total Number of segments
# TYPE segments_total gauge
segments_total 5
# HELP context_total Number of context
# TYPE context_total gauge
context_total 7
# HELP strategies_total Number of strategies
# TYPE strategies_total gauge
strategies_total 5
# HELP client_apps_total Number of registered client apps aggregated by range by last seen
# TYPE client_apps_total gauge
client_apps_total{range="allTime"} 0
client_apps_total{range="30d"} 0
client_apps_total{range="7d"} 0
# HELP saml_enabled Whether SAML is enabled
# TYPE saml_enabled gauge
saml_enabled 1
# HELP oidc_enabled Whether OIDC is enabled
# TYPE oidc_enabled gauge
oidc_enabled 0
# HELP client_sdk_versions Which sdk versions are being used
# TYPE client_sdk_versions counter
# HELP optimal_304_diffing Count the Optimal 304 diffing with status
# TYPE optimal_304_diffing counter
# HELP db_pool_min Minimum DB pool size
# TYPE db_pool_min gauge
db_pool_min 0
# HELP db_pool_max Maximum DB pool size
# TYPE db_pool_max gauge
db_pool_max 4
# HELP db_pool_free Current free connections in DB pool
# TYPE db_pool_free gauge
db_pool_free 0
# HELP db_pool_used Current connections in use in DB pool
# TYPE db_pool_used gauge
db_pool_used 4
# HELP db_pool_pending_creates how many asynchronous create calls are running in DB pool
# TYPE db_pool_pending_creates gauge
db_pool_pending_creates 0
# HELP db_pool_pending_acquires how many acquires are waiting for a resource to be released in DB pool
# TYPE db_pool_pending_acquires gauge
db_pool_pending_acquires 24
```
2023-08-08 09:14:40 +02:00
|
|
|
customRootRolesInUse,
|
2023-06-13 15:54:20 +02:00
|
|
|
environments,
|
|
|
|
segments,
|
|
|
|
strategies,
|
|
|
|
SAMLenabled,
|
|
|
|
OIDCenabled,
|
|
|
|
featureExports,
|
|
|
|
featureImports,
|
|
|
|
customStrategies: customStrategies.length,
|
|
|
|
customStrategiesInUse: customStrategiesInUse,
|
|
|
|
instanceId: versionInfo.instanceId,
|
|
|
|
versionOSS: versionInfo.current.oss,
|
|
|
|
versionEnterprise: versionInfo.current.enterprise,
|
|
|
|
};
|
|
|
|
return featureInfo;
|
|
|
|
}
|
|
|
|
|
|
|
|
async hasOIDC(): Promise<boolean> {
|
|
|
|
const settings = await this.settingStore.get(
|
|
|
|
'unleash.enterprise.auth.oidc',
|
|
|
|
);
|
|
|
|
|
|
|
|
return settings?.enabled || false;
|
|
|
|
}
|
|
|
|
|
|
|
|
async hasSAML(): Promise<boolean> {
|
|
|
|
const settings = await this.settingStore.get(
|
|
|
|
'unleash.enterprise.auth.saml',
|
|
|
|
);
|
|
|
|
|
|
|
|
return settings?.enabled || false;
|
|
|
|
}
|
|
|
|
|
2021-04-22 10:07:10 +02:00
|
|
|
getVersionInfo(): IVersionHolder {
|
2021-02-19 11:13:25 +01:00
|
|
|
return {
|
|
|
|
current: this.current,
|
|
|
|
latest: this.latest || {},
|
2021-02-19 11:16:35 +01:00
|
|
|
isLatest: this.isLatest,
|
2021-02-22 14:21:23 +01:00
|
|
|
instanceId: this.instanceId,
|
2021-02-19 11:13:25 +01:00
|
|
|
};
|
|
|
|
}
|
2021-05-28 11:10:24 +02:00
|
|
|
|
|
|
|
destroy(): void {
|
|
|
|
clearInterval(this.timer);
|
|
|
|
this.timer = null;
|
|
|
|
}
|
2021-02-19 11:13:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = VersionService;
|