Repository navigation
vtselect: fix trace search when running with a non-UTC time zone - #262
Conversation
There was a problem hiding this comment.
All reported issues were addressed across 3 files
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
There was a problem hiding this comment.
All reported issues were addressed across 3 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
58afeeb to
226fc37
Compare
|
Hi @Vandit1604! Thanks a lot for yet another fix. The RCA is spot‑on. That said, the string comparison (which was written by me) is clunky and not robust enough, and it also contributed to this bug. I’d like to take this opportunity to propose changing it to a timestamp comparison instead. What do you think? You can refer to the latest revision of this branch. |
|
@jiekun the timestamp comparison looks good to me, and it passes the full test suite and I also have an apptest that starts vtsingle with a non-UTC |
|
@Vandit1604 Hi! Sure, an new test case will definitely help. Feel free to make changes to the existing vtsingle apptest setup. I will follow up and make adjustments if necessary. |
|
@jiekun Done. I added I also measured your version again and updated the PR description with the new numbers. |
There was a problem hiding this comment.
1 issue found across 3 files (changes from recent commits).
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="apptest/testcase.go">
<violation number="1" location="apptest/testcase.go:167">
P3: Merging `MustStartVtsingleWithEnv` back into `MustStartVtsingle` silently drops the documentation of the new `env` parameter: the removed helper's doc comment explicitly explained that environment variables such as `TZ` are passed to the process, while `MustStartVtsingle` (and `MustStartVtagent`) now take `env ...string` without any doc mention. Mention the optional `env` in both doc comments so tests that need a non-UTC `TZ` are discoverable.</violation>
</file>
Tip: Review your code locally with the cubic CLI to iterate faster.
Fix all with cubic | Re-trigger cubic
| // MustStartVtsingle is a test helper function that starts an instance of | ||
| // vtsingle and fails the test if the app fails to start. | ||
| func (tc *TestCase) MustStartVtsingle(instance string, flags []string) *Vtsingle { | ||
| func (tc *TestCase) MustStartVtsingle(instance string, flags []string, env ...string) *Vtsingle { |
There was a problem hiding this comment.
P3: Merging MustStartVtsingleWithEnv back into MustStartVtsingle silently drops the documentation of the new env parameter: the removed helper's doc comment explicitly explained that environment variables such as TZ are passed to the process, while MustStartVtsingle (and MustStartVtagent) now take env ...string without any doc mention. Mention the optional env in both doc comments so tests that need a non-UTC TZ are discoverable.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. 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. At apptest/testcase.go, line 167:
<comment>Merging `MustStartVtsingleWithEnv` back into `MustStartVtsingle` silently drops the documentation of the new `env` parameter: the removed helper's doc comment explicitly explained that environment variables such as `TZ` are passed to the process, while `MustStartVtsingle` (and `MustStartVtagent`) now take `env ...string` without any doc mention. Mention the optional `env` in both doc comments so tests that need a non-UTC `TZ` are discoverable.</comment>
<file context>
@@ -164,15 +164,7 @@ func (tc *TestCase) MustStartDefaultVtsingle() *Vtsingle {
-// MustStartVtsingleWithEnv is like MustStartVtsingle, but also passes the given
-// environment variables, such as TZ, to the vtsingle process.
-func (tc *TestCase) MustStartVtsingleWithEnv(instance string, flags, env []string) *Vtsingle {
+func (tc *TestCase) MustStartVtsingle(instance string, flags []string, env ...string) *Vtsingle {
tc.t.Helper()
</file context>
|
Thank you for the contribution! |
Fixes #260
The Jaeger and Tempo search APIs return fewer traces or none when VictoriaTraces runs with a time zone behind UTC, such as
America/New_York.findTraceIDsSplitTimeRangefinds the earliest trace start by comparing strings. The_timevalues are UTC, butendTimewas formatted in the local time zone. Behind UTC, this gave the wrong start time for the span query that follows.The function now parses
_timewithlogstorage.TryParseTimestampRFC3339Nanoand compares Unix nanoseconds, in both copies, inquery/query.goandtempo/query.go.Same data and queries,
limit=1000. Jaeger and Tempo return the same counts:TZminDuration=100msUTCAmerica/New_YorkAmerica/New_YorkTestSingleSearchTracesNonUTCTimezoneruns vtsingle withTZ=America/New_Yorkand checks both APIs. The apptest harness now passes environment variables to vtsingle.The reporter of #260 runs VictoriaTraces on a host in
America/Chicago, and confirmed thatTZ=UTCfixes the search.