mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-25 00:07:47 +01:00
feat: debug metrics flag (#7108)
This commit is contained in:
parent
99403e481b
commit
ad4f269d23
@ -81,6 +81,7 @@ exports[`should create default config 1`] = `
|
|||||||
"celebrateUnleash": false,
|
"celebrateUnleash": false,
|
||||||
"collectTrafficDataUsage": false,
|
"collectTrafficDataUsage": false,
|
||||||
"createProjectWithEnvironmentConfig": false,
|
"createProjectWithEnvironmentConfig": false,
|
||||||
|
"debugMetrics": false,
|
||||||
"demo": false,
|
"demo": false,
|
||||||
"disableBulkToggle": false,
|
"disableBulkToggle": false,
|
||||||
"disableMetrics": false,
|
"disableMetrics": false,
|
||||||
|
@ -137,6 +137,10 @@ export default class ClientMetricsServiceV2 {
|
|||||||
data: ClientMetricsSchema,
|
data: ClientMetricsSchema,
|
||||||
clientIp: string,
|
clientIp: string,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
|
if (this.flagResolver.isEnabled('debugMetrics')) {
|
||||||
|
this.logger.debug(`Metrics received: ${JSON.stringify(data)}`);
|
||||||
|
}
|
||||||
|
|
||||||
const value = await clientMetricsSchema.validateAsync(data);
|
const value = await clientMetricsSchema.validateAsync(data);
|
||||||
const toggleNames = Object.keys(value.bucket.toggles).filter(
|
const toggleNames = Object.keys(value.bucket.toggles).filter(
|
||||||
(name) =>
|
(name) =>
|
||||||
|
@ -62,7 +62,8 @@ export type IFlagKey =
|
|||||||
| 'createProjectWithEnvironmentConfig'
|
| 'createProjectWithEnvironmentConfig'
|
||||||
| 'manyStrategiesPagination'
|
| 'manyStrategiesPagination'
|
||||||
| 'newCreateProjectUI'
|
| 'newCreateProjectUI'
|
||||||
| 'enableLegacyVariants';
|
| 'enableLegacyVariants'
|
||||||
|
| 'debugMetrics';
|
||||||
|
|
||||||
export type IFlags = Partial<{ [key in IFlagKey]: boolean | Variant }>;
|
export type IFlags = Partial<{ [key in IFlagKey]: boolean | Variant }>;
|
||||||
|
|
||||||
@ -299,6 +300,10 @@ const flags: IFlags = {
|
|||||||
process.env.UNLEASH_EXPERIMENTAL_ENABLE_LEGACY_VARIANTS,
|
process.env.UNLEASH_EXPERIMENTAL_ENABLE_LEGACY_VARIANTS,
|
||||||
false,
|
false,
|
||||||
),
|
),
|
||||||
|
debugMetrics: parseEnvVarBoolean(
|
||||||
|
process.env.UNLEASH_EXPERIMENTAL_DEBUG_METRICS,
|
||||||
|
false,
|
||||||
|
),
|
||||||
};
|
};
|
||||||
|
|
||||||
export const defaultExperimentalOptions: IExperimentalOptions = {
|
export const defaultExperimentalOptions: IExperimentalOptions = {
|
||||||
|
Loading…
Reference in New Issue
Block a user