open-telemetry / open-telemetry/opentelemetry-python-contrib

Fix and re-enable the flaky celery tests

Offen
#653 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

bug good first issue help wanted
Vorherrschende Sprache
Python
Sterne
1.1k
Forks
1.1k
Ø Merge
4 T. 15 Std.
Gemergte PRs (30 T.)
16

Beschreibung

Some celery tests were disabled a long time ago because of inconsistency.

https://github.com/open-telemetry/opentelemetry-python-contrib/blob/main/tests/opentelemetry-docker-tests/tests/celery/test_celery_functional.py#L36
https://github.com/open-telemetry/opentelemetry-python-contrib/blob/main/tests/opentelemetry-docker-tests/tests/celery/test_celery_functional.py#L146
https://github.com/open-telemetry/opentelemetry-python-contrib/blob/main/tests/opentelemetry-docker-tests/tests/celery/test_celery_functional.py#L193
https://github.com/open-telemetry/opentelemetry-python-contrib/blob/main/tests/opentelemetry-docker-tests/tests/celery/test_celery_functional.py#L209
https://github.com/open-telemetry/opentelemetry-python-contrib/blob/main/tests/opentelemetry-docker-tests/tests/celery/test_celery_functional.py#L479

All of the above tests either use .delay() or .apply_async() to trigger the Celery tasks. This means a span is generated for the producer, then a message is put on a queue/broker. A celery worker then picks up the message and executes the relavant task which generates the consumer span. This is tricky as there can be some delay between producing and consuming. It looks like our tests do not take this delay into account and expect both producer and consumer spans to be available immediately after calling delay/apply_async which obviously fails a lot of times.

Solution here would be to wait till the expected number of spans arrive to memory exporter or wait on a condition fulfilled by the task to be executed. Whichever solution we pick should have a timeout with a assertion error so tests don't get stuck forever in case the message never arrives.

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne mit tests/opentelemetry-docker-tests/tests/celery/test_celery_functional.py und untersuche die deaktivierten Tests an den referenzierten Zeilen sowie, wie der Memory-Exporter Spans beobachtet. Führe die Celery-Funktionstestsdatei aus, um die Timing-Fehler zu reproduzieren. Fertig ist die Arbeit, wenn die Tests wieder aktiviert sind, mit einem Timeout auf Producer- und Consumer-Spans gewartet wird und bei nicht eintreffenden Tasks eine Assertion fehlschlägt, anstatt dass der Test hängen bleibt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
distributed-systems, testing
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.