-
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
Add group_measurements_by_instance_label flag to perfmon configuration #8688
Conversation
…n. This flag will send all perfmon measurements with a matching instance label as part of the same event (i.e. all metrics for C:\, Processer X, etc.). Enabling this flag considerably reduces the number of events sent by metricbeat.
Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually? |
Hi @smi9cm, we have found your signature in our records, but it seems like you have signed with a different e-mail than the one used in yout Git commit. Can you please add both of these e-mails into your Github profile (they can be hidden), so we can match your e-mails to your Github profile? |
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.
@smi9cm thanks working on this! This looks like a good addition. Code looks mostly good to me, only some details in the config reference and with error handling.
There is also an error in CI builds that should be fixed by make update
.
You will also need to sign the CLA before we can merge this.
@@ -3,6 +3,7 @@ | |||
enabled: true | |||
period: 10s | |||
perfmon.ignore_non_existent_counters: true | |||
perfmon.group_measurements_by_instance: 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.
These two options should be false
here as this is its default and this file is used for reference. Could you change it too in the ignore_non_existent_counters
?
Oh, and could you please add a changelog entry? |
…rs fields to false. Update changelog and ensure windows.asciidoc is up to date.
@smi9cm Any chance you can sign off on this? I really would like to see this feature implemented. |
…dual event. This solves the problem of only keeping the error contained in the first event. Also added simple unit test.
metricbeat/module/windows/perfmon/pdh_integration_windows_test.go
Outdated
Show resolved
Hide resolved
@jsoriano, sorry for the delay in getting back to this. I've updated the docs like you've suggested. As for error handling, I think the cleanest approach is to always send counters that contain an error as individual events. This is the same as the original behaviour (i.e. without grouping) and ensures we always capture the errors. Also, I've signed the CLA a couple of times now but the bot keeps reporting that I haven't - is there any chance you could check what's going on there? |
@smi9cm regarding CLA, you need to use the same email in your commits, in your commits I see |
@jsoriano too easy, should be fixed now 👍 |
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, it looks good to me, I have added some more comments mostly about code style, not important. Let me know what you think.
config.CounterConfig[2].InstanceLabel = "processor.name" | ||
config.CounterConfig[2].MeasurementLabel = "processor.time.idle.average.ns" | ||
config.CounterConfig[2].Query = `\Processor Information(_Total)\Average Idle Time` | ||
config.CounterConfig[2].Format = "float" |
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 can define the list of counter configs inline, something like this:
counterConfigs := []CounterConfig{
{
InstanceLabel: "processor.name",
MeasurementLabel: "processor.time.pct",
Query: `\Processor Information(_Total)\% Processor Time`,
Format: "float",
},
...
}
config := Config{
CounterConfig: counterConfigs,
GroupMeasurements: true,
}
|
||
values, _ := handle.Read() | ||
|
||
time.Sleep(time.Millisecond * 1000) |
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.
time.Sleep(time.Millisecond * 1000) | |
time.Sleep(time.Second) |
🙂
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.
It'd be nice though if this could be done without depending on Sleep
.
values, err = handle.Read() | ||
if err != nil { | ||
t.Fatal(err) | ||
} |
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.
These ifs can be replaced with require.NoError(t, err)
require
is available as "github.com/stretchr/testify/require"
@smi9cm @jsoriano I'm anxiously waiting for this, is there anything I can do to get this moved along? |
Ok, I am going to merge this and open a follow up for the pending changes. Thanks! |
I think this merge is causing failures (noticed it on a different PR):
This PR was never tested on Jenkins so it received no Windows testing. |
@andrewkroh 🤦♂️ ok, let me revert it by now |
…iguration (elastic#8688)" This reverts commit fbee6a2.
PR to revert this #11001 |
} | ||
assert.True(t, pctKey) | ||
|
||
t.Log(values) |
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.
@smi9cm I tested this and it's producing more than one event, but the assertion is expecting only one. There are a few compilation errors in the test code so we are going to revert this the merge in #11001. I'd love it if you could reopen the PR after you have looked into the failing test case. Thanks!
pdh_integration_windows_test.go:378: {
"processor": {
"name": "_Total",
"time": {
"idle": {
"average": {
"ns": 10932693.47826087
}
},
"pct": 0
}
}
}
pdh_integration_windows_test.go:378: {
"disk": {
"bytes": {
"read": {
"total": 0
}
}
}
}
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.
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.
New PR looks good to me, apologies for breaking the build there! Thanks @jsoriano as well.
elastic#8688) This flag will send all perfmon measurements with a matching instance label as part of the same event (i.e. all metrics for C:, Processor X, etc.). This addresses some of the issues raised in elastic#6584. In most cases enabling this flag considerably reduces the number of events sent by metricbeat.
This flag will send all perfmon measurements with a matching instance label as part of the same event (i.e. all metrics for C:, Processor X, etc.). This addresses some of the issues raised in #6584.
In most cases enabling this flag considerably reduces the number of events sent by metricbeat.