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

Refactoring config handling for perfmon metricset #3854

Closed

Conversation

martinscholz83
Copy link
Contributor

This PR simplified the using of the config for the perfmon metricset.
Sample output

{
  "@timestamp": "2017-03-30T09:17:59.012Z",
  "beat": {
    "hostname": "4201halwsd00001",
    "name": "4201halwsd00001",
    "version": "6.0.0-alpha1"
  },
  "metricset": {
    "module": "windows",
    "name": "perfmon",
    "rtt": 0
  },
  "type": "metricsets",
  "windows": {
    "perfmon": {
      "processor.processor_performance": 52.522315,
      "processor.processor_time": 18.287520
    }
  }
}

@elasticmachine
Copy link
Collaborator

Jenkins standing by to test this. If you aren't a maintainer, you can ignore this comment. Someone with commit access, please review this and clear it for Jenkins to run.

1 similar comment
@elasticmachine
Copy link
Collaborator

Jenkins standing by to test this. If you aren't a maintainer, you can ignore this comment. Someone with commit access, please review this and clear it for Jenkins to run.

result[v.GroupName] = groupVal
doubleValue := (*float64)(unsafe.Pointer(&v.displayValue.LongValue))

result[v.counterName] = *doubleValue
Copy link
Contributor

Choose a reason for hiding this comment

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

You should use here result.Put(v.counterName, *doubleValue), see https://github.com/elastic/beats/blob/master/libbeat/common/mapstr.go#L105 This will create sub documents for each dot which will make it compatible with elasticsearch 2.x.

- name: group
Grouping of different counters
fields:
- name: alias
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the alias and query going to be part of the event? Based on your example object above this is not the case. Means we don't need it in here? I think this file can actually be empty as the name is defined by the namespace.

"beat":{
"hostname":"beathost",
"name":"beathost"
"@timestamp": "2016-05-23T08:05:34.853Z",
Copy link
Contributor

Choose a reason for hiding this comment

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

Not an issue for this PR but I assume this currently manually created? We should create this automatically in the future and make sure in the docs it is made clear that it is only an example.

@@ -34,7 +29,7 @@ func init() {
// multiple fetch calls.
type MetricSet struct {
mb.BaseMetricSet
counters []CounterConfig
counters []CounterConfigGroup
Copy link
Contributor

Choose a reason for hiding this comment

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

I see that this in the MetricSet, but do we ever need it outside the New part? It seems to be all in the handle/query anyways?

if err != ERROR_SUCCESS {
return nil, PdhError(err)
}
counters[i] = Counter{counterName: v.Alias, counterPath: v.Query}
Copy link
Member

Choose a reason for hiding this comment

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

👍 It looks less complex with fewer loops.

@martinscholz83
Copy link
Contributor Author

@andrewkroh, @ruflin. Does this PR make sense? Because i see that @andrewkroh had refactor a lot of code in #3871 which makes this PR unnecessary i think.

@martinscholz83
Copy link
Contributor Author

I would first merge @andrewkroh changes and then see what is still left.

@martinscholz83 martinscholz83 deleted the perfmon_config_handling branch April 3, 2017 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants