Gradiant / 5g-charts

Helm charts for 5G Technologies
Apache License 2.0
108 stars 42 forks source link

Metrics not supported? #136

Closed MA3CIN closed 10 months ago

MA3CIN commented 10 months ago

Hi, I'm trying to access the NF metrics (https://open5gs.org/open5gs/docs/tutorial/04-metrics-prometheus/), and I see that the helm chart takes an argument for (containerPorts.metrics int, default is 9090). However the NF containers, in their yaml config files do not contain any mention of metrics, and running prometheus I can't scrap anything from the default ports (9090). Are metrics supported at all in this chart?

I'm using the latest version from openverso https://gradiant.github.io/openverso-charts/

mmarquez999 commented 10 months ago

Hello Marcin,

Currently in our charts we support metrics for the AMF, SMF, UPF and PCF. If you take the AMF chart as an example, you can see in the values.yaml the argument containerPorts.metrics as you said. In addition, in the same values.yaml, there is another field metrics.enabled, which by default it is set to false.
https://github.com/Gradiant/openverso-charts/blob/fe676f2a30606c2ce51525897f89f625d299af1a/charts/open5gs-amf/values.yaml#L492-L493

Then, in the AMF config yaml (resources/config/amf.yaml), you can see the following sections: https://github.com/Gradiant/openverso-charts/blob/fe676f2a30606c2ce51525897f89f625d299af1a/charts/open5gs-amf/resources/config/amf.yaml#L22-L26

Thus, you must set to true the metrics.enabled field in the values.yaml file in order to enable this feature. Also, in that same section, there are fields available to configure the metrics scraping with both Prometheus and VictoriaMetrics. In your case, assuming you are using the PrometheusOperator, you will have to enable the ServiceMonitor as well, setting metrics.serviceMonitor.enabled to true: https://github.com/Gradiant/openverso-charts/blob/fe676f2a30606c2ce51525897f89f625d299af1a/charts/open5gs-amf/values.yaml#L494-L501

Hope this helps you to make it work!

MA3CIN commented 10 months ago

Such a trivial issue - i thought that the metrics would be enabled by default, didn't notice that the default was set to "false"! Thanks for pointing me in the right direction So if i want to install all NFs, with metrics enabled for the 4 NFs you mentioned, i need to install this chart https://artifacthub.io/packages/helm/gradiant-openverso/open5gs and then set the metrics values to true for child charts for NFs (amf, upf, smf, pcf) - got it. And then the service monitor will point prometheus towards the individual pods, which i will be able to see in prometheus UI by going to status -> targets. Gotta say, that's some pretty smart engineering, I'll try it out right now and come back here if i mess something up. The official documentation for this is pretty lackluster (https://open5gs.org/open5gs/docs/tutorial/04-metrics-prometheus/) - but i suppose you guys are independent from Open5GS, right?

cgiraldo commented 10 months ago

Hi, Yes, we are independent from Open5GS, we integrate multiple opensource frameworks and libraries to build an open 5G laboratory in our infra.

Just for clarification, as @mmarquez999 said, the ServiceMonitor resouce will only work if you have prometheus-operator installed in your kubernetes cluster. The prometheus-operator is watching for this kind of resources to configure its targets into prometheus server, if not you have to manually configure that.

I have to agree with you, that is a pretty smart engineering, but it's not down to us, but the open-source projects we leverage on, such as prometheus-operator.

Regards!