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

Use Prometheus registry when specified #1034

Merged
merged 2 commits into from
Jul 18, 2024
Merged

Use Prometheus registry when specified #1034

merged 2 commits into from
Jul 18, 2024

Conversation

marctc
Copy link
Contributor

@marctc marctc commented Jul 17, 2024

This PR enables using the Prometheus Registry (for Alloy) for the following metrics:

  • Internal metrics
  • Network metrics
  • Process metrics

@marctc marctc requested review from grcevski and mariomac as code owners July 17, 2024 16:14
@@ -114,9 +114,9 @@ func buildCommonContextInfo(
config.Attributes.Kubernetes.InformersSyncTimeout,
),
}
if config.InternalMetrics.Prometheus.Port != 0 {
if config.InternalMetrics.Prometheus.Port != 0 || config.Prometheus.Registry != nil {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This would enable internal metrics by default when using Alloy. Any opinions against it?

Copy link
Contributor

Choose a reason for hiding this comment

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

My only concern is open port for a container which is running with elevated permissions. It could increase the attack surface by default.

Copy link
Contributor

@grcevski grcevski left a comment

Choose a reason for hiding this comment

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

LGTM! One remark about making internal metrics on by default. Perhaps we can ensure it's listening only on localhost?

@@ -114,9 +114,9 @@ func buildCommonContextInfo(
config.Attributes.Kubernetes.InformersSyncTimeout,
),
}
if config.InternalMetrics.Prometheus.Port != 0 {
if config.InternalMetrics.Prometheus.Port != 0 || config.Prometheus.Registry != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

My only concern is open port for a container which is running with elevated permissions. It could increase the attack surface by default.

Base automatically changed from make_export_package_public to main July 18, 2024 08:35
@marctc marctc force-pushed the prometheus_registry branch from e4fa1ca to 7fba337 Compare July 18, 2024 08:37
@codecov-commenter
Copy link

codecov-commenter commented Jul 18, 2024

Codecov Report

Attention: Patch coverage is 49.05660% with 27 lines in your changes missing coverage. Please review.

Project coverage is 81.46%. Comparing base (b28b9e1) to head (0da6d01).

Files Patch % Lines
pkg/internal/imetrics/iprom.go 54.54% 8 Missing and 2 partials ⚠️
pkg/export/prom/prom_proc.go 43.75% 6 Missing and 3 partials ⚠️
pkg/export/prom/prom_net.go 37.50% 2 Missing and 3 partials ⚠️
pkg/components/beyla.go 57.14% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1034      +/-   ##
==========================================
- Coverage   81.66%   81.46%   -0.21%     
==========================================
  Files         137      137              
  Lines       10923    10956      +33     
==========================================
+ Hits         8920     8925       +5     
- Misses       1496     1515      +19     
- Partials      507      516       +9     
Flag Coverage Δ
integration-test 56.27% <43.39%> (-0.13%) ⬇️
k8s-integration-test 58.80% <49.05%> (-0.27%) ⬇️
oats-test 37.24% <3.77%> (-0.10%) ⬇️
unittests 50.99% <22.64%> (-0.07%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@marctc marctc merged commit 80c5d62 into main Jul 18, 2024
6 checks passed
@marctc marctc deleted the prometheus_registry branch July 18, 2024 09:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants