8000 fix(coderd): ensure agent timings are non-zero on insert by johnstcn · Pull Request #18065 · coder/coder · GitHub
[go: up one dir, main page]

Skip to content

fix(coderd): ensure agent timings are non-zero on insert #18065

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

Merged
merged 7 commits into from
May 29, 2025

Conversation

johnstcn
Copy link
Member
@johnstcn johnstcn commented May 27, 2025

Relates to #15432

I checked in our dogfood database and couldn't find any instances of timings where started_at or ended_at was the zero time. However it makes sense to me to ensure this can't ever happen.

@johnstcn johnstcn self-assigned this May 27, 2025
@johnstcn johnstcn marked this pull request as ready for review May 27, 2025 17:31
@johnstcn johnstcn changed the title fix(coderd): ensure agent timings are present on insert fix(coderd): ensure agent timings are non-zero on insert May 27, 2025
Copy link
Contributor
@DanielleMaywood DanielleMaywood left a comment

Choose a reason for hiding this comment

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

small non-blocking comment but otherwise looks good to me

8000 Copy link
Member
@mafredri mafredri left a comment

Choose a reason for hiding this comment

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

I think the extra validation is good, but this fix doesn't seem to address the issue raised in #15432?

)
continue
}

Copy link
Member
@mafredri mafredri May 28, 2025

Choose a reason for hiding this comment

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

The issue referenced in #15432 originates from the codersdk.TimingStageConnect timing that's further down, but that one doesn't seem addressed?

The agent.FirstConnectedAt.Time is used unconditionally, but may be null. Do we have a way to represent this better?

We could always omit the entry, but personally I'd like to see it in the graph as an unterminated starting point, would give an indication we're waiting for something.

Copy link
Member Author

Choose a reason for hiding this comment

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

We could represent both of these as codersdk.NullTime instead.

Copy link
Member Author

Choose a reason for hiding this comment

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

It turns out the timings chart is built to render with a "loading" state until all of provisioner timings, script timings, and connection timings are populated with at least one value. The assumption here is that timings are only useful after a build has completed.

My previous change (#18058) adds a check in the UI so that causes a time range with a zero time to be rendered as an "instant" with an "Invalid" label.

I think that, for now, it makes sense to simply exclude the agent connection timing if !FirstConnectedAt.Valid. Does that sound alright?

Copy link
Member

Choose a reason for hiding this comment

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

I'm fine with that if it can show up later if the agent finally connects 👍🏻

Copy link
Member
@mafredri mafredri left a comment

Choose a reason for hiding this comment

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

Small suggestion, but otherwise LGTM!

@johnstcn johnstcn merged commit 776c144 into main May 29, 2025
29 checks passed
@johnstcn johnstcn deleted the cj/no-zero-timings branch May 29, 2025 12:36
@github-actions github-actions bot locked and limited conversation to collaborators May 29, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0