From 89b23ec21dffc3e42a1bf11a214f25f496e80618 Mon Sep 17 00:00:00 2001 From: Charlie Doern Date: Thu, 6 Nov 2025 12:47:20 -0500 Subject: [PATCH] fix: rename decorator to telemetry_traceable more descriptive, less redundant Signed-off-by: Charlie Doern --- src/llama_stack/apis/common/tracing.py | 4 ++-- src/llama_stack/apis/conversations/conversations.py | 4 ++-- src/llama_stack/apis/files/files.py | 4 ++-- src/llama_stack/apis/inference/inference.py | 4 ++-- src/llama_stack/apis/models/models.py | 4 ++-- src/llama_stack/apis/prompts/prompts.py | 4 ++-- src/llama_stack/apis/safety/safety.py | 4 ++-- src/llama_stack/apis/shields/shields.py | 4 ++-- src/llama_stack/apis/tools/tools.py | 6 +++--- src/llama_stack/apis/vector_io/vector_io.py | 4 ++-- 10 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/llama_stack/apis/common/tracing.py b/src/llama_stack/apis/common/tracing.py index 98cf4ede6..830c2945a 100644 --- a/src/llama_stack/apis/common/tracing.py +++ b/src/llama_stack/apis/common/tracing.py @@ -5,7 +5,7 @@ # the root directory of this source tree. -def mark_as_traced(cls): +def telemetry_traceable(cls): """ Mark a protocol for automatic tracing when telemetry is enabled. @@ -14,7 +14,7 @@ def mark_as_traced(cls): Usage: @runtime_checkable - @mark_as_traced + @telemetry_traceable class MyProtocol(Protocol): ... """ diff --git a/src/llama_stack/apis/conversations/conversations.py b/src/llama_stack/apis/conversations/conversations.py index 9db51b91e..3fdd3b47e 100644 --- a/src/llama_stack/apis/conversations/conversations.py +++ b/src/llama_stack/apis/conversations/conversations.py @@ -20,7 +20,7 @@ from llama_stack.apis.agents.openai_responses import ( OpenAIResponseOutputMessageMCPListTools, OpenAIResponseOutputMessageWebSearchToolCall, ) -from llama_stack.apis.common.tracing import mark_as_traced +from llama_stack.apis.common.tracing import telemetry_traceable from llama_stack.apis.version import LLAMA_STACK_API_V1 from llama_stack.schema_utils import json_schema_type, register_schema, webmethod @@ -157,7 +157,7 @@ class ConversationItemDeletedResource(BaseModel): @runtime_checkable -@mark_as_traced +@telemetry_traceable class Conversations(Protocol): """Conversations diff --git a/src/llama_stack/apis/files/files.py b/src/llama_stack/apis/files/files.py index 7ed9235ff..f0ea2f892 100644 --- a/src/llama_stack/apis/files/files.py +++ b/src/llama_stack/apis/files/files.py @@ -11,7 +11,7 @@ from fastapi import File, Form, Response, UploadFile from pydantic import BaseModel, Field from llama_stack.apis.common.responses import Order -from llama_stack.apis.common.tracing import mark_as_traced +from llama_stack.apis.common.tracing import telemetry_traceable from llama_stack.apis.version import LLAMA_STACK_API_V1 from llama_stack.schema_utils import json_schema_type, webmethod @@ -102,7 +102,7 @@ class OpenAIFileDeleteResponse(BaseModel): @runtime_checkable -@mark_as_traced +@telemetry_traceable class Files(Protocol): """Files diff --git a/src/llama_stack/apis/inference/inference.py b/src/llama_stack/apis/inference/inference.py index e83f8d82a..1a865ce5f 100644 --- a/src/llama_stack/apis/inference/inference.py +++ b/src/llama_stack/apis/inference/inference.py @@ -20,7 +20,7 @@ from typing_extensions import TypedDict from llama_stack.apis.common.content_types import ContentDelta, InterleavedContent from llama_stack.apis.common.responses import MetricResponseMixin, Order -from llama_stack.apis.common.tracing import mark_as_traced +from llama_stack.apis.common.tracing import telemetry_traceable from llama_stack.apis.models import Model from llama_stack.apis.version import LLAMA_STACK_API_V1, LLAMA_STACK_API_V1ALPHA from llama_stack.models.llama.datatypes import ( @@ -1159,7 +1159,7 @@ class OpenAIEmbeddingsRequestWithExtraBody(BaseModel, extra="allow"): @runtime_checkable -@mark_as_traced +@telemetry_traceable class InferenceProvider(Protocol): """ This protocol defines the interface that should be implemented by all inference providers. diff --git a/src/llama_stack/apis/models/models.py b/src/llama_stack/apis/models/models.py index c7fb08488..5c976886c 100644 --- a/src/llama_stack/apis/models/models.py +++ b/src/llama_stack/apis/models/models.py @@ -9,7 +9,7 @@ from typing import Any, Literal, Protocol, runtime_checkable from pydantic import BaseModel, ConfigDict, Field, field_validator -from llama_stack.apis.common.tracing import mark_as_traced +from llama_stack.apis.common.tracing import telemetry_traceable from llama_stack.apis.resource import Resource, ResourceType from llama_stack.apis.version import LLAMA_STACK_API_V1 from llama_stack.schema_utils import json_schema_type, webmethod @@ -105,7 +105,7 @@ class OpenAIListModelsResponse(BaseModel): @runtime_checkable -@mark_as_traced +@telemetry_traceable class Models(Protocol): async def list_models(self) -> ListModelsResponse: """List all models. diff --git a/src/llama_stack/apis/prompts/prompts.py b/src/llama_stack/apis/prompts/prompts.py index 0e808aa5f..406ae529c 100644 --- a/src/llama_stack/apis/prompts/prompts.py +++ b/src/llama_stack/apis/prompts/prompts.py @@ -10,7 +10,7 @@ from typing import Protocol, runtime_checkable from pydantic import BaseModel, Field, field_validator, model_validator -from llama_stack.apis.common.tracing import mark_as_traced +from llama_stack.apis.common.tracing import telemetry_traceable from llama_stack.apis.version import LLAMA_STACK_API_V1 from llama_stack.schema_utils import json_schema_type, webmethod @@ -92,7 +92,7 @@ class ListPromptsResponse(BaseModel): @runtime_checkable -@mark_as_traced +@telemetry_traceable class Prompts(Protocol): """Prompts diff --git a/src/llama_stack/apis/safety/safety.py b/src/llama_stack/apis/safety/safety.py index a40257538..8872cc518 100644 --- a/src/llama_stack/apis/safety/safety.py +++ b/src/llama_stack/apis/safety/safety.py @@ -9,7 +9,7 @@ from typing import Any, Protocol, runtime_checkable from pydantic import BaseModel, Field -from llama_stack.apis.common.tracing import mark_as_traced +from llama_stack.apis.common.tracing import telemetry_traceable from llama_stack.apis.inference import OpenAIMessageParam from llama_stack.apis.shields import Shield from llama_stack.apis.version import LLAMA_STACK_API_V1 @@ -94,7 +94,7 @@ class ShieldStore(Protocol): @runtime_checkable -@mark_as_traced +@telemetry_traceable class Safety(Protocol): """Safety diff --git a/src/llama_stack/apis/shields/shields.py b/src/llama_stack/apis/shields/shields.py index 0b0437bbb..ca4483828 100644 --- a/src/llama_stack/apis/shields/shields.py +++ b/src/llama_stack/apis/shields/shields.py @@ -8,7 +8,7 @@ from typing import Any, Literal, Protocol, runtime_checkable from pydantic import BaseModel -from llama_stack.apis.common.tracing import mark_as_traced +from llama_stack.apis.common.tracing import telemetry_traceable from llama_stack.apis.resource import Resource, ResourceType from llama_stack.apis.version import LLAMA_STACK_API_V1 from llama_stack.schema_utils import json_schema_type, webmethod @@ -48,7 +48,7 @@ class ListShieldsResponse(BaseModel): @runtime_checkable -@mark_as_traced +@telemetry_traceable class Shields(Protocol): @webmethod(route="/shields", method="GET", level=LLAMA_STACK_API_V1) async def list_shields(self) -> ListShieldsResponse: diff --git a/src/llama_stack/apis/tools/tools.py b/src/llama_stack/apis/tools/tools.py index 59fde1439..c9bdfcfb6 100644 --- a/src/llama_stack/apis/tools/tools.py +++ b/src/llama_stack/apis/tools/tools.py @@ -11,7 +11,7 @@ from pydantic import BaseModel from typing_extensions import runtime_checkable from llama_stack.apis.common.content_types import URL, InterleavedContent -from llama_stack.apis.common.tracing import mark_as_traced +from llama_stack.apis.common.tracing import telemetry_traceable from llama_stack.apis.resource import Resource, ResourceType from llama_stack.apis.version import LLAMA_STACK_API_V1 from llama_stack.schema_utils import json_schema_type, webmethod @@ -107,7 +107,7 @@ class ListToolDefsResponse(BaseModel): @runtime_checkable -@mark_as_traced +@telemetry_traceable class ToolGroups(Protocol): @webmethod(route="/toolgroups", method="POST", level=LLAMA_STACK_API_V1) async def register_tool_group( @@ -189,7 +189,7 @@ class SpecialToolGroup(Enum): @runtime_checkable -@mark_as_traced +@telemetry_traceable class ToolRuntime(Protocol): tool_store: ToolStore | None = None diff --git a/src/llama_stack/apis/vector_io/vector_io.py b/src/llama_stack/apis/vector_io/vector_io.py index 98f43f70d..26c961db3 100644 --- a/src/llama_stack/apis/vector_io/vector_io.py +++ b/src/llama_stack/apis/vector_io/vector_io.py @@ -13,7 +13,7 @@ from typing import Annotated, Any, Literal, Protocol, runtime_checkable from fastapi import Body from pydantic import BaseModel, Field -from llama_stack.apis.common.tracing import mark_as_traced +from llama_stack.apis.common.tracing import telemetry_traceable from llama_stack.apis.inference import InterleavedContent from llama_stack.apis.vector_stores import VectorStore from llama_stack.apis.version import LLAMA_STACK_API_V1 @@ -502,7 +502,7 @@ class VectorStoreTable(Protocol): @runtime_checkable -@mark_as_traced +@telemetry_traceable class VectorIO(Protocol): vector_store_table: VectorStoreTable | None = None