mirror of
https://github.com/Unleash/unleash.git
synced 2025-07-31 13:47:02 +02:00
feat: impact metrics total requests (#10334)
This commit is contained in:
parent
902845bf82
commit
3ea30eb7a1
@ -3,6 +3,7 @@ import type { IFlagResolver } from '../../../types/index.js';
|
||||
export const FEAUTRE_LINK_COUNT = 'feature_link_count';
|
||||
export const CLIENT_ERROR_COUNT = 'client_error_count';
|
||||
export const SERVER_ERROR_COUNT = 'server_error_count';
|
||||
export const REQUEST_COUNT = 'request_count';
|
||||
export const HEAP_MEMORY_TOTAL = 'heap_memory_total';
|
||||
|
||||
export const defineImpactMetrics = (flagResolver: IFlagResolver) => {
|
||||
@ -18,6 +19,10 @@ export const defineImpactMetrics = (flagResolver: IFlagResolver) => {
|
||||
SERVER_ERROR_COUNT,
|
||||
'Count of 5xx errors',
|
||||
);
|
||||
flagResolver.impactMetrics?.defineCounter(
|
||||
REQUEST_COUNT,
|
||||
'Count of all requests',
|
||||
);
|
||||
flagResolver.impactMetrics?.defineGauge(
|
||||
HEAP_MEMORY_TOTAL,
|
||||
'Total heap memory used by the application process',
|
||||
|
@ -41,7 +41,10 @@ import {
|
||||
import type { SchedulerService } from './services/index.js';
|
||||
import type { IClientMetricsEnv } from './features/metrics/client-metrics/client-metrics-store-v2-type.js';
|
||||
import { DbMetricsMonitor } from './metrics-gauge.js';
|
||||
import { HEAP_MEMORY_TOTAL } from './features/metrics/impact/define-impact-metrics.js';
|
||||
import {
|
||||
HEAP_MEMORY_TOTAL,
|
||||
REQUEST_COUNT,
|
||||
} from './features/metrics/impact/define-impact-metrics.js';
|
||||
|
||||
export function registerPrometheusPostgresMetrics(
|
||||
db: Knex,
|
||||
@ -789,6 +792,7 @@ export function registerPrometheusMetrics(
|
||||
appName,
|
||||
})
|
||||
.observe(time);
|
||||
config.flagResolver.impactMetrics?.incrementCounter(REQUEST_COUNT);
|
||||
},
|
||||
);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user