-
Notifications
You must be signed in to change notification settings - Fork 43
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
Allow specifying multiple filtersets. #113
Conversation
Thanks for contributing, @knyar! As this PR is large, we will take some time to review it. I will try to make this PR get reviewed within 1 day. |
@fabxc I saw you implemented filter. I am interested what the motivation you only choose validating against regexp and labels.Matcher? |
README.md
Outdated
@@ -48,14 +48,18 @@ stackdriver-prometheus-sidecar --help | |||
|
|||
#### Filters | |||
|
|||
The `--filter` flag allows to provide filters which all series have to pass before being sent to Stackdriver. The flag may be repeated to provide several filters. Filters use the same syntax as the well-known PromQL label matchers, e.g.: | |||
The `--filterset` flag allows to provide filters which all series have to pass before being sent to Stackdriver. Filters use the same syntax as [Prometheus time series selectors](https://prometheus.io/docs/prometheus/latest/querying/basics/#time-series-selectors), e.g.: |
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.
I recheck Prometheus document again - we should be really specific on the selector we use.
I think from both design and implementation POV, it's reasonable that we only support "instant vector selectors", not "range vector selectors". "time series selectors" include both of them. The rationale for design is that we should start from minimum set of selectors useful for users - and from what we see, most of the users are using "instant vector selectors" only.
Action item here: change from "time series selectors" to "instant vector selectors", and link to https://prometheus.io/docs/prometheus/latest/querying/basics/#instant-vector-selectors .
Note that your implementation is using ParseMetricSelector, which only works with instant vector selector.
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.
Changed, though I think 'time series selectors' would be more clear to someone who is not intimately familiar with Prometheus data model.
@@ -231,7 +232,10 @@ func main() { | |||
a.Flag("web.listen-address", "Address to listen on for UI, API, and telemetry."). | |||
Default("0.0.0.0:9091").StringVar(&cfg.listenAddress) | |||
|
|||
a.Flag("filter", "PromQL-style label matcher which must pass for a series to be forwarded to Stackdriver. May be repeated."). | |||
a.Flag("filterset", "PromQL metric and label matcher which must pass for a series to be forwarded to Stackdriver. If repeated, the series must pass any filter set to be forwarded."). |
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.
I felt that filterset does not serve well for the value we accept - as the value of filterset is not just comma split string (which fits the name filterset
more), but instant vector selector from PromQL.
Also filterset
and filter
are really similar, which may confuse our users. Can you find an alternative name here?
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.
I agree that filterset
is not a great name, though being related to filter
makes it clear that both flags are controlling the same thing.
Do you like --whitelist
or --metric
better?
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.
Thanks for coming up with the name. Whitelist sounds good for me.
Added another commit addressing comments; will squash commits later when you're happy with the changes. |
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.
Thanks for accomodating the feedback and provide your thoughts! The PR looks good so far, and I think the only thing left is the parameter naming for metric whitelist/filtering.
Renamed |
Javier and I have chatted over the naming. He mentioned that whitelist may not be a good term. I looked up whitelist in English dictionaries:
As in both dictionaries, they are all defined related to authority/trustworthy, I agreed that whitelist is not a good term here, as we are considering "what user want to send" to Stackdriver API, not considering authority/trustworthy. What do you think about using |
Sounds good, I've renamed the variables back to |
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.
LGTM, only one minor change for logging message before merging back.
Note: can you create new commit on top of existing commits instead of force pushing? In this way, code reviewer has option to do incremental code review by reviewing commit one by one.
This allows specifying multiple sets of filters that time series will be checked against. It also switches to using promql native parser for filters. Existing `--filter` flag will keep working, but is now marked as deprecated.
Thanks for contributing, @knyar ! I just merged this PR after reviewing your latest change on log message. |
This allows specifying multiple sets of filters that time series will be
checked against. It also switches to using promql native parser for
filters.
Existing
--filter
flag will keep working, but is now marked asdeprecated.
This makes #106 obsolete.