-
Notifications
You must be signed in to change notification settings - Fork 950
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
feature: add kernel info to EngineVersion metric #2889
feature: add kernel info to EngineVersion metric #2889
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2889 +/- ##
==========================================
- Coverage 68.86% 68.86% -0.01%
==========================================
Files 291 291
Lines 18249 18249
==========================================
- Hits 12568 12567 -1
- Misses 4224 4230 +6
+ Partials 1457 1452 -5
|
Could you please add test? There is an example case would be helpful. |
600d701
to
938058f
Compare
test/api_system_metrics_test.go
Outdated
func (suite *APIEngineVersionMetricsSuite) TestEngineVersionMetrics(c *check.C) { | ||
key := "engine_daemon_engine_info" | ||
hasMetric := HasMetric(c, key) | ||
c.Assert(hasMetric, check.Equals, true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm afraid hasMetric=true
isn't good enough to check all label. How about to assert the value of label kernel
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add matching label checks
apis/metrics/metrics.go
Outdated
@@ -38,7 +38,7 @@ var ( | |||
ImageActionsTimer = metrics.NewLabelTimer(subsystemPouch, "image_actions", "The number of seconds it takes to process each image action", "action") | |||
|
|||
// EngineVersion records the version and commit information of the engine process. | |||
EngineVersion = metrics.NewLabelGauge(subsystemPouch, "engine", "The version and commit information of the engine process", "commit") | |||
EngineVersion = metrics.NewLabelGauge(subsystemPouch, "engine", "The version and commit information of the engine process", "gitCommit", "pouchVersion", "kernelVersion") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name of labels is used by monitoring system, so it would be better to stay the same
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
keep "commit", add "version" and "kernel"
579a86e
to
6e4062f
Compare
|
8a0c924
to
1e229b3
Compare
test/api_system_metrics_test.go
Outdated
|
||
// SetUpTest does common setup in the beginning of each test. | ||
func (suite *APIEngineVersionMetricsSuite) SetUpTest(c *check.C) { | ||
SkipIfFalse(c, environment.IsLinux) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove the setuptest and teardownsuite because the setupsuite is good enough
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, already deleted
Signed-off-by: KevinBetterQ <1093850932@qq.com>
1e229b3
to
4052bf8
Compare
|
||
regularVersion := `^.*version="(.*?)".*$` | ||
regular = regexp.MustCompile(regularVersion) | ||
params = regular.FindStringSubmatch(versionMetrics) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we should check the length here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with little nit
Ⅰ. Describe what this PR did
add kernel info to EngineVersion metric
Ⅱ. Does this pull request fix one issue?
fixes #2881
Ⅲ. Why don't you add test cases (unit test/integration test)? (你真的觉得不需要加测试吗?)
added
Ⅳ. Describe how to verify it
$ pouchd -l tcp://0.0.0.0:4243
$ curl http://127.0.0.1:4243/metrics
Ⅴ. Special notes for reviews