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

NO-ISSUE: Ensure that hard links are accounted for when measuring disk usage #7217

Conversation

paul-maidment
Copy link
Contributor

@paul-maidment paul-maidment commented Jan 22, 2025

When we measure the disk usage for metrics, we need to ensure that hard links are accounted for as these may lead to an inaccurate count. This PR modifies the gathering of filesizes slightly to perform a stat on each file and take into account the unique inode number.

Hard links and actual files share the same inode number as this is a reference to the underlying data.

List all the issues related to this PR

  • New Feature
  • Enhancement
  • Bug fix
  • Tests
  • Documentation
  • CI/CD

What environments does this code impact?

  • Automation (CI, tools, etc)
  • Cloud
  • Operator Managed Deployments
  • None

How was this code tested?

  • assisted-test-infra environment
  • dev-scripts environment
  • Reviewer's test appreciated
  • Waiting for CI to do a full test run
  • Manual (Elaborate on how it was tested)
  • No tests needed

Checklist

  • Title and description added to both, commit and PR.
  • Relevant issues have been associated (see CONTRIBUTING guide)
  • This change does not require a documentation update (docstring, docs, README, etc)
  • Does this change include unit-tests (note that code changes require unit-tests)

Reviewers Checklist

  • Are the title and description (in both PR and commit) meaningful and clear?
  • Is there a bug required (and linked) for this change?
  • Should this PR be backported?

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Jan 22, 2025
@openshift-ci-robot
Copy link

@paul-maidment: This pull request explicitly references no jira issue.

In response to this:

…k usage.

When we measure the disk usage for metrics, we need to ensure that hard links are accounted for as these may lead to an inaccurate count. This PR modifies the gathering of filesizes slightly to perform a stat on each file and take into account the unique inode number.

Hard links and actual files share the same inode number as this is a reference to the underlying data.

List all the issues related to this PR

  • New Feature
  • Enhancement
  • Bug fix
  • Tests
  • Documentation
  • CI/CD

What environments does this code impact?

  • Automation (CI, tools, etc)
  • Cloud
  • Operator Managed Deployments
  • None

How was this code tested?

  • assisted-test-infra environment
  • dev-scripts environment
  • Reviewer's test appreciated
  • Waiting for CI to do a full test run
  • Manual (Elaborate on how it was tested)
  • No tests needed

Checklist

  • Title and description added to both, commit and PR.
  • Relevant issues have been associated (see CONTRIBUTING guide)
  • This change does not require a documentation update (docstring, docs, README, etc)
  • Does this change include unit-tests (note that code changes require unit-tests)

Reviewers Checklist

  • Are the title and description (in both PR and commit) meaningful and clear?
  • Is there a bug required (and linked) for this change?
  • Should this PR be backported?

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 openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci openshift-ci bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jan 22, 2025
@paul-maidment paul-maidment changed the title NO-ISSUE: Ensure that hard links are accounted for when measuring dis… NO-ISSUE: Ensure that hard links are accounted for when measuring disk usage Jan 22, 2025
Copy link

openshift-ci bot commented Jan 22, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: paul-maidment

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

@openshift-ci openshift-ci bot requested review from jhernand and omertuc January 22, 2025 15:53
@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 22, 2025
@paul-maidment paul-maidment force-pushed the ensure-disk-usage-based-on-seen-inodes branch from be99cc1 to 7d2be19 Compare January 22, 2025 16:36
…k usage.

When we measure the disk usage for metrics, we need to ensure that hard links are accounted for as these may lead to an inaccurate count.
This PR modifies the gathering of filesizes slightly to perform a stat on each file and take into account the unique inode number.

Hard links and actual files share the same inode number as this is a reference to the underlying data.
@paul-maidment paul-maidment force-pushed the ensure-disk-usage-based-on-seen-inodes branch from 7d2be19 to 6ac1134 Compare January 22, 2025 16:50
@rccrdpccl
Copy link
Contributor

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jan 22, 2025
Copy link

codecov bot commented Jan 22, 2025

Codecov Report

Attention: Patch coverage is 66.66667% with 2 lines in your changes missing coverage. Please review.

Project coverage is 67.89%. Comparing base (cc75f5f) to head (6ac1134).
Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
internal/metrics/disk_stats_helper.go 66.66% 1 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #7217   +/-   ##
=======================================
  Coverage   67.88%   67.89%           
=======================================
  Files         298      298           
  Lines       40666    40671    +5     
=======================================
+ Hits        27607    27612    +5     
  Misses      10588    10588           
  Partials     2471     2471           
Files with missing lines Coverage Δ
internal/metrics/disk_stats_helper.go 71.42% <66.66%> (-2.49%) ⬇️

... and 1 file with indirect coverage changes

@openshift-ci-robot
Copy link

/retest-required

Remaining retests: 0 against base HEAD cc75f5f and 2 for PR HEAD 6ac1134 in total

@paul-maidment
Copy link
Contributor Author

/retest

1 similar comment
@pastequo
Copy link
Contributor

/retest

@openshift-ci-robot
Copy link

/retest-required

Remaining retests: 0 against base HEAD 9df3014 and 2 for PR HEAD 6ac1134 in total

@paul-maidment
Copy link
Contributor Author

/test edge-subsystem-kubeapi-aws

Copy link

openshift-ci bot commented Jan 23, 2025

@paul-maidment: all tests passed!

Full PR test history. Your PR dashboard.

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.

@openshift-merge-bot openshift-merge-bot bot merged commit f8e3e31 into openshift:master Jan 23, 2025
17 checks passed
@openshift-bot
Copy link
Contributor

[ART PR BUILD NOTIFIER]

Distgit: ose-agent-installer-api-server
This PR has been included in build ose-agent-installer-api-server-container-v4.19.0-202501231608.p0.gf8e3e31.assembly.stream.el9.
All builds following this will include this PR.

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. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants