fix: reload module for telemetry testing so all tests can run#805
fix: reload module for telemetry testing so all tests can run#805jakelorocco wants to merge 6 commits intomainfrom
Conversation
|
The PR description has been updated. Please fill out the template for your PR to be reviewed. |
|
@ajbozarth, can you please confirm if this change is fine? I don't think I missed any logic here with the telemetry but I also want to make sure I'm not messing up a test that you had a reason for. Thanks! |
|
@jakelorocco this is good to merge as is, I had planned on figuring out and fixing this when I got to #444 but it makes sense it was this simple |
ajbozarth
left a comment
There was a problem hiding this comment.
actually hold off on merge, I noticed the cli still skipped the test_tracing_backend.py tests and they're failing when run locally
|
A few updates: The CI skipping is because the tests still contain the old CI skip code, we can remove this, it's handled by the ollama mark and testconf now if gh_run:
pytest.skip("Skipping in CI - requires Ollama") |
|
Here's the explanation for why the tests are failing now according to Claude: Good catch on the reload approach — the concept is right but there's a subtle OTel global state issue causing all 6 tests to fail when the full When
Fix: in # Before
_application_tracer = trace.get_tracer("mellea.application", _mellea_version)
_backend_tracer = trace.get_tracer("mellea.backend", _mellea_version)
# After
_application_tracer = _tracer_provider.get_tracer("mellea.application", _mellea_version)
_backend_tracer = _tracer_provider.get_tracer("mellea.backend", _mellea_version) |
ajbozarth
left a comment
There was a problem hiding this comment.
If you could make that small edit in tracing.py as well as remove the gh_run checks this should work
|
Apologies - had wrong PR open when moving out of draft . |
3abddc3 to
fdbd578
Compare
|
Ended up having to make additional changes to the tests; there were two more tests that didn't properly set env vars with the monkeypatched env, so I added those env vars. One of the backend tracing tests had to be updated to support the new tracer changes suggested as well. |
|
Updates are looking good to me, here's some nits from Claude, then this is good to go: Two small issues to flag: 1. Typos in monkeypatch.delenv("OTL_METRIC_EXPORT_INTERVAL", raising=False) # should be OTEL_...
monkeypatch.delenv("OTL_SERVICE_NAME", raising=False) # should be OTEL_...
2. Leftover async def test_span_duration_captures_async_operation(span_exporter, gh_run):
|
|
Resolved remaining issues. Thank you for flagging. |
Misc PR
Type of PR
Description
Allows telemetry tests to always run. The other telemetry tests were already reloading the module. For some reason this one wasn't.
Testing