-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Added function to return pretty names on "system" module "process summary" metricset #8275
Added function to return pretty names on "system" module "process summary" metricset #8275
Conversation
If it is possible to have "dead" processes, as it seems by the discuss thread and this stackexchange comment, I'd propose to count or ignore them and in any case don't report them as unexpected state to don't flood logs with something that is not really an error. |
@@ -96,7 +96,7 @@ func (m *MetricSet) Fetch() (common.MapStr, error) { | |||
case 'Z': | |||
summary.zombie++ | |||
default: | |||
logp.Err("Unknown state <%v> for process with pid %d", state.State, pid) | |||
logp.Err("Unknown or unexpected state <%c> (%s) for process with pid %d", state.State, prettyNameOf(state.State), pid) |
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 agree with the change to print the character value, this is much better than a random number 😄 But I'd keep this error log line only for unknown values, and not for not-so-expected states as could be the dead one.
Regarding the error on tests, how are you running them? this seems to be adding all platforms as tags, what will include the implementations for all platforms, this is why you see redefined declarations. You should be able to run the tests for this metricset with
|
Found the solution to the test error (in the provided log you can see that it's trying to compile it to all platforms, I just needed to only set the platform Ok, so:
I still have to dig a bit more in the jenkins error, I'm not sure about what's the problem |
I meant to hide the log for the case of
Yes, this was one of my proposals, counting them as any other state, but in any case a process is this state is going to disappear very soon, so I find it good too to just ignore them (that is not the same as unknown, because I agree that unknown states should be logged). Regarding changes in the fields, adding them don't break compatibility. |
@@ -109,6 +112,7 @@ func (m *MetricSet) Fetch() (common.MapStr, error) { | |||
"stopped": summary.stopped, | |||
"zombie": summary.zombie, | |||
"unknown": summary.unknown, | |||
"dead": summary.dead, |
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.
You will need to add this new field to metricbeat/module/system/process_summary/_meta/fields.yml
, after adding it you will also need to run make update
.
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.
Done in e4c9bab8e90c4151813763c544210eb2a08f491e
@@ -109,6 +112,7 @@ func (m *MetricSet) Fetch() (common.MapStr, error) { | |||
"stopped": summary.stopped, | |||
"zombie": summary.zombie, | |||
"unknown": summary.unknown, | |||
"dead": summary.dead, |
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, add also a changelog entry regarding this new field.
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.
Done in e4c9bab8e90c4151813763c544210eb2a08f491e
CHANGELOG.asciidoc
Outdated
@@ -119,6 +119,7 @@ https://github.com/elastic/beats/compare/v6.4.0...master[Check the HEAD diff] | |||
- Add experimental socket summary metricset to system module {pull}6782[6782] | |||
- Increase ignore_above for system.process.cmdline to 2048. {pull}8101[8100] | |||
- Add support to renamed fields planned for redis 5.0. {pull}8167[8167] | |||
- Added 'died' PID state to process_system metricset on system module |
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 also a reference to the pull request as in other entries.
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.
And you will also need to update the branch with master, there is a conflict in the changelog.
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.
Fixed both in 503c282
…cess won't be logged anymore. Change logging to show character instead of ASCII code
Added comment on fields.asciidoc
e4c9bab
to
503c282
Compare
…mary" metricset (elastic#8275) Added function to return pretty names on "system" module "process summary" metricset (cherry picked from commit 457a784)
Following this discuss https://discuss.elastic.co/t/errors-in-metric-beat-log/147918/3 It's true that I found that the error message was a bit cryptic.
According to this http://thelinuxstuff.blogspot.com/2012/08/process-state-codes-in-ps-output.html the state 88, which corresponds to
X
state in a linux process corresponds todead
state.I thought it could be nice to have a bit more descriptive error message in such case to help user debugging his own problems:
So, in the case of the discuss issue where the message had this format:
It will become this:
BTW, I couldn't manage to compile any test, system was complaining about some redefined variables: