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

dependency needs to be added to setup.cfg too #234

Merged
merged 1 commit into from
Oct 3, 2024
Merged

Conversation

charlienegri
Copy link
Contributor

@charlienegri charlienegri commented Oct 2, 2024

Summary: #233 was missing a dependency in setup.cfg

Related issue: #220

Suggested reviewer(s):

Reviewer checklist:

  • The headers of all files contain a reference to the repository license
  • 100% test coverage of new code - meaning:
    • The overall test coverage increased or remained the same as before
    • Every function is accompanied with a test suite
    • Tests are both positive (testing that the function work as intended with valid data) and negative (testing that the function behaves as expected with invalid data, e.g., that correct exceptions are thrown)
    • Functions with optional arguments have separate tests for all options
  • Examples are supported by doctests
  • All tests are passing
  • All names (e.g., files, classes, functions, variables) are explicit
  • Documentation (as docstrings) is complete and understandable

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 charlienegri marked this pull request as ready for review October 2, 2024 16:39
@charlienegri charlienegri requested a review from magnarem October 2, 2024 16:39
@charlienegri charlienegri mentioned this pull request Oct 3, 2024
10 tasks
Copy link
Contributor

@magnarem magnarem left a comment

Choose a reason for hiding this comment

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

approved

@magnarem magnarem merged commit b1d76e6 into main Oct 3, 2024
5 checks passed
@magnarem magnarem deleted the issue_220_patch branch October 3, 2024 10:04
@magnarem
Copy link
Contributor

magnarem commented Oct 3, 2024

approved and merged

@charlienegri
Copy link
Contributor Author

charlienegri commented Oct 3, 2024

this setup works for the local test but I see no /metrics endpoint exposed now in dev and I wonder if the real case of having gunicorn multiprocesses might require something more https://github.com/rycus86/prometheus_flask_exporter?tab=readme-ov-file#wsgi, will try to investigate

@magnarem
Copy link
Contributor

magnarem commented Oct 3, 2024

Yes. You are right that you probably have to take in account that dmci is running in gunicorn with multiple processes, so you get the metrics from all processes.

But I see another problem in dmci code, that makes the /metrics endpoint not working on k8s, and working locally.

When you test dmci locally from the dmci_start_api.py then the prometheus_flask_exporter defined in api_main() (https://github.com/metno/discovery-metadata-catalog-ingestor/blob/main/dmci/__init__.py) is loaded.

But when dmci is run in the Docker container, the initializing of the app is happening in container/wsgi.py, and this code does not execute the api_main() function.
So in this wsgi.py, you will probably need to add the prometheus_flask_exporter as well, for it to work with wsgi

And for testing with gunicorn, build the container locally and test it locally with wsgi gunicorn (The default entry point in the container uses the gunicorn)

@charlienegri
Copy link
Contributor Author

right, thanks for pointing that out, I had not realized

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.

2 participants