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

Generate metrics reference docs #2124

Conversation

lambdanis
Copy link
Contributor

@lambdanis lambdanis commented Feb 19, 2024

It depends on #2162, so pls review that one first.

It also requires isovalent/metricstool#3 to be merged and then a release of metricstool.

Fixes #1856

@lambdanis lambdanis added area/documentation Improvements or additions to documentation release-note/docs This PR updates the documentation. labels Feb 19, 2024
@lambdanis lambdanis force-pushed the pr/lambdanis/metricsmd branch 2 times, most recently from b46f0bf to 465cd54 Compare February 20, 2024 00:38
Copy link

netlify bot commented Feb 20, 2024

Deploy Preview for tetragon ready!

Name Link
🔨 Latest commit 187d10a
🔍 Latest deploy log https://app.netlify.com/sites/tetragon/deploys/65df60f8366b620008d07828
😎 Deploy Preview https://deploy-preview-2124--tetragon.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@lambdanis lambdanis force-pushed the pr/lambdanis/metricsmd branch 2 times, most recently from ceb30a5 to e28c7c7 Compare February 20, 2024 13:01
@lambdanis lambdanis changed the title Pr/lambdanis/metricsmd Generate metrics reference docs Feb 20, 2024
@mtardy
Copy link
Member

mtardy commented Feb 21, 2024

I know it's still a draft but it might be useful for you to check the preview :)

Very nice addition, I'll be happy to review.

This command utilizes github.com/isovalent/metricstool/pkg/metricsmd to
generate a metrics reference.

Signed-off-by: Anna Kapuscinska <[email protected]>
`make metrics-docs` generates metrics reference documentation page using
`tetra metrics-docs` command.

Signed-off-by: Anna Kapuscinska <[email protected]>
Split InitMetrics function into multiple functions to divide metrics into
logical groups. Introduce InitMetricsForDocs function used in `tetra
metrics-docs` command.

There are no functional changes in this commit. This refactoring is
a preparation for further improvements in the generated metrics docs.

Signed-off-by: Anna Kapuscinska <[email protected]>
Update metrics-docs tetra command and Makefile rule to split metrics reference
into three sections: health metrics, resources metrics and events metrics.

Signed-off-by: Anna Kapuscinska <[email protected]>
Initialize tetragon_events_total with all possible event types and example
process metadata.

Initialize tetragon_policy_events_total with example policy and kprobe.

Signed-off-by: Anna Kapuscinska <[email protected]>
Initialize tetragon_generic_kprobe_merge_errors_total with all possible error
types and example kprobes.

Signed-off-by: Anna Kapuscinska <[email protected]>
Initialize tetragon_syscalls_total with example syscall and process metadata.

Signed-off-by: Anna Kapuscinska <[email protected]>
observer.bpfCollector doesn't report any metrics if Tetragon isn't fully
initialized - so also when we generate metrics docs with tetra. To include
observer BPF metrics in metrics docs, let's define a "fake" collector -
observer.bpfZeroCollector - reporting same metrics as observer.bpfCollector
but with hardcoded zero values.

Signed-off-by: Anna Kapuscinska <[email protected]>
eventmetrics.bpfCollector doesn't report any metrics if Tetragon isn't fully
initialized - so also when we generate metrics docs with tetra. To include
BPF event metrics in metrics docs, let's define a "fake" collector -
eventmetrics.bpfZeroCollector - reporting same metrics as eventmetrics.bpfCollector
but with hardcoded zero values.

Signed-off-by: Anna Kapuscinska <[email protected]>
policyStateCollector doesn't report any metrics if Tetragon isn't fully
initialized - so also when we generate metrics docs with tetra. To include
policy state metrics in metrics docs, let's define a "fake" collector -
policyStateZeroCollector - reporting same metrics as policyStateZeroCollector
but with hardcoded zero values.

Signed-off-by: Anna Kapuscinska <[email protected]>
Signed-off-by: Anna Kapuscinska <[email protected]>
@lambdanis lambdanis changed the base branch from main to pr/lambdanis/metrics-init-labels February 28, 2024 16:37
@lambdanis lambdanis marked this pull request as ready for review February 28, 2024 16:41
@lambdanis
Copy link
Contributor Author

I'll re-open this PR from a branch in the repo not a fork, so that others can push easily.

@lambdanis lambdanis closed this Feb 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/documentation Improvements or additions to documentation release-note/docs This PR updates the documentation.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

docs: Add a metrics reference
2 participants