mirror of
https://github.com/Unleash/unleash.git
synced 2024-11-01 19:07:38 +01:00
f4bdd89a1c
### What Change /edge/metrics endpoint to accept list of ClientMetricsEnv ### Rationale We originally made the assumption that we probably didn't need to keep splitting from a map of features into ClientMetricsEnv for bulk, instead the bulk poster could post ClientMetricsEnv directly. However, Unleash still expected the old client metrics format with a dictionary of featurename -> metricsForFeature. This PR changes that to now accept the list of ClientMetricsEnv (preprocessed data from downstream) instead of expecting metrics to be in the old single application metric format.
44 lines
1022 B
TypeScript
44 lines
1022 B
TypeScript
import { dateSchema } from './date-schema';
|
|
import { FromSchema } from 'json-schema-to-ts';
|
|
|
|
export const clientMetricsEnvSchema = {
|
|
$id: '#/components/schemas/clientMetricsEnvSchema',
|
|
type: 'object',
|
|
required: ['featureName', 'appName'],
|
|
additionalProperties: true,
|
|
properties: {
|
|
featureName: {
|
|
type: 'string',
|
|
},
|
|
appName: {
|
|
type: 'string',
|
|
},
|
|
environment: {
|
|
type: 'string',
|
|
},
|
|
timestamp: {
|
|
$ref: '#/components/schemas/dateSchema',
|
|
},
|
|
yes: {
|
|
type: 'number',
|
|
},
|
|
no: {
|
|
type: 'number',
|
|
},
|
|
variants: {
|
|
type: 'object',
|
|
additionalProperties: {
|
|
type: 'integer',
|
|
minimum: 0,
|
|
},
|
|
},
|
|
},
|
|
components: {
|
|
schemas: {
|
|
dateSchema,
|
|
},
|
|
},
|
|
} as const;
|
|
|
|
export type ClientMetricsSchema = FromSchema<typeof clientMetricsEnvSchema>;
|