Skip to content

feat: adapt requeuing when session is hibernated - #1185

Open
sgaist wants to merge 8 commits into
mainfrom
feat/improve-requeuing-timing
Open

feat: adapt requeuing when session is hibernated#1185
sgaist wants to merge 8 commits into
mainfrom
feat/improve-requeuing-timing

Conversation

@sgaist

@sgaist sgaist commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

Describe your changes

Currently, the operator checks on all sessions every 10 seconds.

This is not needed anymore once a pod has been hibernated.
Therefore queue for the MaxHibernationDuration.

If it's awaken before, there will be an event that will trigger an earlier reconciliation.

Once a pod has been hibernated, queue for the MaxHibernationDuration.
If it's awaken before, there will be an event and otherwise, it
avoids checking it every 10 seconds.
@sgaist
sgaist requested review from a team and olevski as code owners July 21, 2026 13:57

@leafty leafty 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.

This change prevents prometheus metrics to be collected for a paused session.

See:

RecordAmaltheaSessionMetrics(amaltheasession)

@sgaist

sgaist commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator Author

Thinking about this a bit more:

  • Can we consider bringing the interval to say 60s ? I don't think there's a need for a lower resolution check for hibernated sessions
  • Should we consider using a different mechanism to log hibernated sessions statistics ?

@olevski

olevski commented Aug 19, 2026

Copy link
Copy Markdown
Member

Should we consider using a different mechanism to log hibernated sessions statistics ?

I agree, yes. We should not be prevented from adjusting this just for the sake of publishing metrics.

Can we consider bringing the interval to say 60s ? I don't think there's a need for a lower resolution check for hibernated sessions

So in the meantime we can go to 60 sec for hibernated sessions. I would go for merging this with 60 sec hibernation interval and without breaking the metrics.

Then in a followup pr lets change the metrics collection and further increase the requeue interval as you originally intended. Wdyt? If not we can do everything all at once. Let me know @sgaist

@sgaist

sgaist commented Aug 19, 2026

Copy link
Copy Markdown
Collaborator Author

Sounds good to me

sgaist added 3 commits August 19, 2026 17:52
This allows to keep meaningful metrics while keeping
the operator less occupied.

Metrics gathering will be refactored in a subsequent
patch.
@olevski

olevski commented Aug 20, 2026

Copy link
Copy Markdown
Member

@sgaist the cyclomatic complexity on the linter is triggering. You can ignore that rule on the current fuction or you can just fully disable that. It is one of the default checks on the linter we got for "free" but we never consciously turned it on.

sgaist added 3 commits August 20, 2026 16:49
The same logic was copied in multiple places with just
small differences. These are small enough that they can
be put in function that can be passed to to status update
function.
@sgaist

sgaist commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator Author

@olevski I added some cleanups as they where hanging things that I wanted to tackle anyway and it fixed the cyclomatic complexity issue.

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.

3 participants