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

Feature: some way to limit size of inputs/outputs #2606

Closed
nfirvine opened this issue Mar 30, 2017 · 11 comments · Fixed by #2636
Closed

Feature: some way to limit size of inputs/outputs #2606

nfirvine opened this issue Mar 30, 2017 · 11 comments · Fixed by #2636

Comments

@nfirvine
Copy link
Contributor

nfirvine commented Mar 30, 2017

Sometimes a misbehaving client will post a huge measurement to a Telegraf input. It would be nice to have a feature to drop those inputs.

Use case:

Johnny Appdeveloper writes an app that posts a measurement to Telegraf with a tag generated from the code. The tag happens to be 3 MB long, by accident.

Nick in Ops is running the metrics pipeline, and decides a 3 MB Telegraf measurement is never on purpose and can hurt other users of the service, so will drop the measurement, log it, and count it.

@danielnelson
Copy link
Contributor

I agree there should be a limit. Not sure if it needs to be user defined or not. Exactly where to place this check is also debatable, some inputs already have limits (http_listener).

@danielnelson danielnelson added this to the Future Milestone milestone Mar 31, 2017
@danielnelson
Copy link
Contributor

In InfluxDB, this key must be less than 32768 bytes long: <measurement>,<tag1=value1>,<tagN=valueN>#!~#<field>.

@nfirvine
Copy link
Contributor Author

nfirvine commented Mar 31, 2017 via email

@danielnelson
Copy link
Contributor

Sorry, didn't add enough context, the key is that string. This is another limit we have in the TICK stack, and it would probably makes sense to limit Telegraf metrics to this size at most.

@nfirvine
Copy link
Contributor Author

nfirvine commented Apr 3, 2017

Is <field> the field key or <fieldkey>=<fieldvalue>?

BTW, feel free to just give me a line number. Having trouble grepping for the info you're' giving me.

@danielnelson
Copy link
Contributor

@danielnelson
Copy link
Contributor

I can think of several ways this could be implemented, but they all have some drawbacks. In some sense it should be the job of the input and output plugins to handle limits, but I see the draw of having a system wide limit.

The most straightforward place to limit metrics system wide would be when added to the accumulator, but we would want to ensure that we aren't creating a significant performance hit.

@nfirvine
Copy link
Contributor Author

nfirvine commented Apr 3, 2017

To scratch my particular itch, all I'd need it for is the kafka_consumer input. I took a quick peek at the code, and it seems like it could be pretty simple if len(buf) > MAX_LEN then drop with error. Not sure if this is the right approach though. If you think that's fine, I could probably find the time for a PR in the next couple of weeks.

@danielnelson
Copy link
Contributor

I think that would be fine, what do you think MAX_LEN should be?

@danielnelson
Copy link
Contributor

64 * 1024 bytes would probably be good if there is nothing more fitting for kafka.

@nfirvine
Copy link
Contributor Author

nfirvine commented Apr 3, 2017

I actually have very little data on how "wide" our metrics end up being, besides the ones that are very big and clearly pathological. May need to measure this. But yes, 64k's a good start.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants