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

any way to support external user defined functions #4522

Open
alburthoffman opened this Issue Aug 21, 2018 · 6 comments

Comments

Projects
None yet
4 participants
@alburthoffman
Copy link

alburthoffman commented Aug 21, 2018

Proposal

Use case. Why is this important?
We has to support some validation functions, which are limited to our company only.
like the metrics will be ignored if the host is in maintenance mode, and will be used when host is back.
We also have other private requirements.

it's not a good idea to add those functions to functions.go. communicate does-not need them and we will have to maintain our own prometheus version.

the ideal solution would be we can do something like:
apply_external("plugin.function", metrics)
then it can check functions defined in plugin.so, which can be preload or loaded dynamically.

@brian-brazil

This comment has been minimized.

Copy link
Member

brian-brazil commented Aug 21, 2018

Thank you for your suggestion. I don't think it's wise to allow any external code inside the Prometheus process, as that'll lead to bug reports caused by code in a non-standard setup which we have little to no ability to debug.

The use case you describe is already possible within PromQL.

@alburthoffman

This comment has been minimized.

Copy link
Author

alburthoffman commented Aug 21, 2018

you mean ignoring metrics from maintenance mode hosts?
Not sure how to do that in PromQL? if metrics has tags which indicate the attributes, then it would be easy to write. but we don't control that part.

I agreed with the bug reports thing. but it's very limited to only support functions.go. New prometheus versions will be branches to adding use private functions, then it will also cause the problem u just mentioned.

it would be great to have plugins, then plugins can be maintained by users themself. they can also share them out if wanted.

@brian-brazil

This comment has been minimized.

Copy link
Member

brian-brazil commented Aug 21, 2018

you mean ignoring metrics from maintenance mode hosts?

Yes, expose a metric indicating it's in maintenance. Then whatever in PromQL to use that.

it's very limited to only support functions

That doesn't make a difference, it's still arbitrary code outside our control.

it would be great to have plugins, then plugins can be maintained by users themself. they can also share them out if wanted.

Go plugins don't help for the above reasons. We already have a number of integration points.

@RalphSu

This comment has been minimized.

Copy link

RalphSu commented Sep 26, 2018

Hmm, probably related, i had some function want it available to my user in PromQL, since i'm exposing the PromQL to them.
It's something like do calculation similiar https://en.wikipedia.org/wiki/Bollinger_Bands which sound like https://prometheus.io/docs/prometheus/latest/querying/functions/#holt_winters(), expecting syntax like bolling_band() that user can use.

Currently, it looks i had to fork the code, do the code change, compile and deploy, which looks invasive one. @brian-brazil any suggestion on this kind of extension?

@brian-brazil

This comment has been minimized.

Copy link
Member

brian-brazil commented Sep 26, 2018

That's already possible within PromQL.

@RalphSu

This comment has been minimized.

Copy link

RalphSu commented Sep 26, 2018

That's already possible within PromQL.

Do you mean extension is already possible? That would be cool, can you point me a bit of reference? Not find in site docs if i don't miss anything

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.