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

feat: project actions count metric (#7929)

This commit is contained in:
Mateusz Kwasniewski 2024-08-20 09:46:39 +02:00 committed by GitHub
parent e714a7fe2b
commit 4e11e57f7f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 23 additions and 1 deletions

View File

@ -66,7 +66,7 @@ export const DeleteProjectDialogue = ({
<ul>
<li>project with all of its settings</li>
<li>all feature flags archived in it</li>
<li>all API keys scoped to only to this project</li>
<li>all API keys scoped only to this project</li>
<ConditionallyRender
condition={isEnterprise() && automatedActionsEnabled}
show={<li>all actions configured for it</li>}

View File

@ -19,6 +19,10 @@ import {
CLIENT_METRICS,
CLIENT_REGISTER,
PROJECT_ENVIRONMENT_REMOVED,
PROJECT_CREATED,
PROJECT_ARCHIVED,
PROJECT_REVIVED,
PROJECT_DELETED,
} from './types/events';
import type { IUnleashConfig } from './types/option';
import type { ISettingStore, IUnleashStores } from './types/stores';
@ -315,6 +319,12 @@ export default class MetricsMonitor {
labelNames: ['stage'],
});
const projectActionsCounter = createCounter({
name: 'project_actions_count',
help: 'Count project actions',
labelNames: ['action'],
});
const projectEnvironmentsDisabled = createCounter({
name: 'project_environments_disabled',
help: 'How many "environment disabled" events we have received for each project',
@ -851,6 +861,18 @@ export default class MetricsMonitor {
environmentType: 'n/a',
});
});
eventStore.on(PROJECT_CREATED, () => {
projectActionsCounter.labels({ action: PROJECT_CREATED }).inc();
});
eventStore.on(PROJECT_ARCHIVED, () => {
projectActionsCounter.labels({ action: PROJECT_ARCHIVED }).inc();
});
eventStore.on(PROJECT_REVIVED, () => {
projectActionsCounter.labels({ action: PROJECT_REVIVED }).inc();
});
eventStore.on(PROJECT_DELETED, () => {
projectActionsCounter.labels({ action: PROJECT_DELETED }).inc();
});
const logger = config.getLogger('metrics.ts');
eventBus.on(CLIENT_METRICS, (metrics: IClientMetricsEnv[]) => {