Skip to content

lib/traceql: convert durations for the duration field only - #322

Merged
jiekun merged 2 commits into
VictoriaMetrics:masterfrom
ZeXi0308:fix/traceql-quoted-duration
Nov 30, 2026
Merged

jiekun merged 2 commits into
VictoriaMetrics:masterfrom
ZeXi0308:fix/traceql-quoted-duration

Conversation

@ZeXi0308

@ZeXi0308 ZeXi0308 commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #321

{ span.cache.ttl = "30s" } was translated to "span_attr:cache.ttl":=30000000000, so it never matched a span whose cache.ttl attribute is the string 30s.

Values such as 100ms are converted to nanoseconds only in duration and traceDuration filters now.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 4 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="lib/traceql/parser.go">

<violation number="1" location="lib/traceql/parser.go:456">
P2: `isQuoted` is not honored by the special `traceDuration` serialization path, so quoted duration-like values still become nanoseconds. Gate the conversion in `Query.String` on `!tf.isQuoted` and add a regression test for `{traceDuration = "30s"}`.</violation>
</file>

Reply to a comment to ask cubic a question or push back. It learns from your replies.
Click Fix with cubic on a comment, or reply @cubic-dev-ai fix this, and cubic writes the fix.

Re-trigger cubic

Comment thread lib/traceql/parser.go Resolved
Comment thread lib/traceql/filter_general.go Resolved
@jiekun jiekun added the bug Something isn't working label Nov 27, 2026
@jiekun jiekun self-assigned this Nov 27, 2026
`{ span.cache.ttl = "30s" }` was translated to `"span_attr:cache.ttl":=30000000000`,
so it never matched a span whose `cache.ttl` attribute is the string `30s`.

Values such as `100ms` are converted to nanoseconds only for the `duration` field now.

Fixes VictoriaMetrics#321
@ZeXi0308
ZeXi0308 force-pushed the fix/traceql-quoted-duration branch from d75382f to 1ce53ae Compare November 27, 2026 18:29
@ZeXi0308 ZeXi0308 changed the title lib/traceql: do not convert quoted values to durations lib/traceql: convert durations for the duration field only Nov 27, 2026

@jiekun jiekun left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the contribution!

@jiekun
jiekun merged commit 0282b88 into VictoriaMetrics:master Nov 30, 2026
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tempo API: { span.cache.ttl = "30s" } does not find spans whose attribute is the string 30s

2 participants