client: emit optional telemetry from prerun and prestart hooks. #24556
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
The Nomad client can now optionally emit telemetry data from the prerun and prestart hooks. This allows operators to monitor and alert on failures and time taken to complete.
The new datapoints are:
nomad.client.alloc_hook.prerun.success (counter)
nomad.client.alloc_hook.prerun.failed (counter)
nomad.client.alloc_hook.prerun.elapsed (sample)
nomad.client.task_hook.prestart.success (counter)
nomad.client.task_hook.prestart.failed (counter)
nomad.client.task_hook.prestart.elapsed (sample)
The hook execution time is useful to Nomad engineering and will help optimize code where possible and understand job specification impacts on hook performance.
Currently only the PreRun and PreStart hooks have telemetry enabled, so we limit the number of new metrics being produced.
Testing & Reproduction steps
I tested on a Debian 12 arm64 using a single agent in server/client mode with this configuration.
while true; do; nomad job dispatch sleep; sleep 2; done
to generate metricspromana monitoring job spec:
sleep job spec:
Links
Jira: https://hashicorp.atlassian.net/browse/NET-11237
RFC: https://go.hashi.co/rfc/nmd-206
Contributor Checklist
changelog entry using the
make cl
command.ensure regressions will be caught.
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
backporting document.
in the majority of situations. The main exceptions are long-lived feature branches or merges where
history should be preserved.
within the public repository.