-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Logs: add support for a start
parameter when reading logs
#1957
Conversation
43e002c
to
6d6353e
Compare
Change-type: patch
This can either be an ISO date or a milliseconds timestamp Change-type: minor
@@ -189,6 +190,7 @@ export class LokiBackend implements DeviceLogsBackend { | |||
query: this.getDeviceQuery(ctx), | |||
limit: Number.isFinite(count) ? count : 1000, | |||
since: '30d', | |||
...(start != null ? { start: `${BigInt(start) * 1000000n}` } : {}), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be v ?
...(start != null ? { start: `${BigInt(start) * 1000000n}` } : {}), | |
...(typeof start === 'number' ? { start: `${BigInt(start) * 1000000n}` } : {}), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nvm I just saw the tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's either undefined
or a number, so both checks should be equivalent?
@@ -225,5 +228,31 @@ export default () => { | |||
'streamed log line 1', | |||
]); | |||
}); | |||
|
|||
for (const fn of ['toISOString', 'getTime'] as const) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
;)
https://balena.fibery.io/Work/Project/Device-logs-Allow-specifying-a-start-date-when-fetching-logs-1164