-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Marathon input plugin #2369
Marathon input plugin #2369
Conversation
plugins/inputs/marathon/marathon.go
Outdated
wg.Add(1) | ||
go func(c string) { | ||
defer wg.Done() | ||
errorChannel <- m.gatherMetrics(c, ":8080", acc) |
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 simplify the code, and make the errors logs easier to read by doing acc.AddError(...)
.
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.
Hi @phemmer, thanks for valuable comments. I am not very experienced in Go and Telegraf yet, so tried to implement the plugin as close to existing plugins as possible. Currently used approach seems to be the most prevalent among the other plugins.
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.
acc.AddError()
is relatively new. It was added because there was a lot of inconsistency among the error handling within plugins, and many of them had problems.
For example, with joining on newline, the problem is that only the first line will contain the timestamp and plugin name, the other lines will not. This can make the logs harder to read.
I really should go through and clean up all the plugins to fix all the error handling 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.
Got it, thanks for the intro. I will update the PR to use acc.AddError()
for error handling.
plugins/inputs/marathon/marathon.go
Outdated
return false | ||
} | ||
|
||
func (m *Marathon) filterMetrics(metrics *map[string]interface{}) { |
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.
Why is this receiving a pointer to a map? Maps are already a pointer.
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.
True. Fixed.
plugins/inputs/marathon/marathon.go
Outdated
if contains(m.MetricTypes, k) == false { | ||
delete(*metrics, k) | ||
} | ||
} |
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.
```
for _, mt := range m.MetricTypes {
delete(*metrics, mt)
}
```
Edit: Nevermind, I misread the code.
add7784
to
d6f5b43
Compare
Any updates on this? |
From my point of view it is ready to be merged. |
Any progress on this? |
+1 This would be awesome. |
The current metrics, while matching what Marathon provides, don't fit with the existing metrics produced by Telegraf. We need to think about how we can leverage fields and tags to reduce the number of points and better allow the use of functions when we query. @smolse Do you think you can take a pass at this? |
+1 We would really like to see this plugin in telegraf. |
Maybe we can do something similar to the graphite input to transform the metrics to be more in line with our data model. If anyone begins work on this please add a comment here. |
b75f79a
to
850598c
Compare
@danielnelson I have updated the pull request to store each metric in a separate measurement, how does it look now? |
This is a step in the right direction, but there is still more to do. You may want to read through the schema and data layout documentation first. I'll try to give a few examples to illustrate some changes that would be desirable. Here is one of the current points, in line protocol format minus the timestamp:
With this model you can't easily write, for instance, a query to calculate the percentage of used memory. This is because each value is part of a different measurement so you cannot use more than one in an InfluxQL function. Another issue is that the measurement name won't work well with other inputs. If you are collecting from both Marathon and Jolokia, there would be confusion about which service a JVM measurement is from. Usually an input plugin has no more than a handful of measurement names, and I recommend having them all start with So after these two transformations we would have all the values as fields with the same measurement name:
That is better but some of the metrics can be improved with good use of tags. These two measurement names should make for a good example:
When a measurement has a deeply nested structure like this, usually it contains multiple independent dimensions. Having them as a single item makes it difficult to group by and slow to select subsets of. I think here it might make sense to have two tags, one for marathon|chaos, and one for the resource. You can probably decompose and name the tags better than I can since you are familiar with Marathon, so don't necessarily use my exact suggestions:
One thing that is tricky about this plugin is the large number of metrics. This necessitates determining the measurement name and tags programmatically, which can be difficult if there are any inconsistencies. |
One thing I should add to my clarify my last few comments. If the format of the marathon stats are inconsistent, it may be impossible to extract tags as I mentioned above automatically. This is where my comment about the graphite parser comes in. It has a template variable which can be used to unpack metrics, perhaps it can be useful. Here is a config file example:
|
+1 I really need this plugin in my telegraf. |
Let's use the dropwizard parser once it is complete to deal with the metric tranformations in this plugin. |
Do you have plans to implement Marathon service discovery ? |
No plans specifically with Marathon, though you might want to read through #272. We will be adding a plugin system for configuration and we could potentially write a plugin that creates input plugins based on what is discovered in Marathon. |
@smolse i know this has been open for a while, but are you interested in bringing this across the finish line or should we look for someone to take it over? |
Unfortunately most likely I will not have time to work on this in the nearest future, please proceed with someone else. |
If anyone is interested in taking this over from @smolse please go for it! Feel free to respond with any questions you may have. |
Closing this PR due to inactivity. If you would still like this plugin, please submit it as an external plugin that can be used with |
Added an input plugin for gathering metrics from Marathon using REST API provided by it.
Required for all PRs: