2023-03-01 13:08:08 +01:00
|
|
|
import { dateSchema } from './date-schema';
|
|
|
|
import { FromSchema } from 'json-schema-to-ts';
|
|
|
|
|
|
|
|
export const clientMetricsEnvSchema = {
|
|
|
|
$id: '#/components/schemas/clientMetricsEnvSchema',
|
|
|
|
type: 'object',
|
2023-04-14 15:39:39 +02:00
|
|
|
required: ['featureName', 'appName', 'environment'],
|
2023-03-01 13:08:08 +01:00
|
|
|
additionalProperties: true,
|
2023-04-14 15:39:39 +02:00
|
|
|
description: 'Used for reporting feature evaluation results from SDKs',
|
2023-03-01 13:08:08 +01:00
|
|
|
properties: {
|
|
|
|
featureName: {
|
|
|
|
type: 'string',
|
2023-04-14 15:39:39 +02:00
|
|
|
description: 'Name of the feature checked by the SDK',
|
|
|
|
example: 'my.special.feature',
|
2023-03-01 13:08:08 +01:00
|
|
|
},
|
|
|
|
appName: {
|
2023-04-14 15:39:39 +02:00
|
|
|
description: 'The name of the application the SDK is being used in',
|
2023-03-01 13:08:08 +01:00
|
|
|
type: 'string',
|
2023-04-14 15:39:39 +02:00
|
|
|
example: 'accounting',
|
2023-03-01 13:08:08 +01:00
|
|
|
},
|
|
|
|
environment: {
|
2023-04-14 15:39:39 +02:00
|
|
|
description: 'Which environment the SDK is being used in',
|
2023-03-01 13:08:08 +01:00
|
|
|
type: 'string',
|
2023-04-14 15:39:39 +02:00
|
|
|
example: 'development',
|
2023-03-01 13:08:08 +01:00
|
|
|
},
|
|
|
|
timestamp: {
|
2023-04-14 15:39:39 +02:00
|
|
|
description:
|
|
|
|
'The start of the time window these metrics are valid for. The window is 1 hour wide',
|
|
|
|
example: '1926-05-08T12:00:00.000Z',
|
2023-03-01 13:08:08 +01:00
|
|
|
$ref: '#/components/schemas/dateSchema',
|
|
|
|
},
|
|
|
|
yes: {
|
2023-04-14 15:39:39 +02:00
|
|
|
description: 'How many times the toggle evaluated to true',
|
2023-03-01 13:08:08 +01:00
|
|
|
type: 'number',
|
2023-04-14 15:39:39 +02:00
|
|
|
example: 974,
|
2023-03-01 13:08:08 +01:00
|
|
|
},
|
|
|
|
no: {
|
2023-04-14 15:39:39 +02:00
|
|
|
description: 'How many times the toggle evaluated to false',
|
2023-03-01 13:08:08 +01:00
|
|
|
type: 'number',
|
2023-04-14 15:39:39 +02:00
|
|
|
example: 50,
|
2023-03-01 13:08:08 +01:00
|
|
|
},
|
|
|
|
variants: {
|
2023-04-14 15:39:39 +02:00
|
|
|
description: 'How many times each variant was returned',
|
2023-03-01 13:08:08 +01:00
|
|
|
type: 'object',
|
|
|
|
additionalProperties: {
|
|
|
|
type: 'integer',
|
|
|
|
minimum: 0,
|
|
|
|
},
|
2023-04-14 15:39:39 +02:00
|
|
|
example: {
|
|
|
|
variantA: 15,
|
|
|
|
variantB: 25,
|
|
|
|
variantC: 5,
|
|
|
|
},
|
2023-03-01 13:08:08 +01:00
|
|
|
},
|
|
|
|
},
|
|
|
|
components: {
|
|
|
|
schemas: {
|
|
|
|
dateSchema,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
} as const;
|
|
|
|
|
|
|
|
export type ClientMetricsSchema = FromSchema<typeof clientMetricsEnvSchema>;
|