Repository navigation
feat: add prometheus - #304
Conversation
|
Defines 3 metrics, and hooks up 2 metrics; dns and uncloudd version. |
|
For grpc I can go as far as using a metrics interceptor to get all data out of the grpc calls; that generate a lot of metrics and might be too lowlevel. That also excludes non-grpc, such as dns requests |
d89aae4 to
5a8fe59
Compare
|
This does the bare minium for adding prometheus and example metrics. It listens on the cluster network, so metrics can be scraped from a prometheus running in the cluster. |
|
ok the e2e test fails because m.IP() is not there yet. So this needs to be moved to where the dns server is started. |
|
locally it works: |
|
ready for review. PTAL |
Add the prometheus server and control its lifetime just like other services Signed-off-by: Miek Gieben <[email protected]>
Signed-off-by: Miek Gieben <[email protected]>
… closed'
Checked start and stop, now logs:
```
uncloudd[1233408]: INFO Starting prometheus server.
uncloudd[1233408]: INFO Prometheus server stopped.
```
Metrics are available on on port 51004
```
go_build_info{checksum="",path="github.com/psviderski/uncloud",version="v0.0.0-20260407052333-46be9c590e02+dirty"} 1
...
```
Signed-off-by: Miek Gieben <[email protected]>
Signed-off-by: Miek Gieben <[email protected]>
Signed-off-by: Miek Gieben <[email protected]>
Signed-off-by: Miek Gieben <[email protected]>
For ContainerExec add exec and pull Signed-off-by: Miek Gieben <[email protected]>
Signed-off-by: Miek Gieben <[email protected]>
Signed-off-by: Miek Gieben <[email protected]>
Rename label to resolver for dns metrics Signed-off-by: Miek Gieben <[email protected]>
Signed-off-by: Miek Gieben <[email protected]>
This makes prometheus listen on port 51004 in the cluster network. This allows scraping prometheus from an incluster prometheus Signed-off-by: Miek Gieben <[email protected]>
This fixes the test failure by pushing promtheus into the cluster controller. If we want to listen on the same address as the dns server we should do it like the dns server. This means moving it to the cluster controler. Also expand it to look more like the dns's server.go with Run() and stop() methods. Signed-off-by: Miek Gieben <[email protected]>
Signed-off-by: Miek Gieben <[email protected]>
Signed-off-by: Miek Gieben <[email protected]>
Signed-off-by: Miek Gieben <[email protected]>
Signed-off-by: Miek Gieben <[email protected]>
Signed-off-by: Miek Gieben <[email protected]>
Signed-off-by: Miek Gieben <[email protected]>
Signed-off-by: Miek Gieben <[email protected]>
Signed-off-by: Miek Gieben <[email protected]>
46094c8 to
3a98df2
Compare
Signed-off-by: Miek Gieben <[email protected]>
Signed-off-by: Miek Gieben <[email protected]>
psviderski
left a comment
There was a problem hiding this comment.
Overall looks good, just need to decide where to init and run the metrics server and a few minor comments
Use port 51090 and rename prometheus to metrics Signed-off-by: Miek Gieben <[email protected]>
Signed-off-by: Miek Gieben <[email protected]>
Dont use a new image, reuse the one we likely already have and move to wget Signed-off-by: Miek Gieben <[email protected]>
Signed-off-by: Miek Gieben <[email protected]>
Signed-off-by: Miek Gieben <[email protected]>
Signed-off-by: Miek Gieben <[email protected]>
Signed-off-by: Miek Gieben <[email protected]>
Signed-off-by: Miek Gieben <[email protected]>
Signed-off-by: Miek Gieben <[email protected]>
|
I have trouble relating this test failure to my change: starting uncloudd locally just starts up and shuts down |
seeing this locally, this hangs (likely on starting the metrics server): |
Signed-off-by: Miek Gieben <[email protected]>
Signed-off-by: Miek Gieben <[email protected]>
Signed-off-by: Miek Gieben <[email protected]>
|
ok, lots slushing code back and forth, but the end result looks neater, which is all that counts. |
|
Yep, exactly. This is what I have running atm. Makes all that stuff fall
outside of the core of uncloud.
Cheers
…On Fri, May 29, 2026, 08:58 Pasha Sviderski ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In internal/machine/cluster.go
<#304 (comment)>:
> @@ -194,6 +199,14 @@ func (cc *clusterController) Run(ctx context.Context) error {
return nil
})
+ errGroup.Go(func() error {
+ slog.Info("Starting prometheus server.")
+ if err := cc.prometheusServer.Run(ctx); err != nil {
+ return fmt.Errorf("prometheus server failed: %w", err)
+ }
+ return nil
+ })
+
Got it, thanks for clarifying. And is the reason to run on a cluster IP to
be able to scrape all endpoints from prometheus/collector running only on
one machine?
—
Reply to this email directly, view it on GitHub
<#304?email_source=notifications&email_token=AACWIWZYMKTSGVFMCN674TD45EYKLA5CNFSNUABKM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UKJSXM2LFO4XTIMZYG4ZTIMZSGU42M4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KYZTPN52GK4S7MNWGSY3L#discussion_r3322662263>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACWIWYCCLRSNCF233NRPEL45EYKLAVCNFSM6AAAAACXO6ONS2VHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHM2DGOBXGM2DGMRVHE>
.
Triage notifications, keep track of coding agent tasks and review pull
requests on the go with GitHub Mobile for iOS
<https://github.com/notifications/mobile/ios/AACWIW6U5NG7G6JO2TXKTXT45EYKLA5CNFSNUABKM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UKJSXM2LFO4XTIMZYG4ZTIMZSGU42M4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KUZTPN52GK4S7NFXXG>
and Android
<https://github.com/notifications/mobile/android/AACWIWY5JCVMFWKFAQC2J2345EYKLA5CNFSNUABKM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UKJSXM2LFO4XTIMZYG4ZTIMZSGU42M4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2K4ZTPN52GK4S7MFXGI4TPNFSA>.
Download it today!
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
|
Where are all these other metrics coming from?
|
these are the std go metrics that the prometheus go_client exposes. Not a problem and very good to have, each metric when scraped will have a label All the uncloud_ should be the metrics we add. |

Add the prometheus server and control its lifetime just like other services.