Skip to content

fix(logs): use UnixMilli for v1 logs search timestamps#15

Closed
ibrahimridene wants to merge 1 commit into
mainfrom
ibrahim.ridene/fix-logs-search-timestamp
Closed

fix(logs): use UnixMilli for v1 logs search timestamps#15
ibrahimridene wants to merge 1 commit into
mainfrom
ibrahim.ridene/fix-logs-search-timestamp

Conversation

@ibrahimridene
Copy link
Copy Markdown

Summary

  • parseTimeString returns milliseconds but runLogsSearch passed them to time.Unix() which expects seconds
  • This produced timestamps far in the future (~year 65,000), causing 400 Bad Request from the Datadog API
  • Fixed by using time.UnixMilli() instead of time.Unix()

Test plan

  • Run pup logs search --query="status:error" --from="1h" and verify it returns results instead of 400
  • Run pup logs search --query="*" --from="30m" --limit=5 to confirm basic queries work

🤖 Generated with Claude Code

parseTimeString returns milliseconds but runLogsSearch passed them to
time.Unix which expects seconds, producing timestamps far in the future
and causing 400 Bad Request from the API.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ibrahimridene ibrahimridene requested a review from a team as a code owner February 10, 2026 13:16
@github-actions
Copy link
Copy Markdown

📊 Test Coverage Report

Overall Coverage: 75.5% Coverage

Threshold: 80% ❌

Coverage by Package
## Coverage by Package

- github.com/DataDog/pup/pkg/auth/callback/server.go:40: 81.2%
- github.com/DataDog/pup/pkg/auth/dcr/client.go:28: 100.0%
- github.com/DataDog/pup/pkg/auth/dcr/types.go:24: 100.0%
- github.com/DataDog/pup/pkg/auth/oauth/client.go:22: 100.0%
- github.com/DataDog/pup/pkg/auth/oauth/pkce.go:24: 85.7%
- github.com/DataDog/pup/pkg/auth/storage/factory.go:53: 94.7%
- github.com/DataDog/pup/pkg/auth/storage/keychain.go:44: 42.9%
- github.com/DataDog/pup/pkg/auth/storage/storage.go:58: 71.4%
- github.com/DataDog/pup/pkg/auth/types/types.go:23: 100.0%
- github.com/DataDog/pup/pkg/client/client.go:33: 94.4%
- github.com/DataDog/pup/pkg/config/config.go:22: 100.0%
- github.com/DataDog/pup/pkg/formatter/formatter.go:31: 100.0%
- github.com/DataDog/pup/pkg/util/time.go:20: 95.8%

## Summary

total:								(statements)		75.5%

📈 Coverage Status: ❌ FAILED - Coverage below minimum threshold

Updated for commit 0dda97c

@platinummonkey platinummonkey deleted the ibrahim.ridene/fix-logs-search-timestamp branch February 22, 2026 03:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant