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

Add Tracing and rework cli so that the controller command does not start a FastAPI app #669

Merged
merged 12 commits into from
Nov 1, 2024

Conversation

keithralphs
Copy link
Contributor

  • Add tracing intialisation and decorators
  • In cli.py move some imports within functions to prevent unnecessary FastAPI apps being created
  • Add capability to specify a config file in debug launchers
  • Add Environment vars to initialise traceability options and set Jager export to off by default

Copy link

codecov bot commented Oct 14, 2024

Codecov Report

Attention: Patch coverage is 92.66667% with 11 lines in your changes missing coverage. Please review.

Project coverage is 92.35%. Comparing base (452eed1) to head (40aed1c).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/blueapi/cli/cli.py 37.50% 5 Missing ⚠️
src/blueapi/service/main.py 90.90% 3 Missing ⚠️
src/blueapi/worker/task_worker.py 95.31% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #669      +/-   ##
==========================================
- Coverage   92.46%   92.35%   -0.11%     
==========================================
  Files          35       35              
  Lines        1658     1793     +135     
==========================================
+ Hits         1533     1656     +123     
- Misses        125      137      +12     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

.devcontainer/devcontainer.json Outdated Show resolved Hide resolved
.vscode/launch.json Show resolved Hide resolved
.vscode/launch.json Outdated Show resolved Hide resolved
Dockerfile Outdated Show resolved Hide resolved
helm/blueapi/values.yaml Outdated Show resolved Hide resolved
src/blueapi/worker/task_worker.py Outdated Show resolved Hide resolved
tests/unit_tests/core/fake_device_module.py Outdated Show resolved Hide resolved
src/blueapi/worker/task_worker.py Outdated Show resolved Hide resolved
src/blueapi/worker/task_worker.py Outdated Show resolved Hide resolved
src/blueapi/cli/cli.py Show resolved Hide resolved
Dockerfile Outdated Show resolved Hide resolved
helm/blueapi/values.yaml Outdated Show resolved Hide resolved
pyproject.toml Outdated Show resolved Hide resolved
src/blueapi/client/rest.py Show resolved Hide resolved
src/blueapi/service/main.py Show resolved Hide resolved
src/blueapi/service/main.py Show resolved Hide resolved
src/blueapi/service/runner.py Outdated Show resolved Hide resolved
src/blueapi/worker/task_worker.py Show resolved Hide resolved
src/blueapi/worker/task_worker.py Outdated Show resolved Hide resolved
src/blueapi/worker/task_worker.py Outdated Show resolved Hide resolved
tests/unit_tests/service/test_runner.py Outdated Show resolved Hide resolved
Copy link
Contributor

@callumforrester callumforrester left a comment

Choose a reason for hiding this comment

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

Is there a way to write tests such that we can check that the spans etc. we expect are being requested?

Comment on lines 320 to 324
self._current_task_otel_context = get_trace_context()
add_span_attributes({"next_task.task_id": next_task.task_id})

self._current.is_pending = False
self._current.task.do_task(self._ctx)
Copy link
Contributor

Choose a reason for hiding this comment

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

There are now enough pieces of context that the worker needs to keep track of that it makes sense to box them up into a dataclass or similar object. I think that's a separate issue though...

Copy link
Contributor

@callumforrester callumforrester left a comment

Choose a reason for hiding this comment

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

Please could you make issues to streamline the output from the CLI tool and to speed up the tests! The latter is especially important!

@callumforrester callumforrester dismissed DiamondJoseph’s stale review October 31, 2024 18:12

In Denmark, and unable to contest

@keithralphs keithralphs merged commit a33daa2 into main Nov 1, 2024
27 checks passed
@keithralphs keithralphs deleted the observ branch November 1, 2024 11:47
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.

4 participants