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

feat: impact metrics resolver

This commit is contained in:
kwasniew 2025-06-25 13:45:31 +02:00
parent 7c31ec71a1
commit d25b79d540
No known key found for this signature in database
GPG Key ID: 43A7CBC24C119560
2 changed files with 6 additions and 1 deletions

View File

@ -14,7 +14,7 @@ const requestLogger: (config: IUnleashConfig) => RequestHandler = (config) => {
if (enable) {
res.on('finish', () => {
const { pathname } = url.parse(req.originalUrl);
if (res.statusCode >= 400 || res.statusCode < 500) {
if (res.statusCode >= 400 && res.statusCode < 500) {
impactMetrics?.incrementCounter(CLIENT_ERROR_COUNT);
}
if (res.statusCode >= 500) {

View File

@ -6,6 +6,7 @@ import type {
IFlags,
IFlagResolver,
IFlagKey,
IImpactMetricsResolver,
} from '../types/experimental.js';
import { getDefaultVariant } from 'unleash-client/lib/variant.js';
@ -65,6 +66,10 @@ export default class FlagResolver implements IFlagResolver {
getStaticContext(): IFlagContext {
return this.externalResolver.getStaticContext();
}
get impactMetrics(): IImpactMetricsResolver | undefined {
return this.externalResolver?.impactMetrics;
}
}
export const getVariantValue = <T = string>(