From 5fb76b21eb589199575038e56c167e4536b61f51 Mon Sep 17 00:00:00 2001 From: Jason Stirnaman Date: Wed, 12 Jan 2022 13:11:25 -0600 Subject: [PATCH] Feat/api metrics (#3531) * fix: update UI create task instructions. (#3374) * fix: use oss update-task for cloud. Fix update-task instructions. Fix syntax. * feat(api): document /metric path. (#3527, #2567) Co-authored-by: kelseiv <47797004+kelseiv@users.noreply.github.com> --- api-docs/cloud/ref.yml | 20 +++---- api-docs/cloud/swaggerV1Compat.yml | 8 +-- api-docs/v2.1/ref.yml | 87 ++++++++++++++++++++++++++---- api-docs/v2.1/swaggerV1Compat.yml | 10 ++-- 4 files changed, 96 insertions(+), 29 deletions(-) diff --git a/api-docs/cloud/ref.yml b/api-docs/cloud/ref.yml index 4b5b0c43a..eaa8b7811 100644 --- a/api-docs/cloud/ref.yml +++ b/api-docs/cloud/ref.yml @@ -730,16 +730,16 @@ components: $ref: '#/components/schemas/Links' ColorMapping: additionalProperties: - type: int + type: string description: >- A color mapping is an object that maps time series data to a UI color scheme to allow the UI to render graphs consistent colors across reloads. example: - configcat_deployments-autopromotionblocker: 0 - measurement_birdmigration_europe: 0 - series_id_1: 0 - series_id_2: 1 + configcat_deployments-autopromotionblocker: '#663cd0' + measurement_birdmigration_europe: '#663cd0' + series_id_1: '#edf529' + series_id_2: '#edf529' type: object ColumnDataType: enum: @@ -5981,7 +5981,7 @@ components: For more information and examples, see the following: - [`/authorizations`](#tag/Authorizations) endpoint. - [Authorize API requests](/influxdb/cloud/api-guide/api_intro/#authentication). - - [Manage API tokens](/influxdb/cloud/security/tokens). + - [Manage API tokens](/influxdb/cloud/security/tokens/). in: header name: Authorization type: apiKey @@ -12236,7 +12236,7 @@ paths: InfluxDB validated the request data format and accepted the data for writing to the bucket. `204` doesn't indicate a successful write operation since writes are asynchronous. See [how to check for write - errors](https://docs.influxdata.com/influxdb/cloud/write-data/troubleshoot). + errors](https://docs.influxdata.com/influxdb/cloud/write-data/troubleshoot/). '400': content: application/json: @@ -12352,7 +12352,7 @@ paths: description: Internal server error. '503': description: >- - The server is temporarily unavailable to accept writes. The + The server is temporarily unavailable to accept writes. The `Retry-After` header describes when to try the write again. headers: Retry-After: @@ -12392,8 +12392,8 @@ tags: For more information and examples, see the following: - [Authorize API requests](/influxdb/cloud/api-guide/api_intro/#authentication). - - [Manage API tokens](/influxdb/cloud/security/tokens). - - [Assign a token to a specific user](/influxdb/cloud/security/tokens/create-token). + - [Manage API tokens](/influxdb/cloud/security/tokens/). + - [Assign a token to a specific user](/influxdb/cloud/security/tokens/create-token/). name: Authorizations - Bucket Schemas - Buckets diff --git a/api-docs/cloud/swaggerV1Compat.yml b/api-docs/cloud/swaggerV1Compat.yml index 9e7bf32b4..1a2cdaef3 100644 --- a/api-docs/cloud/swaggerV1Compat.yml +++ b/api-docs/cloud/swaggerV1Compat.yml @@ -36,13 +36,13 @@ paths: type: string required: true description: >- - Bucket to write to. If none exist a bucket will be created with - a default 3 day retention policy. + Bucket to write to. If none exists, a bucket will be created with a + default 3-day retention policy. - in: query name: rp schema: type: string - description: The retention policy name. + description: Retention policy name. - in: query name: precision schema: @@ -113,7 +113,7 @@ paths: format: int32 '503': description: >- - Server is temporarily unavailable to accept writes. The Retry-After + Server is temporarily unavailable to accept writes. The Retry-After header describes when to try the write again. headers: Retry-After: diff --git a/api-docs/v2.1/ref.yml b/api-docs/v2.1/ref.yml index dfd5070d5..3e83b7739 100644 --- a/api-docs/v2.1/ref.yml +++ b/api-docs/v2.1/ref.yml @@ -796,16 +796,16 @@ components: $ref: '#/components/schemas/Links' ColorMapping: additionalProperties: - type: int + type: string description: >- A color mapping is an object that maps time series data to a UI color scheme to allow the UI to render graphs consistent colors across reloads. example: - configcat_deployments-autopromotionblocker: 0 - measurement_birdmigration_europe: 0 - series_id_1: 0 - series_id_2: 1 + configcat_deployments-autopromotionblocker: '#663cd0' + measurement_birdmigration_europe: '#663cd0' + series_id_1: '#edf529' + series_id_2: '#edf529' type: object ConditionalExpression: description: >- @@ -8022,13 +8022,13 @@ paths: application/json: schema: $ref: '#/components/schemas/HealthCheck' - description: The instance is healthy + description: The instance is healthy. '503': content: application/json: schema: $ref: '#/components/schemas/HealthCheck' - description: The instance is unhealthy + description: The instance is unhealthy. default: $ref: '#/components/responses/ServerError' description: Unexpected error @@ -8426,6 +8426,71 @@ paths: summary: Update a password tags: - Users + /metrics: + get: + operationId: GetMetrics + parameters: + - $ref: '#/components/parameters/TraceSpan' + responses: + '200': + content: + text/plain: + examples: + expositionResponse: + summary: Metrics in plain text + value: > + # HELP go_threads Number of OS threads created. + + # TYPE go_threads gauge + + go_threads 19 + + # HELP http_api_request_duration_seconds Time taken to + respond to HTTP request + + # TYPE http_api_request_duration_seconds histogram + + http_api_request_duration_seconds_bucket{handler="platform",method="GET",path="/:fallback_path",response_code="200",status="2XX",user_agent="curl",le="0.005"} + 4 + + http_api_request_duration_seconds_bucket{handler="platform",method="GET",path="/:fallback_path",response_code="200",status="2XX",user_agent="curl",le="0.01"} + 4 + + http_api_request_duration_seconds_bucket{handler="platform",method="GET",path="/:fallback_path",response_code="200",status="2XX",user_agent="curl",le="0.025"} + 5 + schema: + externalDocs: + description: Prometheus exposition formats + url: https://prometheus.io/docs/instrumenting/exposition_formats + type: Prometheus text-based exposition + description: > + Payload body contains metrics about the InfluxDB instance. + + + Metrics are formatted in the + + Prometheus [plain-text exposition + format](https://prometheus.io/docs/instrumenting/exposition_formats). + + Each metric is identified by its name and a set of optional + key-value pairs. + + + The following descriptors precede each metric: + + + - *`HELP`*: description of the metric + + - *`TYPE`*: type of the metric (e.g. `counter`, `gauge`, + `histogram`, or `summary`) + default: + $ref: '#/components/responses/ServerError' + description: Unexpected error + servers: + - url: '' + summary: Get metrics of an instance + tags: + - Metrics /api/v2/notificationEndpoints: get: operationId: GetNotificationEndpoints @@ -12816,7 +12881,7 @@ paths: InfluxDB validated the request data format and accepted the data for writing to the bucket. `204` doesn't indicate a successful write operation since writes are asynchronous. See [how to check for write - errors](https://docs.influxdata.com/influxdb/v2.1/write-data/troubleshoot). + errors](https://docs.influxdata.com/influxdb/v2.1/write-data/troubleshoot/). '400': content: application/json: @@ -12932,7 +12997,7 @@ paths: description: Internal server error. '503': description: >- - The server is temporarily unavailable to accept writes. The + The server is temporarily unavailable to accept writes. The `Retry-After` header describes when to try the write again. headers: Retry-After: @@ -12973,7 +13038,7 @@ tags: For more information and examples, see the following: - [Authorize API requests](/influxdb/v2.1/api-guide/api_intro/#authentication). - [Manage API tokens](/influxdb/v2.1/security/tokens/). - - [Assign a token to a specific user](/influxdb/v2.1/security/tokens/create-token). + - [Assign a token to a specific user](/influxdb/v2.1/security/tokens/create-token/). name: Authorizations - Backup - Buckets @@ -12985,6 +13050,7 @@ tags: - Health - Labels - Legacy Authorizations + - Metrics - NotificationEndpoints - NotificationRules - Organizations @@ -13118,6 +13184,7 @@ x-tagGroups: - Health - Labels - Legacy Authorizations + - Metrics - NotificationEndpoints - NotificationRules - Organizations diff --git a/api-docs/v2.1/swaggerV1Compat.yml b/api-docs/v2.1/swaggerV1Compat.yml index 9c0604e70..6ebeeb9f3 100644 --- a/api-docs/v2.1/swaggerV1Compat.yml +++ b/api-docs/v2.1/swaggerV1Compat.yml @@ -36,13 +36,13 @@ paths: type: string required: true description: >- - The bucket to write to. If none exist a bucket will be created with - a default 3 day retention policy. + Bucket to write to. If none exist a bucket will be created with a + default 3 day retention policy. - in: query name: rp schema: type: string - description: The retention policy name. + description: Retention policy name. - in: query name: precision schema: @@ -185,12 +185,12 @@ paths: schema: type: string required: true - description: The bucket to query. + description: Bucket to query. - in: query name: rp schema: type: string - description: The retention policy name. + description: Retention policy name. - in: query name: q description: Defines the influxql query to run.