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

Add two ports to service, daemonset and servicemonitor conditionally #1168

Merged
merged 5 commits into from
Sep 19, 2024

Conversation

marevers
Copy link
Collaborator

Closes #1165

Instead of having a Service with single port and having to choose whether that is the Prometheus metrics or the internal metrics port, this allows for having a single Service with either one or two ports. By default, for ease of use, these are using the values from the Beyla config .Values.config.data.prometheus_export.port and .Values.config.data.internal_metrics.prometheus.port but can be overridden.

In order to accommodate this change, in values.yaml the structure of the Service and ServiceMonitor sections were changed to have dedicated subproperties for the two ports.

The most minimal and easy way to use this change is to enable the Service (and possibly the ServiceMonitor) through the values and then set up the Beyla configuration, for example:

service:
  enabled: true
config:
  create: true
  name: ""
  data:
    prometheus_export:
      port: 9090
      path: /metrics
    internal_metrics:
      prometheus:
        port: 6060
        path: /internal/metrics
serviceMonitor:
  enabled: true

This will result in both the Service and ServiceMonitor being created and using the ports/paths specified in the Beyla config.

@codecov-commenter
Copy link

codecov-commenter commented Sep 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.23%. Comparing base (d0fe930) to head (bb1b1f5).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1168      +/-   ##
==========================================
+ Coverage   81.13%   81.23%   +0.10%     
==========================================
  Files         136      136              
  Lines       11431    11447      +16     
==========================================
+ Hits         9274     9299      +25     
+ Misses       1633     1623      -10     
- Partials      524      525       +1     
Flag Coverage Δ
integration-test 56.96% <ø> (-0.16%) ⬇️
k8s-integration-test 58.83% <ø> (-0.11%) ⬇️
oats-test 35.81% <ø> (-0.06%) ⬇️
unittests 53.50% <ø> (+0.13%) ⬆️

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.

@marevers
Copy link
Collaborator Author

I have added one more change that will only use the 'metrics' port for Service, Daemonset and ServiceMonitor if both prometheus_export and internal_metrics are using the same port in the Beyla config.

@grcevski grcevski requested a review from mariomac September 18, 2024 19:31
Copy link
Contributor

@mariomac mariomac left a comment

Choose a reason for hiding this comment

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

LGTM!

@mariomac mariomac merged commit 008f4f2 into grafana:main Sep 19, 2024
7 checks passed
@marevers marevers deleted the helm-services-split branch September 19, 2024 09:02
mattdurham pushed a commit to mattdurham/beyla that referenced this pull request Jan 22, 2025
…rafana#1168)

* Add two ports to service, daemonset and servicemonitor conditionally

* Update Helm docs

* Only use 1 port if ports in config are equal

* Change default internal metrics path to /metrics

* Remove .metrics. from Prometheus metrics values
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.

Helm: split up service for internal and Prometheus metrics
4 participants