Repository navigation
fix(observability): stamp HTTP logs with request-issue time (SDK-6164) - #67
Merged
shubhamkd merged 1 commit intoNov 2, 2026
Conversation
SDK-6164: HTTP logs rendered out of order in the Test Observability Logs tab. createHttpLogEvent stamped the LogCreated event with httpResponse[0], the instant the response landed. Nightwatch pushes each httpOutput entry as [isoTimestamp, message, params] when the line is logged, so httpResponse[0] is request-issue time plus the whole round trip. A slow request therefore carried a later timestamp than logs emitted while it was still in flight and sorted after them. Stamp with httpRequest[0] instead. duration_ms is computed from both entries independently, so it still spans request -> response and no metric changes. This also matches createScreenshotLogEvent, which already stamps with the command's startTime. Adds test/src/test-observability/createHttpLogEvent.js (4 cases).
harshit-browserstack
approved these changes
Oct 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
HTTP logs render out of order in the Test Observability Logs tab.
createHttpLogEventstamps eachLogCreated/HTTPevent withhttpResponse[0], the moment the response landed. The backend orders log events bytimestamp, so a request that takes 5s carries a timestamp 5s after it was issued and sorts after every log line the test wrote while it was still in flight.Nightwatch pushes each
httpOutputentry as[isoTimestamp, message, params]when the line is logged:logRequest()runs before the request is sent,logResponse()fromonRequestComplete. SohttpResponse[0]is request-issue time plus the whole round trip.duration_msis computed from both entries independently, so it still spans request → response and no metric changes. This also matchescreateScreenshotLogEvent, which already stamps with the command's start time.Out of scope: a per-process
sequencetiebreaker for logs sharing the same millisecond. It is inert until the backend sorts on(timestamp, sequence), so it will follow separately once that lands.No version bump in this PR; the release is left to the maintainers.
Diff: 2 files, +89 −1, of which 85 lines are the new test file
test/src/test-observability/createHttpLogEvent.js.Verification
Unit tests (
npm test)4 new cases, all passing:
duration_msstill spans the full request → response;timestamp;Full suite (Node 20, credentials unset): 163 passing, 1 failing. The failing test (
getBuildName→ "returns empty for empty options") fails identically onmain— it asserts the checkout directory name. eslint clean.Linked ticket: BrowserStack SDK-6164
🤖 Generated with Claude Code