Skip to content

[usage] Instantiate now after we've collected all usage data#12759

Merged
roboquat merged 1 commit into
mainfrom
mp/usage-time-after-data
Sep 8, 2022
Merged

[usage] Instantiate now after we've collected all usage data#12759
roboquat merged 1 commit into
mainfrom
mp/usage-time-after-data

Conversation

@easyCZ

@easyCZ easyCZ commented Sep 8, 2022

Copy link
Copy Markdown
Member

Description

In the original case, we'd compute time as t, but we'd then go fetch instances and possibly find ones which which only started running after t. This would result in now - t.Started() to be negative, and hence negative runtime

Related Issue(s)

Fixes #

How to test

Release Notes

NONE

Documentation

Werft options:

  • /werft with-preview

@easyCZ
easyCZ requested a review from a team September 8, 2022 08:54
@github-actions github-actions Bot added team: webapp Issue belongs to the WebApp team and removed size/XS labels Sep 8, 2022
instances = append(instances, instancesWithUsageInDraft...)

// now has to be computed after we've collected all data, to ensure that it's always greater than any of the records we fetch
now := s.nowFunc()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this might be an improvement and will fix ti.

☁️ Note that this alone is not a guarantee that startTimes are not greated than now in a distributed setting. But maybe reasonably safe to assume, yes.

@geropl geropl left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

👍

@roboquat
roboquat merged commit cd087fe into main Sep 8, 2022
@roboquat
roboquat deleted the mp/usage-time-after-data branch September 8, 2022 09:01
@roboquat roboquat added deployed: webapp Meta team change is running in production deployed Change is completely running in production labels Sep 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

deployed: webapp Meta team change is running in production deployed Change is completely running in production release-note-none team: webapp Issue belongs to the WebApp team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants