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 etcd snapshot metrics #11793

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

brandond
Copy link
Member

@brandond brandond commented Feb 14, 2025

Proposed Changes

Add etcd snapshot metrics:

# HELP k3s_etcd_snapshot_reconcile_duration_seconds Total time taken to sync the list of etcd snapshots
# HELP k3s_etcd_snapshot_reconcile_local_duration_seconds Total time taken to list local snapshot files
# HELP k3s_etcd_snapshot_reconcile_s3_duration_seconds Total time taken to list S3 snapshot files
# HELP k3s_etcd_snapshot_save_duration_seconds Total time taken to complete the etcd snapshot process
# HELP k3s_etcd_snapshot_save_local_duration_seconds Total time taken to save a local snapshot file
# HELP k3s_etcd_snapshot_save_s3_duration_seconds Total time taken to upload a snapshot file to S3

Note that the total number of ETCDSnapshotFile resources present does NOT have a metric here - that can already be queried from apiserver storage object count metrics:
apiserver_storage_objects{resource="etcdsnapshotfiles.k3s.cattle.io"} 1

Types of Changes

enhancement

Verification

Check metrics on etcd node:

brandond@dev01:~$ kubectl get --raw /metrics | grep 'etcd_snapshot_.*_count'
k3s_etcd_snapshot_reconcile_duration_seconds_count{status="success"} 9
k3s_etcd_snapshot_reconcile_local_duration_seconds_count{status="success"} 11
k3s_etcd_snapshot_reconcile_s3_duration_seconds_count{status="error"} 9
k3s_etcd_snapshot_save_duration_seconds_count{status="success"} 1
k3s_etcd_snapshot_save_local_duration_seconds_count{status="success"} 1
k3s_etcd_snapshot_save_s3_duration_seconds_count{status="error"} 1

Note that there will be no s3 metrics if s3 is not enabled.

Testing

Linked Issues

User-Facing Change

Further Comments

@brandond brandond force-pushed the etcd-snapshot-metrics branch from 5554705 to 82338d8 Compare February 14, 2025 22:04
@brandond brandond changed the title [WIP] Add etcd snapshot metrics Add etcd snapshot metrics Feb 14, 2025
@brandond brandond marked this pull request as ready for review February 14, 2025 22:13
@brandond brandond requested a review from a team as a code owner February 14, 2025 22:13
Copy link

codecov bot commented Feb 14, 2025

Codecov Report

Attention: Patch coverage is 47.91667% with 25 lines in your changes missing coverage. Please review.

Project coverage is 44.11%. Comparing base (2f787dd) to head (038c376).
Report is 3 commits behind head on master.

Files with missing lines Patch % Lines
pkg/etcd/snapshot.go 13.79% 25 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #11793      +/-   ##
==========================================
- Coverage   44.89%   44.11%   -0.78%     
==========================================
  Files         206      208       +2     
  Lines       19519    19548      +29     
==========================================
- Hits         8763     8624     -139     
- Misses       9485     9681     +196     
+ Partials     1271     1243      -28     
Flag Coverage Δ
e2etests 35.55% <39.58%> (+1.08%) ⬆️
inttests 35.07% <41.66%> (+0.07%) ⬆️
unittests 16.48% <39.58%> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@brandond brandond force-pushed the etcd-snapshot-metrics branch from 82338d8 to 6d8f551 Compare February 14, 2025 22:29
Signed-off-by: Brad Davidson <[email protected]>
@brandond brandond force-pushed the etcd-snapshot-metrics branch from 6d8f551 to 038c376 Compare February 14, 2025 22:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant