Skip to content

add duration seconds reporting#1528

Merged
paulwe merged 4 commits intomainfrom
second-reporting
May 2, 2026
Merged

add duration seconds reporting#1528
paulwe merged 4 commits intomainfrom
second-reporting

Conversation

@paulwe
Copy link
Copy Markdown
Contributor

@paulwe paulwe commented May 2, 2026

No description provided.

@paulwe paulwe requested review from a team May 2, 2026 12:15
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 2, 2026

🦋 Changeset detected

Latest commit: ad4d073

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

💥 An error occurred when fetching the changed packages and changesets in this PR
Some errors occurred when validating the changesets config:
The package or glob expression "github.com/livekit/protocol" specified in the `fixed` option does not match any package in the project. You may have misspelled the package name or provided an invalid glob expression. Note that glob expressions must be defined according to https://www.npmjs.com/package/micromatch.

Comment thread observability/sessiontimer.go Outdated
h.lastMilli = ts
}
if ts > h.lastSec {
n := max((ts-h.lastSec+999)/1000, h.minSecs)
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.

comments says so, but just wanted to confirm that this is intentional, i. e. however small the first advance is and however min big min seconds, it is applied.

To take an exaggerated example, if min seconds is 100 and the first advance is 1ms, it will count 100 the first time and then let us say there are 100 more updates every second, the total would be close 200 seconds at the end, i.e 100s wall block time elapsed, but 200 secs counted. Is that understanding correct?

My mental model was "100s minimum, anything less than 100s will round up to 100s, after that, it will be elapsed time with 1 second granularity"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

h.lastSec is advanced by n * 1000 so on the first tick in your example we return 100 then for the next 100 seconds we return 0 then we begin returning rounded/elapsed seconds

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.

🤦 missed that detail. Thank you Paul.

@paulwe paulwe merged commit 3c9faab into main May 2, 2026
8 checks passed
@paulwe paulwe deleted the second-reporting branch May 2, 2026 13:17
@github-actions github-actions Bot mentioned this pull request May 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants