MM-60283 Add standard response and API docs to /client_perf API (#28124)

* MM-60283 Add standard response to /client_perf API

* Add API docs for /client_perf endpoint

* Fix invalid response schema
Этот коммит содержится в:
Harrison Healey
2024-09-10 17:11:05 -04:00
коммит произвёл GitHub
родитель d5e9aa9fb3
Коммит c74f830b76
3 изменённых файлов: 105 добавлений и 0 удалений

Просмотреть файл

@@ -56,6 +56,7 @@ build-v4: node_modules playbooks
@cat $(V4_SRC)/limits.yaml >> $(V4_YAML)
@cat $(V4_SRC)/logs.yaml >> $(V4_YAML)
@cat $(V4_SRC)/outgoing_oauth_connections.yaml >> $(V4_YAML)
@cat $(V4_SRC)/metrics.yaml >> $(V4_YAML)
@if [ -r $(PLAYBOOKS_SRC)/paths.yaml ]; then cat $(PLAYBOOKS_SRC)/paths.yaml >> $(V4_YAML); fi
@if [ -r $(PLAYBOOKS_SRC)/merged-definitions.yaml ]; then cat $(PLAYBOOKS_SRC)/merged-definitions.yaml >> $(V4_YAML); else cat $(V4_SRC)/definitions.yaml >> $(V4_YAML); fi
@echo Extracting code samples

102
api/v4/source/metrics.yaml Обычный файл
Просмотреть файл

@@ -0,0 +1,102 @@
/api/v4/client_perf:
post:
summary: Report client performance metrics
description: >
Uploads client performance measurements to the server as part of the Client Performance Monitoring feature.
__Minimum server version__: 9.9.0
operationId: SubmitPerformanceReport
requestBody:
content:
application/json:
schema:
type: object
required:
- version
- start
- end
properties:
version:
type: string
description: An identifier for the schema of the data being submitted which currently must be "0.1.0"
client_id:
type: string
description: Not currently used
labels:
type: array
items:
type: string
description: Labels to be applied to all metrics when recorded by the metrics backend
start:
type: integer
format: int64
description: The time in milliseconds of the first metric in this report
end:
type: integer
format: int64
description: The time in milliseconds of the last metric in this report
counters:
type: array
items:
type: object
required:
- metric
- value
properties:
metric:
type: string
description: The name of the counter
value:
type: number
format: double
description: The value to increment the counter by
timestamp:
type: integer
format: int64
description: The time that the counter was incremented
labels:
type: array
items:
type: string
description: Labels to be applied to this metric when recorded by the metrics backend
description: An array of counter metrics to be reported
histograms:
type: array
items:
type: object
required:
- metric
- value
properties:
metric:
type: string
description: The name of the measurement
value:
type: number
format: double
description: The value of the measurement
timestamp:
type: integer
format: int64
description: The time that the measurement was taken
labels:
type: array
items:
type: string
description: Labels to be applied to this metric when recorded by the metrics backend
description: An array of histogram measurements to be reported
responses:
"200":
description: Measurements reported successfully
content:
application/json:
schema:
$ref: "#/components/schemas/StatusOK"
"400":
$ref: "#/components/responses/BadRequest"
"401":
$ref: "#/components/responses/Unauthorized"
"403":
$ref: "#/components/responses/Forbidden"
"500":
$ref: "#/components/responses/InternalServerError"

Просмотреть файл

@@ -35,4 +35,6 @@ func submitPerformanceReport(c *Context, w http.ResponseWriter, r *http.Request)
c.Err = appErr
return
}
ReturnStatusOK(w)
}