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

Add group_measurements_by_instance_label flag to perfmon configuration #8688

Merged
merged 9 commits into from
Feb 28, 2019

Conversation

ramenjosh
Copy link
Contributor

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.

…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.
@elasticmachine
Copy link
Collaborator

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?

@elasticcla
Copy link

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?

Copy link
Member

@jsoriano jsoriano left a 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
Copy link
Member

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?

@jsoriano
Copy link
Member

jsoriano commented Nov 7, 2018

Oh, and could you please add a changelog entry?

@ruflin ruflin added the Team:Integrations Label for the Integrations team label Nov 21, 2018
@alvarolobato alvarolobato assigned jsoriano and unassigned jsoriano Dec 10, 2018
@andyhoffman12
Copy link

@smi9cm Any chance you can sign off on this? I really would like to see this feature implemented.

Joshua Smith added 2 commits January 11, 2019 15:38
…dual event. This solves the problem of only keeping the error contained in the first event. Also added simple unit test.
@ramenjosh ramenjosh requested review from a team as code owners January 11, 2019 07:18
@ramenjosh
Copy link
Contributor Author

@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?

@jsoriano
Copy link
Member

@smi9cm regarding CLA, you need to use the same email in your commits, in your commits I see Joshua Smith <joshuasmith@Joshuas-MacBook-Pro.local> as author, you need to change this to an email you used to sign the CLA.

@urso urso removed the request for review from a team January 11, 2019 15:46
@ramenjosh
Copy link
Contributor Author

@jsoriano too easy, should be fixed now 👍

Copy link
Member

@jsoriano jsoriano left a 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"
Copy link
Member

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)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
time.Sleep(time.Millisecond * 1000)
time.Sleep(time.Second)

🙂

Copy link
Member

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)
}
Copy link
Member

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"

@andyhoffman12
Copy link

@smi9cm @jsoriano I'm anxiously waiting for this, is there anything I can do to get this moved along?

@jsoriano
Copy link
Member

Ok, I am going to merge this and open a follow up for the pending changes. Thanks!

@jsoriano jsoriano merged commit fbee6a2 into elastic:master Feb 28, 2019
@andrewkroh
Copy link
Member

I think this merge is causing failures (noticed it on a different PR):

module\windows\perfmon\pdh_integration_windows_test.go:384:14: no new variables on left side of :=
module\windows\perfmon\pdh_integration_windows_test.go:390:14: no new variables on left side of :=

This PR was never tested on Jenkins so it received no Windows testing.

@jsoriano
Copy link
Member

@andrewkroh 🤦‍♂️ ok, let me revert it by now

jsoriano added a commit to jsoriano/beats that referenced this pull request Feb 28, 2019
@jsoriano
Copy link
Member

PR to revert this #11001

}
assert.True(t, pctKey)

t.Log(values)
Copy link
Member

@andrewkroh andrewkroh Feb 28, 2019

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
              }
            }
          }
        }

Copy link
Member

Choose a reason for hiding this comment

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

@smi9cm, Me and @jsoriano discussed the test case and made some changes and opened up a PR #11002.

Copy link
Contributor Author

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.

jsoriano pushed a commit to jsoriano/beats that referenced this pull request Feb 28, 2019
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Metricbeat Metricbeat module review Team:Integrations Label for the Integrations team :Windows
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants