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

Doc: Tetragon metrics #1495

Merged
merged 1 commit into from
Sep 29, 2023
Merged

Conversation

prateek041
Copy link
Contributor

@prateek041 prateek041 commented Sep 19, 2023

Closes #928

This PR:

  • Adds how to read tetragon metrics with Kubernetes and Package installation setup.

@netlify
Copy link

netlify bot commented Sep 19, 2023

Deploy Preview for tetragon ready!

Name Link
🔨 Latest commit ee14431
🔍 Latest deploy log https://app.netlify.com/sites/tetragon/deploys/65130f45c5b10000080d7592
😎 Deploy Preview https://deploy-preview-1495--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.

@prateek041 prateek041 added area/documentation Improvements or additions to documentation release-note/docs This PR updates the documentation. and removed area/documentation Improvements or additions to documentation labels Sep 19, 2023
@lambdanis lambdanis added the area/documentation Improvements or additions to documentation label Sep 20, 2023
@lambdanis
Copy link
Contributor

Thank you @prateek041 for this PR. Some high-level comments I have:

  1. The intro is very friendly for people not proficient with Kubernetes, but I'm not sure if it belongs to the metrics page. I would rather add a "Validation" section to https://tetragon.cilium.io/docs/getting-started/deployment/kubernetes/, describing what to expect and how to check if Tetragon is running. Then the metrics page can just refer to the Kubernetes deployment page.
  2. Can we use the tetragon service in this tutorial, instead of port-forwarding the pod directly? That is, kubectl -n kube-system port-forward service/tetragon 2112:2112. The port can also be checked by describing the service. In a tutorial for Kubernetes I think we should use the Kubernetes abstractions instead of interacting with containers directly.

@prateek041
Copy link
Contributor Author

Thank you @lambdanis for the review, making changes now.

Copy link
Member

@tixxdz tixxdz left a comment

Choose a reason for hiding this comment

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

LGTM, @prateek041 as long as it works let's please merge it


Tetragon, when installed via release packages as mentioned in [Package Deployment](../getting-started/deployment/package.md). It can be interacted with `tetragon` command. By default, metrics are disabled, which can be enabled using `--metrics-server` flag, by specifying the address.

Copy link
Member

Choose a reason for hiding this comment

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

Hi @prateek041 please add that you can set the metrics address server by creating a file under /etc/tetragon/tetragon.conf.d/metrics-server with the address server as content, example localhost:2112

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

looking into it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added a section does this work ?

@tixxdz

docs/content/en/docs/tutorials/tetragon-metrics.md Outdated Show resolved Hide resolved
@tixxdz
Copy link
Member

tixxdz commented Sep 22, 2023

Closes #928

This PR:

* Adds how to read tetragon metrics with different installation setup.

I guess this is done right?

Beside container stuff that should be contributed in another PR

* Explain Tetragon metrics

This is the part that is still missing right? can you do it in separate PR, please so we can merge this and have the metrics explained maybe in the reference? @jrfastab @michi-covalent wdyt reference for metrics is better?

@tixxdz
Copy link
Member

tixxdz commented Sep 22, 2023

You have one CI link failure I guess at the end you do package.md should be just package/ without .md

@michi-covalent
Copy link
Contributor

This is the part that is still missing right? can you do it in separate PR, please so we can merge this and have the metrics explained maybe in the reference?

yeah let's do a separate PR

@prateek041
Copy link
Contributor Author

Let me make the suggested changes and push.

Copy link
Contributor

@lambdanis lambdanis left a comment

Choose a reason for hiding this comment

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

Looks good, thank you @prateek041 for the updates.

  • Explain Tetragon metrics
    This is the part that is still missing right? can you do it in separate PR, please so we can merge this and have the metrics explained maybe in the reference?

Tetragon will have an autogenerated metrics reference soon™, so there is no need to explain metrics in this PR. Unless you have a specific idea what needs an extra explanation in addition to the reference?

docs/content/en/docs/tutorials/tetragon-metrics.md Outdated Show resolved Hide resolved
docs/content/en/docs/tutorials/tetragon-metrics.md Outdated Show resolved Hide resolved
Copy link
Member

@mtardy mtardy left a comment

Choose a reason for hiding this comment

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

Thank you for taking the time to do this. Sorry if it looks overwhelming, I have many comments this time. Please tell me if you don't understand any and need clarification. :)

docs/content/en/docs/tutorials/tetragon-metrics.md Outdated Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

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

please can you wrap the lines at ~80 chars?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh sorry for that, I had soft-wrap on, so it appeared Ok on my IDE. fixed that

Copy link
Member

Choose a reason for hiding this comment

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

no worries

docs/content/en/docs/tutorials/tetragon-metrics.md Outdated Show resolved Hide resolved
docs/content/en/docs/tutorials/tetragon-metrics.md Outdated Show resolved Hide resolved
docs/content/en/docs/tutorials/tetragon-metrics.md Outdated Show resolved Hide resolved
docs/content/en/docs/tutorials/tetragon-metrics.md Outdated Show resolved Hide resolved
docs/content/en/docs/tutorials/tetragon-metrics.md Outdated Show resolved Hide resolved
docs/content/en/docs/tutorials/tetragon-metrics.md Outdated Show resolved Hide resolved
Comment on lines 98 to 104
### Fetch the Metrics

Then the exposed metrics can be fetched using `curl` command at `localhost:2112/metrics`

```shell
➜ ~ curl localhost:2112/metrics

# HELP promhttp_metric_handler_errors_total Total number of internal errors encountered by the promhttp metric handler.
# TYPE promhttp_metric_handler_errors_total counter
promhttp_metric_handler_errors_total{cause="encoding"} 0
promhttp_metric_handler_errors_total{cause="gathering"} 0
# HELP tetragon_errors_total The total number of Tetragon errors. For internal use only.
# TYPE tetragon_errors_total counter
...
```
Copy link
Member

Choose a reason for hiding this comment

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

I think instead of repeating this, we can factorize the way to reach the metrics endpoint, maybe with tabs or simply as you did with section headers and then have a single "fetch the metrics" instead of identical ones like that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, added a "Fetch the metrics" section at the end, please take a look, and tell if it needs to be changed.

@mtardy
Copy link
Member

mtardy commented Sep 22, 2023

by the way, we all reviewed while this was still a draft, please put it in ready for review when you think it's good.

@mtardy
Copy link
Member

mtardy commented Sep 22, 2023

Tetragon will have an autogenerated metrics reference soon™, so there is no need to explain metrics in this PR.

Oh that's great @lambdanis, please ask me to review the PR when you do this as we need to exclude some generated files from the ownership code review thingie

# Exclude some docs generated files from mtardy ownership
/docs/content/en/docs/reference/grpc-api.md @cilium/tetragon
/docs/content/en/docs/reference/helm-chart.md @cilium/tetragon

And also I'm curious about scripts, we have two at the moment for this purpose:

@prateek041 prateek041 force-pushed the pr/prateek/metric-tutorial branch from caf7d89 to 1ee9234 Compare September 22, 2023 18:21
@prateek041 prateek041 marked this pull request as ready for review September 22, 2023 18:28
@prateek041 prateek041 requested a review from a team as a code owner September 22, 2023 18:28
Copy link
Member

@tixxdz tixxdz left a comment

Choose a reason for hiding this comment

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

So thanks for all these changes, still 2 more things I noted them, please do fix then from my part acke'ed thanks ;-)

Copy link
Contributor

@lambdanis lambdanis left a comment

Choose a reason for hiding this comment

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

I left two suggestions to make things clearer, otherwise looks good.

docs/content/en/docs/tutorials/tetragon-metrics.md Outdated Show resolved Hide resolved
docs/content/en/docs/tutorials/tetragon-metrics.md Outdated Show resolved Hide resolved
Added how to read tetragon metrics with Kubernetes and Package
installation setup.

Signed-off-by: Prateek Singh <prateeksingh9741@gmail.com>
@prateek041 prateek041 force-pushed the pr/prateek/metric-tutorial branch from 1ee9234 to ee14431 Compare September 26, 2023 17:05
@prateek041 prateek041 requested review from tixxdz and mtardy September 26, 2023 17:08
Copy link
Contributor

@lambdanis lambdanis left a comment

Choose a reason for hiding this comment

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

Looks good. In the future I think a tutorial running Prometheus and scraping metrics might be helpful, but this is good as the first iteration.

Copy link
Member

@mtardy mtardy left a comment

Choose a reason for hiding this comment

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

I'm good with the actual state, we can merge if there are no more remarks!

@lambdanis lambdanis merged commit f412c92 into cilium:main Sep 29, 2023
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.

Add documentation/tutorial on how to read Tetragon metrics
5 participants