This commit is contained in:
iliax 2023-07-20 17:32:18 +04:00
parent 28c9871ff2
commit d6c16e2905
2 changed files with 46 additions and 146 deletions

View file

@ -3778,82 +3778,32 @@ components:
properties:
resultType:
type: string
enum: [ "matrix", "vector", "scalar", "string"]
result:
type: array
items: { }
# discriminator:
# propertyName: resultType
# mapping:
# matrix: '#/components/schemas/MatrixQueryResponse'
# vector: '#/components/schemas/InstantVectorQueryResponse'
# scalar: '#/components/schemas/ScalarQueryResponse'
# string: '#/components/schemas/StringQueryResponse'
# anyOf:
# - $ref: '#/components/schemas/MatrixQueryResponse'
# - $ref: '#/components/schemas/InstantVectorQueryResponse'
# - $ref: '#/components/schemas/ScalarQueryResponse'
# - $ref: '#/components/schemas/StringQueryResponse'
#
# MatrixQueryResponse:
# type: object
# allOf:
# - $ref: "#/components/schemas/QueryResponseData"
# properties:
# result:
# type: array
# description: |
# Format:
# [
# {
# "metric": { "<label_name>": "<label_value>", ... },
# "values": [ [ <unix_time>, "<sample_value>" ], ... ],
# "histograms": [ [ <unix_time>, <histogram> ], ... ]
# }, ...
# ]
# items: { }
#
# InstantVectorQueryResponse:
# type: object
# allOf:
# - $ref: "#/components/schemas/QueryResponseData"
# properties:
# result:
# type: array
# description: |
# Format:
# [
# {
# "metric": { "<label_name>": "<label_value>", ... },
# "value": [ <unix_time>, "<sample_value>" ],
# "histogram": [ <unix_time>, <histogram> ]
# }, ...
# ]
# items: { }
#
# ScalarQueryResponse:
# type: object
# allOf:
# - $ref: "#/components/schemas/QueryResponseData"
# properties:
# result:
# type: array
# description: |
# Format:
# [ <unix_time>, "<scalar_value>" ]
# items: { }
#
# StringQueryResponse:
# type: object
# allOf:
# - $ref: "#/components/schemas/QueryResponseData"
# properties:
# result:
# type: array
# description: |
# Format:
# [ <unix_time>, "<string_value>" ]
# items: { }
description: |
Depending on resultType format can vary:
"vector":
[
{
"metric": { "<label_name>": "<label_value>", ... },
"value": [ <unix_time>, "<sample_value>" ],
"histogram": [ <unix_time>, <histogram> ]
}, ...
]
"matrix":
[
{
"metric": { "<label_name>": "<label_value>", ... },
"values": [ [ <unix_time>, "<sample_value>" ], ... ],
"histograms": [ [ <unix_time>, <histogram> ], ... ]
}, ...
]
"scalar":
[ <unix_time>, "<scalar_value>" ]
"string":
[ <unix_time>, "<string_value>" ]
ApplicationPropertyValidation:
type: object

View file

@ -281,82 +281,32 @@ components:
properties:
resultType:
type: string
enum: [ "matrix", "vector", "scalar", "string"]
result:
type: array
items: { }
# discriminator:
# propertyName: resultType
# mapping:
# matrix: '#/components/schemas/MatrixQueryResponse'
# vector: '#/components/schemas/InstantVectorQueryResponse'
# scalar: '#/components/schemas/ScalarQueryResponse'
# string: '#/components/schemas/StringQueryResponse'
# anyOf:
# - $ref: '#/components/schemas/MatrixQueryResponse'
# - $ref: '#/components/schemas/InstantVectorQueryResponse'
# - $ref: '#/components/schemas/ScalarQueryResponse'
# - $ref: '#/components/schemas/StringQueryResponse'
# MatrixQueryResponse:
# type: object
# allOf:
# - $ref: "#/components/schemas/QueryResponseData"
# properties:
# result:
# type: array
# description: |
# Format:
# [
# {
# "metric": { "<label_name>": "<label_value>", ... },
# "values": [ [ <unix_time>, "<sample_value>" ], ... ],
# "histograms": [ [ <unix_time>, <histogram> ], ... ]
# }, ...
# ]
# items: { }
#
# InstantVectorQueryResponse:
# type: object
# allOf:
# - $ref: "#/components/schemas/QueryResponseData"
# properties:
# result:
# type: array
# description: |
# Format:
# [
# {
# "metric": { "<label_name>": "<label_value>", ... },
# "value": [ <unix_time>, "<sample_value>" ],
# "histogram": [ <unix_time>, <histogram> ]
# }, ...
# ]
# items: { }
#
# ScalarQueryResponse:
# type: object
# allOf:
# - $ref: "#/components/schemas/QueryResponseData"
# properties:
# result:
# type: array
# description: |
# Format:
# [ <unix_time>, "<scalar_value>" ]
# items: { }
#
# StringQueryResponse:
# type: object
# allOf:
# - $ref: "#/components/schemas/QueryResponseData"
# properties:
# result:
# type: array
# description: |
# Format:
# [ <unix_time>, "<string_value>" ]
# items: { }
description: |
Depending on resultType format can vary:
"vector":
[
{
"metric": { "<label_name>": "<label_value>", ... },
"value": [ <unix_time>, "<sample_value>" ],
"histogram": [ <unix_time>, <histogram> ]
}, ...
]
"matrix":
[
{
"metric": { "<label_name>": "<label_value>", ... },
"values": [ [ <unix_time>, "<sample_value>" ], ... ],
"histograms": [ [ <unix_time>, <histogram> ], ... ]
}, ...
]
"scalar":
[ <unix_time>, "<scalar_value>" ]
"string":
[ <unix_time>, "<string_value>" ]
SeriesResponse:
type: object