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 envoyproxy module #7569

Merged
merged 18 commits into from
Jul 24, 2018
Merged

Add envoyproxy module #7569

merged 18 commits into from
Jul 24, 2018

Conversation

berfinsari
Copy link
Contributor

The envoyproxy module collects metrics.

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

return events, nil
}

func findStats(data common.MapStr, response []byte, re_name string) common.MapStr {

Choose a reason for hiding this comment

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

don't use underscores in Go names; func parameter re_name should be reName

}, nil
}

func (m *MetricSet) Fetch() (common.MapStr, error) {

Choose a reason for hiding this comment

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

exported method MetricSet.Fetch should have comment or be unexported

http *helper.HTTP
}

func New(base mb.BaseMetricSet) (mb.MetricSet, error) {

Choose a reason for hiding this comment

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

exported function New should have comment or be unexported

)
}

type MetricSet struct {

Choose a reason for hiding this comment

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

exported type MetricSet should have comment or be unexported

Copy link
Contributor

@exekias exekias left a comment

Choose a reason for hiding this comment

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

Thank you for this awesome contribution @berfinsari! 🎉 🎉

I left some minor comments, but this is looking great overall.

System test is failing on some undocumented fields, can you please have a look?

Exception: Key 'envoyproxy.server.http.async-client.no_route:' found in event is not documented!

}
for i := 0; i < len(stats); i++ {
event := findStats(data, response, stats[i])
events, err = schema.Apply(event)
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't this overriding the events var on every pass? It sounds like you could call it just once after the loop (using the loop to populate data only)

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, have a look to Apply options, the default behavior is: all fields are required, you will get an error if any of them is missing. I'm wondering if some fields may change between releases. A more relaxed check would be: schema.Apply(event, schema.FailOnRequired). Pinging @jsoriano on this

Copy link
Member

Choose a reason for hiding this comment

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

There is an example of required fields here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for your review. I think now overriding issue is solved but I am not sure which fields are required. I am handle with this.

}

func findStats(data common.MapStr, response []byte, reName string) common.MapStr {
re := regexp.MustCompile(reName)
Copy link
Contributor

Choose a reason for hiding this comment

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

you can avoid recompiling this on every fetch by moving from a local stats := []string to a static var var stats []*regexp.Regexp

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.

Thanks for working on this! It'd be an awesome addition to metricbeat.
My only concern is that we may need to change the approach to parse the stats if they depend on the listeners configuration.

"watchdog_mega_miss": c.Int("watchdog_mega_miss"),
"watchdog_miss": c.Int("watchdog_miss"),
},
"listener": s.Object{
Copy link
Member

Choose a reason for hiding this comment

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

Is the list of listeners and http objects dynamic? If it is maybe Schema (as is now) is not the best option to parse these fields.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What do you recommend to parse these fields? Do you have an example for this?

Copy link
Member

Choose a reason for hiding this comment

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

I see some options here:

  • Don't use schema to parse these fields, you can take a look to other modules that don't make use of this package, as haproxy.
  • Complete this PR without these fields, and we can think in the meantime how to support these dynamic objects with schema. Once schema is ready, support for these metrics can be added in a new PR.

Another intermediary solution would be to use schema only for the non-dynamic fields, and use other mechanisms to fill the rest of fields.

I'm fine with any of these options.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for the reply! I removed dynamic fields and updated docs for the non-dynamic fields. In the meantime, I will look to other modules for dynamic fields.

Copy link
Member

Choose a reason for hiding this comment

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

Nice, I'm thinking that probably listeners and http events should be collected from a different metricset, and send different events. Let's finish this PR and then we can continue thinking on these metrics on dynamic elements 🙂

}
for i := 0; i < len(stats); i++ {
event := findStats(data, response, stats[i])
events, err = schema.Apply(event)
Copy link
Member

Choose a reason for hiding this comment

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

There is an example of required fields here.

@berfinsari
Copy link
Contributor Author

@exekias Did you have any chance to check latest changes?

@ruflin
Copy link
Contributor

ruflin commented Jul 24, 2018

jenkins, test this

@exekias exekias merged commit bfe4c11 into elastic:master Jul 24, 2018
@exekias
Copy link
Contributor

exekias commented Jul 24, 2018

Thank you so much for this contribution @berfinsari! Do you happen to have dashboards for this module? It would be awesome to include them in the distribution, so all users benefit from them!

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.

6 participants