Skip to content

Logql DFS visitor does not visit subrees of label_replace #16920

Open
@shivanthzen

Description

@shivanthzen

Describe the bug
Logql DFS visitor does not visit subrees of label_replace expression .
For example, running DFS visitor for the expression,

label_replace(
			sum by (job) (
				sum_over_time(
					{namespace="tns"} |= "level=error" | json | avg=5 and bar<25ms | unwrap duration(latency)  | __error__!~".*" [5m]
				)
			/
				count_over_time({namespace="tns"} | logfmt | label_format foo=bar[5m])
			),
			"foo",
			"$1",
			"service",
			"(.*):.*"
		)

the traversal stops at label_replace.

To Reproduce

Expected behavior
The DFS Parser should visit sub expressions of label_replace without using custom VistiLabelReplaceExpr function

Environment:
go 1.24.1, loki 3.4.2

Screenshots, Promtail config, or terminal output
None

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions