Skip to content

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

Merged
keithralphs merged 12 commits into
mainfrom
observ
Nov 1, 2024
Merged

keithralphs merged 12 commits into
mainfrom
observ

Conversation

@keithralphs

Copy link
Copy Markdown
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

@codecov

codecov Bot commented Oct 14, 2024 •

Copy link
Copy Markdown

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.

Comment thread .devcontainer/devcontainer.json Resolved
Comment thread .vscode/launch.json Resolved
Comment thread .vscode/launch.json Resolved
Comment thread Dockerfile Resolved
Comment thread helm/blueapi/values.yaml Resolved
Comment thread src/blueapi/worker/task_worker.py Resolved
Comment thread src/blueapi/worker/task_worker.py Resolved
Comment thread src/blueapi/worker/task_worker.py Resolved
Comment thread src/blueapi/cli/cli.py Resolved
Comment thread Dockerfile Resolved
Comment thread helm/blueapi/values.yaml Resolved
Comment thread pyproject.toml Resolved
Comment thread src/blueapi/client/rest.py Resolved
Comment thread src/blueapi/service/main.py Resolved
Comment thread src/blueapi/service/main.py Resolved
Comment thread src/blueapi/service/runner.py Resolved
Comment thread src/blueapi/worker/task_worker.py Resolved
Comment thread src/blueapi/worker/task_worker.py Resolved
Comment thread src/blueapi/worker/task_worker.py Resolved
Comment thread tests/unit_tests/service/test_runner.py Resolved

@callumforrester callumforrester left a comment

Copy link
Copy Markdown
Contributor

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 thread src/blueapi/worker/task_worker.py Resolved
Comment thread src/blueapi/worker/task_worker.py Outdated
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
Copy Markdown
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...

@callumforrester callumforrester left a comment

Copy link
Copy Markdown
Contributor

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
@keithralphs
keithralphs deleted the observ branch November 1, 2024 11:47
@callumforrester callumforrester mentioned this pull request Nov 14, 2024
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