Skip to content
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

reporting: Update server to accommodate new enterprise reporting. #24919

Merged
merged 1 commit into from
Jan 24, 2025

Conversation

jrasell
Copy link
Member

@jrasell jrasell commented Jan 23, 2025

Nomad Enterprise will utilise new reporting metrics and the changes here allow this work to be conducted.

The server specific GetClientNodesCount function has been removed from CE as this is only called within enterprise code. A new heartbeater function allows us to get the number of active timers, which can be used by the heartbeater metrics and any other callers that want this data.

PR Process Notes

This has been originally reviewed within the enterprise codebase.

In order to juggle the CE and Enterprise specific code portions, I plan on backporting this change to CE only and then performing manual merging into Enterprise along with the specific changes needed there.

Once the merging juggling has been complete, I will raise a followup documentation and changelog PR.

Links

Jira: https://hashicorp.atlassian.net/browse/NET-9340

Contributor Checklist

  • Changelog Entry If this PR changes user-facing behavior, please generate and add a
    changelog entry using the make cl command.
  • Testing Please add tests to cover any new functionality or to demonstrate bug fixes and
    ensure regressions will be caught.
  • Documentation If the change impacts user-facing functionality such as the CLI, API, UI,
    and job configuration, please update the Nomad website documentation to reflect this. Refer to
    the website README for docs guidelines. Please also consider whether the
    change requires notes within the upgrade guide.

Reviewer Checklist

  • Backport Labels Please add the correct backport labels as described by the internal
    backporting document.
  • Commit Type Ensure the correct merge method is selected which should be "squash and merge"
    in the majority of situations. The main exceptions are long-lived feature branches or merges where
    history should be preserved.
  • Enterprise PRs If this is an enterprise only PR, please add any required changelog entry
    within the public repository.

Nomad Enterprise will utilise new reporting metrics and the
changes here allow this work to be conducted.

The server specific GetClientNodesCount function has been remomved
from CE as this is only called within enterprise code. A new
heartbeater function allows us to get the number of active timers,
which can be used by the heartbeater metrics and any other callers
that want this data.
@jrasell jrasell added the backport/1.9.x backport to 1.9.x release line label Jan 23, 2025
@jrasell jrasell self-assigned this Jan 23, 2025
@jrasell jrasell requested review from a team as code owners January 23, 2025 09:13
Copy link
Member

@tgross tgross left a comment

Choose a reason for hiding this comment

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

LGTM

There's a semgrep rule firing on that heartbeatStats() method around the timer. It's not technically a false positive but it is meaningless. We leak one timer goroutine when we shutdown the agent! I wouldn't worry about this for now.

@jrasell
Copy link
Member Author

jrasell commented Jan 23, 2025

LGTM

There's a semgrep rule firing on that heartbeatStats() method around the timer. It's not technically a false positive but it is meaningless. We leak one timer goroutine when we shutdown the agent! I wouldn't worry about this for now.

Interestingly Go stdlib time library does have the following function comment, so it might not even be a problem:

// Before Go 1.23, this documentation warned that the underlying
// [Timer] would not be recovered by the garbage collector until the
// timer fired, and that if efficiency was a concern, code should use
// NewTimer instead and call [Timer.Stop] if the timer is no longer needed.
// As of Go 1.23, the garbage collector can recover unreferenced,
// unstopped timers. There is no reason to prefer NewTimer when After will do.

@jrasell jrasell merged commit 739e5ed into main Jan 24, 2025
32 of 33 checks passed
@jrasell jrasell deleted the b-NET-9340-ce branch January 24, 2025 08:00
jrasell added a commit that referenced this pull request Jan 24, 2025
jrasell added a commit that referenced this pull request Jan 24, 2025
jrasell added a commit that referenced this pull request Jan 24, 2025
backport of commit b4d71f6 

Co-authored-by: James Rasell <jrasell@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/1.9.x backport to 1.9.x release line
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants