Skip to content

Commit

Permalink
fixup! Calculate query hash based on normalized query start
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Haudum <christian.haudum@gmail.com>
  • Loading branch information
chaudum committed Oct 25, 2024
1 parent 03c7d62 commit 742dd3e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/logql/engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2610,7 +2610,10 @@ func TestHashingStability(t *testing.T) {
{`sum (count_over_time({app="myapp",env="myenv"} |= "error" |= "metrics.go" | logfmt [10s])) by(query_hash)`},
} {
params.queryString = test.qs
expectedQueryHash := util.HashedQuery(test.qs)
normalizedQueryString := syntax.MustParseExpr(test.qs).String()
expectedQueryHash := util.HashedQuery(normalizedQueryString)

t.Logf("\nOriginal query: %s\nNormalized query: %s", test.qs, normalizedQueryString)

// check that both places will end up having the same query hash, even though they're emitting different log lines.
withEngine := queryWithEngine()
Expand Down

0 comments on commit 742dd3e

Please sign in to comment.