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

stats: check pointer before using metrics #2878

Merged
merged 1 commit into from
May 30, 2019
Merged

stats: check pointer before using metrics #2878

merged 1 commit into from
May 30, 2019

Conversation

fuweid
Copy link
Contributor

@fuweid fuweid commented May 30, 2019

Signed-off-by: Wei Fu fuweid89@gmail.com

Ⅰ. Describe what this PR did

Some machine doesn't have cgroup controller, like pids. Therefore,
before we use it from metrics, we need to check the value.

Ⅱ. Does this pull request fix one issue?

none

Ⅲ. Why don't you add test cases (unit test/integration test)? (你真的觉得不需要加测试吗?)

using existing test case.

Ⅳ. Describe how to verify it

wait for CI.

NOTE: the testing needs to disable cgroup function by umount /sys/fs/cgroup/pids something like that. It is kind of hacking. I did it in offline.

Ⅴ. Special notes for reviews

Some machine doesn't have cgroup controller, like pids. Therefore,
before we use it from metrics, we need to check the value.

Signed-off-by: Wei Fu <fuweid89@gmail.com>
@codecov
Copy link

codecov bot commented May 30, 2019

Codecov Report

Merging #2878 into master will decrease coverage by 0.04%.
The diff coverage is 96.15%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2878      +/-   ##
==========================================
- Coverage   69.11%   69.07%   -0.05%     
==========================================
  Files         286      286              
  Lines       17903    17902       -1     
==========================================
- Hits        12374    12365       -9     
+ Misses       4124     4123       -1     
- Partials     1405     1414       +9
Flag Coverage Δ
#criv1alpha2_test 39.05% <0%> (-0.01%) ⬇️
#integration_test_0 36.7% <0%> (ø) ⬆️
#integration_test_1 35.37% <0%> (ø) ⬆️
#integration_test_2 36.69% <96.15%> (+0.02%) ⬆️
#integration_test_3 35.48% <96.15%> (+0.06%) ⬆️
#node_e2e_test 34.66% <0%> (-0.16%) ⬇️
#unittest 28.56% <0%> (ø) ⬆️
Impacted Files Coverage Δ
daemon/mgr/container_stats.go 71.02% <96.15%> (+3.22%) ⬆️
ctrd/watch.go 72.97% <0%> (-5.41%) ⬇️
daemon/logger/crilog/log.go 79.71% <0%> (-2.9%) ⬇️
daemon/containerio/io.go 72.81% <0%> (-1.95%) ⬇️
pkg/meta/store.go 67.44% <0%> (-1.56%) ⬇️
daemon/mgr/container_utils.go 76.76% <0%> (-1.02%) ⬇️
cri/v1alpha2/cri.go 68.81% <0%> (-0.51%) ⬇️
ctrd/container.go 53.91% <0%> (-0.39%) ⬇️
ctrd/supervisord/daemon.go 50.67% <0%> (+1.35%) ⬆️
cri/ocicni/cni_manager.go 61.11% <0%> (+1.85%) ⬆️

@fuweid fuweid requested a review from zhuangqh May 30, 2019 01:24
Copy link
Contributor

@zhuangqh zhuangqh left a comment

Choose a reason for hiding this comment

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

LGTM, we must do nil checking before using pointer.

@zhuangqh zhuangqh merged commit d440f6b into AliyunContainerService:master May 30, 2019
@fuweid fuweid deleted the me_check_point_before_use branch June 4, 2019 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants