metno / discovery-metadata-catalog-ingestor

Apache License 2.0
1 stars 1 forks source link

add prometheus_flask_exporter #233

Closed charlienegri closed 2 months ago

charlienegri commented 2 months ago

Summary: extract metrics via prometheus_flask_exporter

Related issue:

220

Suggested reviewer(s):

Reviewer checklist:

The checklist is based on the S-ENDA conventions and definition of done (see General Conventions). The above points are not necessarily relevant to all contributions. In that case, please add a short explanation to help the reviewer.

charlienegri commented 2 months ago

Screenshot from 2024-10-01 15-04-28 local test seems to expose the metrics at least

charlienegri commented 2 months ago

@magnarem this should not conflict with the catalog-rebuilder-flask metrics endpoint right? because dmci has its own container port (8000) as far as I understand, and that's where these /metrics will end up

magnarem commented 2 months ago

I think it should be no problem. The k8s nginx in front of dmci, should handle request dmci.s-enda.k8s.met.no/metrics og catalog-rebuilder.s-enda.k8s.met.no/metrics to the right ones...If unsure, maybe the k8s people can give a better answer.

charlienegri commented 2 months ago

Screenshot from 2024-10-02 11-49-19 the path label can be used to discriminate the endpoint

charlienegri commented 2 months ago

I think we'll need to add annotations to the base/dmci/statefulset.yaml in the tjeneste repo for the metrics to be actually scraped, as there are for catalog-rebuilder-flask, basically identical lines but just with a changed port, should be 8000 if I read the code right

magnarem commented 2 months ago

Yes, for promethues to see the metrics, you will have to add the right anotations.

The dmci pod did not start properly.

Here is the error from the dmci startup log:

ModuleNotFoundError: No module named 'prometheus_flask_exporter'

You will need to add the prometheus_flask_exporter dependency to the setup.cfg for the installer to install this module.

Add it under: install_requires =

charlienegri commented 2 months ago

🙃 I added it to the requirements file and forgot about that ... I will open a PR to fix this

charlienegri commented 1 month ago

patch https://github.com/metno/discovery-metadata-catalog-ingestor/pull/234