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

docs: add description to requests per seconds schemas (#4182)

### What
Adds a quick and dirty description to requestPerSeconds and
segmentedRequestPerSecondsSchema so the enterprise /rps endpoint has
better API docs.

---------

Co-authored-by: Simon Hornby <liquidwicked64@gmail.com>
This commit is contained in:
Christopher Kolstad 2023-07-10 10:18:08 +02:00 committed by GitHub
parent d60e505a40
commit 4ce78ccecd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 5 deletions

View File

@ -112,7 +112,6 @@ const metaRules: Rule[] = [
'projectsSchema',
'pushVariantsSchema',
'resetPasswordSchema',
'requestsPerSecondSchema',
'sdkContextSchema',
'setUiConfigSchema',
'splashSchema',
@ -169,8 +168,6 @@ const metaRules: Rule[] = [
'playgroundStrategySchema',
'pushVariantsSchema',
'resetPasswordSchema',
'requestsPerSecondSchema',
'requestsPerSecondSegmentedSchema',
'setStrategySortOrderSchema',
'setUiConfigSchema',
'sortOrderSchema',

View File

@ -3,15 +3,25 @@ import { FromSchema } from 'json-schema-to-ts';
export const requestsPerSecondSchema = {
$id: '#/components/schemas/requestsPerSecondSchema',
type: 'object',
description:
'Statistics for usage of Unleash, formatted so it can easily be used in a graph',
properties: {
status: {
type: 'string',
description:
'Whether the query against prometheus succeeded or failed',
enum: ['success', 'failure'],
example: 'success',
},
data: {
type: 'object',
description: 'The query result from prometheus',
properties: {
resultType: {
type: 'string',
description: 'Prometheus compatible result type.',
enum: ['matrix', 'vector', 'scalar', 'string'],
example: 'vector',
},
result: {
description:
@ -19,6 +29,8 @@ export const requestsPerSecondSchema = {
type: 'array',
items: {
type: 'object',
description:
'A representation of a single metric to build a line in a graph',
properties: {
metric: {
description:
@ -26,10 +38,16 @@ export const requestsPerSecondSchema = {
type: 'object',
properties: {
appName: {
description:
'Name of the application this metric relates to',
type: 'string',
example: 'mySdk',
},
endpoint: {
description:
'Which endpoint has been accessed',
type: 'string',
example: '/api/frontend',
},
},
},
@ -39,10 +57,20 @@ export const requestsPerSecondSchema = {
type: 'array',
items: {
type: 'array',
description:
'Either the x axis represented as a number or the y axis represented as a string',
items: {
anyOf: [
{ type: 'string' },
{ type: 'number' },
{
type: 'string',
description:
'An identifier for the line in the graph',
},
{
type: 'number',
description:
'The number of requests at this point in time',
},
],
},
},

View File

@ -3,6 +3,7 @@ import { requestsPerSecondSchema } from './requests-per-second-schema';
export const requestsPerSecondSegmentedSchema = {
$id: '#/components/schemas/requestsPerSecondSegmentedSchema',
type: 'object',
description: 'Get usage metrics separated by client and admin paths',
properties: {
clientMetrics: {
$ref: '#/components/schemas/requestsPerSecondSchema',