metrics: fix overhead_program_seconds_total unit (ns -> s)#4830
metrics: fix overhead_program_seconds_total unit (ns -> s)#4830danilovid wants to merge 1 commit intocilium:mainfrom
Conversation
ah sorry I was unclear I meant after this patch, the typical output in the HTTP reply, I just wanted to make sure there's no rounding or so, it should be 10-9/10-8 numbers I imagine. |
After the patch, the metric values look correct: tetragon_overhead_program_seconds_total{attach="wake_up_new_task",...} 0.003527708 Average: 0.003527708 / 249 = ~14 µs per call - which is a realistic value for a BPF program. Before the patch the same metric would show values like 3527708 (nanoseconds reported as seconds). |
|
It looks like it's almost there you just need to fix checkpatch complaints, mostly commit title length and sign off missing: On sign-offTo improve tracking of who did what, the Tetragon project uses a "sign-off" procedure which you can learn more about in the Cilium project documentation. Concretely it consists of adding your real name and an email address to your git config and using See more details on how to comply with the "sign-off" procedure
To add your name and email to your git config: git config user.email "mail@example.com"
git config user.name "firstname lastname"Note: add the Then you can use for new commits: git commit -sOr for existing commits on which you want to add the git commit --amend -sFor more information, see this extract from |
The metric tetragon_overhead_program_seconds_total was incorrectly storing nanoseconds (raw RunTimeNs from BPF program stats) despite the _seconds_total naming convention. The root cause was an early conversion of time.Duration to uint64 in ProgOverhead.RunTime, which lost the type context. Following the Prometheus convention, keep time.Duration throughout and only convert to seconds when collecting metrics using m.Seconds(). Fixes: tetragon_overhead_program_seconds_total reporting values ~1e9 too large. Signed-off-by: Ilya Danilov <danilovid.94@gmail.com>
b66f2b4 to
903457c
Compare
✅ Deploy Preview for tetragon ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |


The metric
tetragon_overhead_program_seconds_totalwas incorrectly storingnanoseconds (raw
RunTimeNsfrom BPF program stats) despite the_seconds_totalnaming convention.
The root cause was an early conversion of
time.Durationtouint64inProgOverhead.RunTime, which lost the type context. Following the Prometheusconvention,
time.Durationis now kept throughout and converted to secondsonly when collecting metrics using
m.Seconds().Fixes #4829
Description
Keep
time.DurationinProgOverhead.RunTimeinstead of converting touint64,and use
m.Seconds()when reporting to Prometheus.Changelog