diff --git a/.github/pages/make_switcher.py b/.github/pages/make_switcher.py index 6d90f4905..14577cce6 100755 --- a/.github/pages/make_switcher.py +++ b/.github/pages/make_switcher.py @@ -52,7 +52,7 @@ def get_versions(ref: str, add: str | None) -> list[str]: return versions -def write_json(path: Path, repository: str, versions: str): +def write_json(path: Path, repository: str, versions: list[str]): org, repo_name = repository.split("/") struct = [ {"version": version, "url": f"https://{org}.github.io/{repo_name}/{version}/"} diff --git a/src/blueapi/client/client.py b/src/blueapi/client/client.py index 13a4a087a..9a47ac4c0 100644 --- a/src/blueapi/client/client.py +++ b/src/blueapi/client/client.py @@ -263,9 +263,7 @@ def create_task(self, task: Task) -> TaskResponse: return self._rest.create_task(task) - @start_as_current_span( - TRACER, - ) + @start_as_current_span(TRACER) def clear_task(self, task_id: str) -> TaskResponse: """ Delete a stored task on the worker diff --git a/src/blueapi/messaging/stomptemplate.py b/src/blueapi/messaging/stomptemplate.py index 5de6dc32a..fa15a9831 100644 --- a/src/blueapi/messaging/stomptemplate.py +++ b/src/blueapi/messaging/stomptemplate.py @@ -269,8 +269,6 @@ def _on_disconnected(self) -> None: @handle_all_exceptions def _on_message(self, frame: Frame) -> None: LOGGER.info(f"Received {frame}") - # sub_id = frame.headers.get("subscription") - # sub = self._subscriptions.get(sub_id) with TRACER.start_as_current_span( "_on_message", retrieve_context_from_stomp_headers(frame), SpanKind.CONSUMER ): diff --git a/src/blueapi/service/main.py b/src/blueapi/service/main.py index 1cc4e1df0..1bd1244c1 100644 --- a/src/blueapi/service/main.py +++ b/src/blueapi/service/main.py @@ -1,12 +1,10 @@ from contextlib import asynccontextmanager -from typing import Annotated from fastapi import ( BackgroundTasks, Body, Depends, FastAPI, - Header, HTTPException, Request, Response, @@ -15,10 +13,10 @@ from observability_utils.tracing import ( add_span_attributes, get_tracer, - instrument_fastapi_app, start_as_current_span, ) from opentelemetry.context import attach +from opentelemetry.instrumentation.fastapi import FastAPIInstrumentor from opentelemetry.propagate import get_global_textmap from pydantic import ValidationError from starlette.responses import JSONResponse @@ -88,7 +86,7 @@ async def lifespan(app: FastAPI): version=REST_API_VERSION, ) -instrument_fastapi_app(app) +FastAPIInstrumentor().instrument_app(app) TRACER = get_tracer("API") """ Set up basic automated instrumentation for the FastAPI app, creating the @@ -128,10 +126,7 @@ async def delete_environment( @app.get("/plans", response_model=PlanResponse) @start_as_current_span(TRACER) -def get_plans( - runner: WorkerDispatcher = Depends(_runner), - traceparent: Annotated[str | None, Header()] = None, -): +def get_plans(runner: WorkerDispatcher = Depends(_runner)): """Retrieve information about all available plans.""" return PlanResponse(plans=runner.run(interface.get_plans))