-
Notifications
You must be signed in to change notification settings - Fork 3.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
Fix Prometheus regex parsing #9153
Conversation
7c13c8c
to
d3df98e
Compare
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.
The requested changes are really minor so I'm pre-approving with those being changed.
prometheus/converters.go
Outdated
@@ -93,6 +94,8 @@ func ReadRequestToInfluxQLQuery(req *remote.ReadRequest, db, rp string) (*influx | |||
// condFromMatcher converts a Prometheus LabelMatcher into an equivalent InfluxQL BinaryExpr | |||
func condFromMatcher(m *remote.LabelMatcher) (*influxql.BinaryExpr, error) { | |||
var op influxql.Token | |||
var RHS influxql.Expr |
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.
Can RHS
be lowercase? Since it's a local variable, I think that's the standard for local variables.
prometheus/converters_test.go
Outdated
"testing" | ||
|
||
"github.com/influxdata/influxql" | ||
|
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.
Can you remove the space between these?
d3df98e
to
8e3d29e
Compare
Required for all non-trivial PRs
Fixes #9134.
InfluxDB expects regex condition values to be
influxql.RegexLiteral
s, which have literals beginning and ending in forward slashes.Also adds further test coverage to
ReadRequestToInfluxQLQuery
.Only thing that might be worth checking is whether the regex values originating from Prometheus format have already escaped forward slashes or not. For example, will the following condition arrive as:
region =~ foo/bar
which we would then convert intoregion =~ /foo\/bar/
or, would the condition arrive as
region =~ foo\/bar
, which we would then incorrectly convert toregion =~ /foo\\/bar/
?No
CHANGELOG
update as this will probably be back-ported.