Skip to content

Commit

Permalink
Minor corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
keithralphs committed Sep 20, 2024
1 parent d1a263f commit cb85f59
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/pages/make_switcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}/"}
Expand Down
4 changes: 1 addition & 3 deletions src/blueapi/client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions src/blueapi/messaging/stomptemplate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
):
Expand Down
11 changes: 3 additions & 8 deletions src/blueapi/service/main.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
from contextlib import asynccontextmanager
from typing import Annotated

from fastapi import (
BackgroundTasks,
Body,
Depends,
FastAPI,
Header,
HTTPException,
Request,
Response,
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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))

Expand Down

0 comments on commit cb85f59

Please sign in to comment.