Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a metric that reports the VMI last connection timestamp #11934

Merged
merged 2 commits into from
May 31, 2024

Conversation

assafad
Copy link
Contributor

@assafad assafad commented May 16, 2024

What this PR does

Add kubevirt_vmi_last_api_connection_timestamp_seconds metric, which reports the last connection timestamp per VMI. Connections covered: console, vnc, usbredir, portforward and SSH.

Fixes https://issues.redhat.com/browse/CNV-14659

Why we need it and why it was done in this way

This metric will help users to identify VMs that have not been logged into for a long time and have allocated resources but are not actually being used.

Checklist

This checklist is not enforcing, but it's a reminder of items that could be relevant to every PR.
Approvers are expected to review this list.

Release note

Add kubevirt_vmi_last_connection_timestamp_seconds metric

@kubevirt-bot
Copy link
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@kubevirt-bot kubevirt-bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. dco-signoff: no Indicates the PR's author has not DCO signed all their commits. labels May 16, 2024
@kubevirt-bot kubevirt-bot added sig/buildsystem Denotes an issue or PR that relates to changes in the build system. sig/observability Denotes an issue or PR that relates to observability. size/M labels May 16, 2024
@kubevirt-bot kubevirt-bot added dco-signoff: yes Indicates the PR's author has DCO signed all their commits. and removed dco-signoff: no Indicates the PR's author has not DCO signed all their commits. labels May 16, 2024
@assafad assafad force-pushed the vmi-connection-metric branch 3 times, most recently from faa17b4 to 804264c Compare May 16, 2024 15:04
@assafad
Copy link
Contributor Author

assafad commented May 16, 2024

/test pull-kubevirt-e2e-k8s-1.29-sig-monitoring

@victortoso
Copy link
Member

/cc

@assafad assafad marked this pull request as ready for review May 16, 2024 15:17
@kubevirt-bot kubevirt-bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 16, 2024
@kubevirt-bot kubevirt-bot requested a review from 0xFelix May 16, 2024 15:17
tests/monitoring/metrics.go Outdated Show resolved Hide resolved
pkg/monitoring/metrics/virt-api/connection_metrics.go Outdated Show resolved Hide resolved
@assafad assafad force-pushed the vmi-connection-metric branch 2 times, most recently from 4e96751 to 1bb6eaa Compare May 20, 2024 14:14
docs/metrics.md Outdated
@@ -114,6 +114,9 @@ Total VM filesystem capacity in bytes. Type: Gauge.
### kubevirt_vmi_filesystem_used_bytes
Used VM filesystem capacity in bytes. Type: Gauge.

### kubevirt_vmi_last_connection_timestamp_seconds
Virtual Machine Instance last connection timestamp, including VNC, console, portforward, SSH and usbredir connections. Type: Gauge.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that might be a little misleading. What about connections to VNC/SSH/RDP via a service or secondary interface? As it stands, this would indicate an unused VMI, although it could be accessed via the aforementioned.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sradco
Copy link
Contributor

sradco commented May 29, 2024

/lgtm

@kubevirt-bot kubevirt-bot added the lgtm Indicates that a PR is ready to be merged. label May 29, 2024
Copy link
Member

@0xFelix 0xFelix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

Thanks

@kubevirt-bot kubevirt-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 30, 2024
Bump metrics name linter to v0.0.6

Signed-off-by: assafad <aadmi@redhat.com>
@kubevirt-bot kubevirt-bot removed lgtm Indicates that a PR is ready to be merged. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels May 30, 2024
@assafad assafad force-pushed the vmi-connection-metric branch 2 times, most recently from f55f3fd to ee71e7d Compare May 30, 2024 12:10
Add kubevirt_vmi_last_connection_timestamp_seconds metric, which reports the last connection timestamp per VMI.

Signed-off-by: assafad <aadmi@redhat.com>
Copy link
Contributor

@enp0s3 enp0s3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/approve
@assafad Thank you!

@kubevirt-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: enp0s3

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubevirt-bot kubevirt-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 30, 2024
@sradco
Copy link
Contributor

sradco commented May 30, 2024

/lgtm

@kubevirt-bot kubevirt-bot added the lgtm Indicates that a PR is ready to be merged. label May 30, 2024
@kubevirt-commenter-bot
Copy link

Required labels detected, running phase 2 presubmits:
/test pull-kubevirt-e2e-windows2016
/test pull-kubevirt-e2e-kind-sriov
/test pull-kubevirt-e2e-k8s-1.30-ipv6-sig-network
/test pull-kubevirt-e2e-k8s-1.28-sig-network
/test pull-kubevirt-e2e-k8s-1.28-sig-storage
/test pull-kubevirt-e2e-k8s-1.28-sig-compute
/test pull-kubevirt-e2e-k8s-1.28-sig-operator
/test pull-kubevirt-e2e-k8s-1.29-sig-network
/test pull-kubevirt-e2e-k8s-1.29-sig-storage
/test pull-kubevirt-e2e-k8s-1.29-sig-compute
/test pull-kubevirt-e2e-k8s-1.29-sig-operator

@kubevirt-commenter-bot
Copy link

/retest-required
This bot automatically retries required jobs that failed/flaked on approved PRs.
Silence the bot with an /lgtm cancel or /hold comment for consistent failures.

1 similar comment
@kubevirt-commenter-bot
Copy link

/retest-required
This bot automatically retries required jobs that failed/flaked on approved PRs.
Silence the bot with an /lgtm cancel or /hold comment for consistent failures.

@kubevirt-bot
Copy link
Contributor

kubevirt-bot commented May 31, 2024

@assafad: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-kubevirt-check-tests-for-flakes d21cdd9 link false /test pull-kubevirt-check-tests-for-flakes

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@kubevirt-bot kubevirt-bot merged commit 081c096 into kubevirt:main May 31, 2024
38 of 40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/buildsystem Denotes an issue or PR that relates to changes in the build system. sig/observability Denotes an issue or PR that relates to observability. size/M
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants