Closed lexx-bright closed 2 months ago
Fixed in master.
@msaf1980 please, reopen.
# echo "test;env=prod 0 $(date +%s)" | nc 127.0.0.1 2003
# echo "test;env=dr 0 $(date +%s)" | nc 127.0.0.1 2003
# curl -s '127.0.0.1:19010/render?target=seriesByTag("name=test")&format=json&from=now-1h&until=now&maxDataPoints=1' | jq .
[
{
"target": "test;env=dr",
"datapoints": [
[
0,
1700396220
]
],
"tags": {
"env": "dr",
"name": "test"
}
},
{
"target": "test;env=prod",
"datapoints": [
[
0,
1700396220
]
],
"tags": {
"env": "prod",
"name": "test"
}
}
]
# curl -s '127.0.0.1:19010/render?target=seriesByTag("name=test","env!=~stage|env")&format=json&from=now-1h&until=now&maxDataPoints=1' | jq .
[]
@lexx-bright Can you test against current master ?
@msaf1980, thanks for the fix but regular expression is still not anchored
curl -s '127.0.0.1:19020/render?target=seriesByTag("name=test")&format=json&f
rom=now-1h&until=now&maxDataPoints=1' | jq .
[
{
"target": "test;env=dr",
"datapoints": [
[
0,
1715839140
]
],
"tags": {
"env": "dr",
"name": "test"
}
},
{
"target": "test;env=prod",
"datapoints": [
[
0,
1715839140
]
],
"tags": {
"env": "prod",
"name": "test"
}
}
]
curl -s '127.0.0.1:19020/render?target=seriesByTag("name=test","env=~r")&format=json&from=now-1h&until=now&maxDataPoints=1' | jq .
[
{
"target": "test;env=dr",
"datapoints": [
[
0,
1715839380
]
],
"tags": {
"env": "dr",
"name": "test"
}
},
{
"target": "test;env=prod",
"datapoints": [
[
0,
1715839380
]
],
"tags": {
"env": "prod",
"name": "test"
}
}
]
@lexx-bright Hi, regular expressions in graphite-clickhouse are intentionally not anchored at the beginning . If you really need this behavior you can open a PR that implements it under a feature flag.
For seriesByTag("name=up", "job=~us") will be used
match(x, '^job=.*us')
matcher which contradicts with https://github.com/graphite-project/graphite-web/blob/e058266f8afc293250ee32fd30e3bce4b7ab3579/webapp/graphite/render/functions.py#L5735For seriesByTag("name=up", "job=~.*us|job") will be used
match(x, '^job=.*.*us|job')
matcher which is equivalent ofmatch(x, '^job=.*.*us') OR match(x, 'job')
, but expectedmatch(x, '^job=.*.*us') OR x = 'job=job'
Inconsistent behaviour. For seriesByTag("name=up", "job=~^clickhous") will be used
x='job=clickhous'
matcherbut for seriesByTag("name=up", "job=~^.*clickhous")
match(x, '^job=.*clickhous')
So, the series with label job=clickhouse won't be returned in the first case, but will be in the second.