Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@pdf
Copy link
Contributor

@pdf pdf commented Dec 18, 2022

Signed-off-by: Peter Fern [email protected]

What type of PR is this?

/kind bug

What this PR does / why we need it:

As discussed in #6418 this change reduces cardinality of the seccomp notifier metrics by adjusting the metric output format.

Which issue(s) this PR fixes:

Fixes #6422

Special notes for your reviewer:

I wasn't able to sort out running the test suite locally in time for release, marking as WIP here to make use of the CI test runners.

Does this PR introduce a user-facing change?

This change does modify the metric output format, however the previous metrics have not been included in any prior release.

None

@openshift-ci openshift-ci bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note-none Denotes a PR that doesn't merit a release note. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. kind/bug Categorizes issue or PR as related to a bug. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Dec 18, 2022
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Dec 18, 2022

Hi @pdf. Thanks for your PR.

I'm waiting for a cri-o member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

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/test-infra repository.

}

metrics.Instance().MetricContainersSeccompNotifierCountTotalInc(ctr.Name(), usedSyscalls)
metrics.Instance().MetricContainersSeccompNotifierCountTotalInc(ctr.Name(), syscall)
Copy link
Member

Choose a reason for hiding this comment

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

above we pull notifier.UsedSyscallswhich got use usedSyscalls. I don't see us finding all of the syscalls that were reported. shouldn't we call this function for each syscall?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is called in a loop, every time a seccomp notification arrives on the channel:

cri-o/server/server.go

Lines 746 to 750 in 093d680

for {
msg := <-s.seccompNotifierChan
ctx := msg.Ctx()
id := msg.ContainerID()
syscall := msg.Syscall()

usedSyscalls accumulates syscalls from each iteration in the same loop:

notifier.AddSyscall(syscall)

So we do call the function for each syscall - we just incr the metric count for the specific syscall name received each iteration, ie:

iteration msg.Syscall() metric values
0 swapoff {name="...", syscall="swapoff"} = 1
1 swapoff {name="...", syscall="swapoff"} = 2
2 chroot {name="...", syscall="swapoff"} = 2, {name="...", syscall="chroot"} = 1

@haircommander
Copy link
Member

/ok-to-test

@openshift-ci openshift-ci bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Dec 19, 2022
@codecov
Copy link

codecov bot commented Dec 19, 2022

Codecov Report

Merging #6456 (093d680) into main (6cfe442) will decrease coverage by 0.02%.
The diff coverage is 0.00%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6456      +/-   ##
==========================================
- Coverage   43.59%   43.57%   -0.03%     
==========================================
  Files         123      123              
  Lines       14390    14390              
==========================================
- Hits         6273     6270       -3     
- Misses       7437     7439       +2     
- Partials      680      681       +1     

@pdf
Copy link
Contributor Author

pdf commented Dec 19, 2022

Looks like the original tests may not have been functional - all the exit code tests for commands that should make forbidden syscalls are failing, eg:

[ "$status" -ne 0 ]

Is the test runner perhaps not restricting these calls?

@haircommander
Copy link
Member

Looks like the original tests may not have been functional - all the exit code tests for commands that should make forbidden syscalls are failing, eg:

[ "$status" -ne 0 ]

Is the test runner perhaps not restricting these calls?

That's a known failure we've been investigating (and subsequently ignoring in order to get the release out) in rhel e2e. They're working in fedora. I personally have no idea what's going on, and those that could possibly look into it are already on holiday break.

@haircommander haircommander added this to the 1.26 milestone Dec 19, 2022
@pdf pdf changed the title [WIP] server/metrics: Update seccomp notifier metrics to reduce cardinality server/metrics: Update seccomp notifier metrics to reduce cardinality Dec 20, 2022
@pdf pdf marked this pull request as ready for review December 20, 2022 01:16
@pdf pdf requested a review from mrunalp as a code owner December 20, 2022 01:16
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Dec 20, 2022
@openshift-ci openshift-ci bot requested review from QiWang19 and klihub December 20, 2022 01:16
@haircommander
Copy link
Member

/approve
/lgtm

/override ci/prow/e2e-gcp-ovn
/override ci/prow/ci-rhel-integration
/override ci/prow/ci-cgroupv2-e2e

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Dec 20, 2022
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Dec 20, 2022

@haircommander: Overrode contexts on behalf of haircommander: ci/prow/ci-cgroupv2-e2e, ci/prow/ci-rhel-integration, ci/prow/e2e-gcp-ovn

Details

In response to this:

/approve
/lgtm

/override ci/prow/e2e-gcp-ovn
/override ci/prow/ci-rhel-integration
/override ci/prow/ci-cgroupv2-e2e

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/test-infra repository.

@haircommander
Copy link
Member

Thanks a bunch @pdf for taking this on!

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Dec 20, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: haircommander, pdf

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

The pull request process is described here

Details 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 added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 20, 2022
@openshift-merge-robot openshift-merge-robot merged commit 2ab00cb into cri-o:main Dec 20, 2022
@pdf pdf deleted the update_seccomp_metrics branch December 20, 2022 21:51
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. kind/bug Categorizes issue or PR as related to a bug. lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note-none Denotes a PR that doesn't merit a release note.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

seccomp notifier metric cardinality

3 participants