Skip to content

[v13] Add Prometheus metrics to Kubernetes Access#29970

Merged
tigrato merged 2 commits intobranch/v13from
tigrato/backport-29363-branch-v13
Aug 3, 2023
Merged

[v13] Add Prometheus metrics to Kubernetes Access#29970
tigrato merged 2 commits intobranch/v13from
tigrato/backport-29363-branch-v13

Conversation

@tigrato
Copy link
Copy Markdown
Contributor

@tigrato tigrato commented Aug 3, 2023

Backport #29363 to branch/v13

tigrato added a commit that referenced this pull request Aug 3, 2023
When Kube prometheus metrics were originally introduced by #29970,
I missed to register the join sessions metrics into the prometheus
default registry. The metrics were collected but were unavailable via
`/metrics` endpoint.

Signed-off-by: Tiago Silva <tiago.silva@goteleport.com>
github-merge-queue Bot pushed a commit that referenced this pull request Aug 3, 2023
When Kube prometheus metrics were originally introduced by #29970,
I missed to register the join sessions metrics into the prometheus
default registry. The metrics were collected but were unavailable via
`/metrics` endpoint.

Signed-off-by: Tiago Silva <tiago.silva@goteleport.com>
@public-teleport-github-review-bot public-teleport-github-review-bot Bot removed the request for review from alexfornuto August 3, 2023 15:11
* Add Prometheus metrics to Kubernetes Access

This PR adds several prometheus metrics to the Kubernetes Access
package.

The new metrics are:

| Name                                                              | Type      | Component                   | Description                                                                                               |
| ----------------------------------------------------------------- | --------- | --------------------------- | --------------------------------------------------------------------------------------------------------- |
| `teleport_kubernetes_client_in_flight_requests`                   | gauge     | Teleport Kubernetes Service | In-flight requests waiting for the upstream response. |
| `teleport_kubernetes_client_requests_total`                       | counter   | Teleport Kubernetes Service | Total number of requests sent to the upstream teleport proxy, kube_service or Kubernetes Cluster servers. |
| `teleport_kubernetes_client_tls_duration_seconds`                 | histogram | Teleport Kubernetes Service | Latency distribution of TLS handshakes.                                                                   |
| `teleport_kubernetes_client_got_conn_duration_seconds`            | histogram | Teleport Kubernetes Service | Latency distribution of time to dial to the upstream server - using reversetunnel or direct dialer.       |
| `teleport_kubernetes_client_first_byte_response_duration_seconds` | histogram | Teleport Kubernetes Service | Latency distribution of time to receive the first response byte from the upstream server.                 |
| `teleport_kubernetes_client_request_duration_seconds`             | histogram | Teleport Kubernetes Service | Latency distribution of the upstream request time.                                                        |

| Name                                                        | Type      | Component                   | Description                                         |
| ----------------------------------------------------------- | --------- | --------------------------- | --------------------------------------------------- |
| `teleport_kubernetes_server_in_flight_requests`             | gauge     | Teleport Kubernetes Service | In-flight requests currently handled by the server. |
| `teleport_kubernetes_server_api_requests_total`             | counter   | Teleport Kubernetes Service | Total number of requests handled by the server.     |
| `teleport_kubernetes_server_request_duration_seconds`       | histogram | Teleport Kubernetes Service | Latency distribution of the total request time.     |
| `teleport_kubernetes_server_response_size_bytes`            | histogram | Teleport Kubernetes Service | Distribution of the response size.                  |
| `teleport_kubernetes_server_exec_in_flight_sessions`        | gauge     | Teleport Kubernetes Service | Number of active kubectl exec sessions.             |
| `teleport_kubernetes_server_exec_sessions_total`            | counter   | Teleport Kubernetes Service | Total number of kubectl exec sessions.              |
| `teleport_kubernetes_server_portforward_in_flight_sessions` | gauge     | Teleport Kubernetes Service | Number of active kubectl portforward sessions.      |
| `teleport_kubernetes_server_portforward_sessions_total`     | counter   | Teleport Kubernetes Service | Number of active kubectl portforward sessions.      |
| `teleport_kubernetes_server_join_in_flight_sessions`        | gauge     | Teleport Kubernetes Service | Number of active joining sessions,                  |
| `teleport_kubernetes_server_join_sessions_total`            | counter   | Teleport Kubernetes Service | Total number of joining sessions.                   |

Closes #29362

Signed-off-by: Tiago Silva <tiago.silva@goteleport.com>

* replace prometheus.MustRegister  with metrics.RegisterPrometheusCollectors

* Apply suggestions from code review

Co-authored-by: Alex Fornuto <alex.fornuto@goteleport.com>

---------

Signed-off-by: Tiago Silva <tiago.silva@goteleport.com>
Co-authored-by: Alex Fornuto <alex.fornuto@goteleport.com>
@tigrato tigrato force-pushed the tigrato/backport-29363-branch-v13 branch from 6bfe750 to 3a7d93d Compare August 3, 2023 15:19
@tigrato tigrato added this pull request to the merge queue Aug 3, 2023
Merged via the queue into branch/v13 with commit c9e9a2d Aug 3, 2023
@tigrato tigrato deleted the tigrato/backport-29363-branch-v13 branch August 3, 2023 16:47
@camscale camscale mentioned this pull request Aug 4, 2023
@fheinecke fheinecke mentioned this pull request Sep 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants