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

Python 3.12 #320

Merged
merged 1 commit into from
Sep 23, 2024
Merged

Python 3.12 #320

merged 1 commit into from
Sep 23, 2024

Conversation

goat-ssh
Copy link
Contributor

@goat-ssh goat-ssh commented Sep 2, 2024

Update GH Actions, add trivy-scan in taskfile

Update GH Actions, add trivy-scan in taskfile
@goat-ssh
Copy link
Contributor Author

goat-ssh commented Sep 2, 2024

i get occasional local test failures:

============================================================================================================== FAILURES ==============================================================================================================
________________________________________________________________________________________________ test_worker_timeout_status[7-0-1.0] _________________________________________________________________________________________________

input_utcoffset = 7, sleep_seconds = 0, expected_metric_value = 1.0, threaded_exporter = <src.exporter.Exporter object at 0x1077e2720>, hostname = 'm3pro.local'

    @pytest.mark.parametrize(
        "input_utcoffset, sleep_seconds, expected_metric_value",
        [
            (None, 5, 0.0),
            (0, 5, 0.0),
            (7, 5, 0.0),
            (7, 0, 1.0),
        ],  # Eg: PST (America/Los_Angeles)
    )
    def test_worker_timeout_status(
        input_utcoffset, sleep_seconds, expected_metric_value, threaded_exporter, hostname
    ):
        ts = adjust_timestamp(time.time(), (input_utcoffset or 0))
        threaded_exporter.track_worker_status(
            {"hostname": hostname, "timestamp": ts, "utcoffset": input_utcoffset}, True
        )
        assert (
            threaded_exporter.registry.get_sample_value(
                "celery_worker_up", labels={"hostname": hostname}
            )
            == 1.0
        )
        assert threaded_exporter.worker_last_seen[hostname] == {
            "forgotten": False,
            "ts": reverse_adjust_timestamp(ts, input_utcoffset),
        }

        time.sleep(sleep_seconds)
>       threaded_exporter.scrape()

src/test_metrics.py:104:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
src/exporter.py:143: in scrape
    self.track_queue_metrics()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <src.exporter.Exporter object at 0x1077e2720>

    def track_queue_metrics(self):
        logger.debug(f"||| DICT: {self.__dict__}") # Shows all attributes of the Exporter object
>       with self.app.connection() as connection:  # type: ignore
E       AttributeError: 'Exporter' object has no attribute 'app'

src/exporter.py:206: AttributeError
------------------------------------------------------------------------------------------------------ Captured stdout teardown ------------------------------------------------------------------------------------------------------
2024-09-02 17:07:57.731 | INFO     | src.http_server:start_http_server:66 - Started celery-exporter at host='0.0.0.0' on port='57032'
========================================================================================================== warnings summary ==========================================================================================================
src/test_metrics.py::test_worker_tasks_active
src/test_metrics.py::test_worker_tasks_active
src/test_metrics.py::test_worker_heartbeat_status
src/test_metrics.py::test_worker_heartbeat_status
src/test_metrics.py::test_worker_status
src/test_metrics.py::test_worker_status
src/test_metrics.py::test_worker_generic_task_sent_hostname
src/test_metrics.py::test_worker_generic_task_sent_hostname
  /Users/shyukri/Library/Caches/pypoetry/virtualenvs/prometheus-exporter-celery-VgiM1U8R-py3.12/lib/python3.12/site-packages/celery/worker/consumer/consumer.py:508: CPendingDeprecationWarning: The broker_connection_retry configuration setting will no longer determine
  whether broker connection retries are made during startup in Celery 6.0 and above.
  If you wish to retain the existing behavior for retrying connections on startup,
  you should set broker_connection_retry_on_startup to True.
    warnings.warn(

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
====================================================================================================== short test summary info =======================================================================================================
FAILED src/test_metrics.py::test_worker_timeout_status[7-0-1.0] - AttributeError: 'Exporter' object has no attribute 'app'
======================================================================================== 1 failed, 16 passed, 8 warnings in 142.89s (0:02:22)

@goat-ssh
Copy link
Contributor Author

goat-ssh commented Sep 4, 2024

cc @danihodovic

@danihodovic
Copy link
Owner

I will take a look at this in the upcoming week

@danihodovic danihodovic merged commit 7662ced into danihodovic:master Sep 23, 2024
6 checks passed
@danihodovic
Copy link
Owner

Thank you. Pushed as danihodovic/celery-exporter:0.10.11

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