-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Expose UDP message on /metrics endpoint #2608
Expose UDP message on /metrics endpoint #2608
Conversation
Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please follow instructions at https://git.k8s.io/community/CLA.md#the-contributor-license-agreement to sign the CLA. It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
You have some lint issues (maybe from one of my commits :P )
|
Does it make sense to fully remove the current vts library or should we have metrics/v1 => vts and metrics/v2 => lua exporter. Can I have a docker image of this changes? |
@gianrubio I was building that 😉 |
Once this PR lands we are removing the VTS module from the nginx image |
|
🤔 Looking right now |
Example of the metrics https://gist.github.com/aledbf/c68ad149c1292da54d6bd3162bf05740 |
This could be an issue. In some scenarios, nginx returns |
Yes, that is what's crashing |
I've not looked deep into the PR yet, but can you make another PR for Lua middleware and deletion of VTS? Will make it easier to review. I'd suggest we first get the Lua middleware merged and then merge this PR. And finally remove VTS and edit nginx.tmpl to switch to the new metric collection. |
Both things are in this PR
That's the plan |
@ElvinEfendi by default the vts module is disabled so the prometheus metrics only contain the default status information from nginx |
I know but for example Lua middleware lacks unit tests, and having self contained separate PRs if possible makes it easier to review/revert. |
Not sure if splitting this PR makes sense (in this case). It will be harder to review from my point of view |
Name: "bytes_sent", | ||
Help: "The the number of bytes sent to a client", | ||
Namespace: ns, | ||
Buckets: prometheus.LinearBuckets(50, 25, 10), // 10 buckets, each 50 bytes wide. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would probably use exponential buckets for bytes sent, from 100 bytes to maybe 10 MiB.
Is it possible to use |
@SuperQ yes but not sure if that change will be done in this PR |
@aledbf Looks like the PR wants to add a metric for |
} | ||
|
||
func (sc *StatsCollector) handleMessage(msg []byte) { | ||
glog.Infof("msg: %v", string(msg)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please change this to glog.V(5).Infof("msg: %v", string(msg))
nginxStatusCollector struct { | ||
scrapeChan chan scrapeRequest | ||
ngxHealthPort int | ||
ngxVtsPath string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fmejia97 please remove this field. We don't need this now.
@fmejia97 I forgot to mention that we don't need |
c145559
to
b04a052
Compare
@aledbf After talking with @ElvinEfendi and @andrewlouis93 , we decided that keeping |
b04a052
to
9fb664b
Compare
Until now |
I'd like to understand what are the main differences between the prometheus Lua collector and nginx vts? I noticed that nginx vts added the feature to expose metrics in prometheus format, can we discuss pro and con between lua x vts? |
With the dynamic mode introduced a couple of releases ago, the load balancing stuff is handled in LUA. This means there is no upstream section in the generated nginx.conf, there is only one used to switch to LUA. In this scenario, the VTS module is useless because the stats only contains information about this upstream without any context about the traffic. |
@fmejia97 Is not clear to everyone why we are switching away from VTS - could we add more context to this PR description before this ships? |
Codecov Report
@@ Coverage Diff @@
## master #2608 +/- ##
=========================================
- Coverage 40.83% 40.8% -0.04%
=========================================
Files 75 74 -1
Lines 5123 5083 -40
=========================================
- Hits 2092 2074 -18
+ Misses 2750 2726 -24
- Partials 281 283 +2
Continue to review full report at Codecov.
|
@fmejia97 please rollback the last commit. The namespace cannot be a constant. Use a helper to fix the name (like ingress-nginx to ingress_nginx) |
8f33578
to
f508189
Compare
…d exposes them on /metrics endpoint
f508189
to
2cd2da7
Compare
@aledbf I used a constant since I saw that's how it was used before. Added a new commit where I remove the constant and instead I fix the namespace name 👍 |
@aledbf Rebased + squashed 👍 |
Let's merge this, it's already too big. |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: aledbf, fmejia97 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@fmejia97 @andrewlouis93 I will work in the use of unix sockets instead of UDP to send the metrics |
What this PR does / why we need it:
This PR:
monitor.lua
and exposes them on/metrics
endpoint using prometheus client.Why do we need this PR?
With the dynamic mode introduced a couple of releases ago, the load balancing is handled in LUA. This means there is no upstream section in the generated nginx.conf, there is only one used to switch to LUA. In this scenario, the VTS module is useless because the stats only contains information about this upstream without any context about the traffic. Additionally, by using the VTS module it is not possible to add custom variables to the stats, such as information about the namespace, ingress rule, and service (something available as NGINX variable).
Which issue this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close that issue when PR gets merged): fixes #Special notes for your reviewer:
replaces #2607
fixes #2355
fixes #2128
fixes #557