arize-span-routing
БесплатноБез исполняемых скриптовНе проверенUse when one Python service must send each agent's, tenant's, team's, or request's spans to its correct Arize space and project using application metadata…
от Arize-ai★ 77 звёзд на GitHubОб этом скилле
Arize Span Routing Skill
Use this skill to send each traced operation from one Python service to its correct Arize space and project. Each operation must resolve to exactly one space_id and project_name before its first span starts.
Do not use this skill for ordinary single-project tracing; use arize-instrumentation. This skill does not reroute spans after export, backfill historical spans, create Arize spaces/projects, or invent a customer-specific metadata mapping.
Safety rules
- Never guess a destination or silently use another tenant's destination.
- Never embed API keys in code or ask users to paste keys into chat. Read
ARIZE_API_KEYfrom the environment. - Preserve existing non-Arize exporters and processors. Remove or replace a fixed-destination Arize export path so routed spans are not also copied to that destination.
- Missing, invalid, or unavailable routing metadata must leave the business operation running but its spans unexported to Arize. Run that operation under a fresh OpenTelemetry context so stale routing values cannot leak across tenants. Log a warning without including secrets or sensitive metadata values.
- Use one API key that is authorized for every destination space. Stop and report a credential blocker if that is not true.
Phase 1: Inspect and define the contract
Read only until the routing contract is clear.
- Identify the exact Python service and entrypoint to change.
- Find current tracing initialization, provider/exporters, instrumentors, and client creation order.
- Find the request or agent-execution boundary that owns destination metadata.
- Identify the stable metadata field(s) and existing source of truth that resolve to:
- Arize
space_id - Arize
project_name
- Arize
- Check async tasks, thread pools, queues, or background workers that may outlive the request context.
- Find the app's test command and existing test style.
Inspect only the target app's configuration. Do not search unrelated repositories, sibling services, shell startup files, or arbitrary .env files for credentials.
If service scope, metadata fields, mapping source, or destination behavior is ambiguous, stop and ask the minimum question needed. Do not install packages or edit code first. If the user requested implementation and all four are clear, summarize the contract briefly and continue.
Phase 2: Implement
1. Ensure routing support exists
Use the project's package manager to require arize-otel>=0.11.0. Do not change unrelated dependencies.
2. Initialize routing once
For an app without an existing OpenTelemetry provider, initialize routing before instrumentors and LLM clients:
import os
from arize.otel import register_with_routing
tracer_provider = register_with_routing(
api_key=os.environ["ARIZE_API_KEY"],
)
If the app already owns a provider with non-Arize telemetry, keep it and add the routing processor:
import os
from arize.otel import ArizeRoutingSpanProcessor, Endpoint, Transport
tracer_provider.add_span_processor(
ArizeRoutingSpanProcessor(
api_key=os.environ["ARIZE_API_KEY"],
endpoint=Endpoint.ARIZE,
transport=Transport.GRPC,
)
)
Reuse the app's configured endpoint and transport when present. Never call register_with_routing after another global provider has already been installed. If the provider also has a fixed Arize processor/exporter, remove that fixed path in its initialization before adding routing; OpenTelemetry processors cannot be safely removed after startup.
3. Resolve one routing target
Adapt the app's existing metadata model; do not introduce a framework for one lookup. The resolver must return both non-empty values or no target. Keep mapping data in its existing source of truth rather than duplicating it in tracing code.
from dataclasses import dataclass
@dataclass(frozen=True)
class RoutingTarget:
space_id: str
project_name: str
Use this type only when the codebase lacks an equivalent. Validate the result before any traced work begins.
4. Set context around the complete operation
Enter routing context at the highest boundary that has the metadata and encloses every child span:
Replace RoutingLookupError below with the resolver's specific existing lookup/configuration exception.
from opentelemetry import context as context_api
from arize.otel import set_routing_context
def run_without_arize_routing(request):
token = context_api.attach(context_api.Context())
try:
return run_agent(request)
finally:
context_api.detach(token)
def handle_agent_request(request):
try:
target = resolve_routing_target(request.agent_metadata)
except RoutingLookupError:
logger.warning("Arize routing lookup failed; spans will not be exported")
return run_without_arize_routing(request)
if target is None or not target.space_id or not target.project_name:
logger.
Установить arize-span-routing в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл arize-span-routing?
Use when one Python service must send each agent's, tenant's, team's, or request's spans to its correct Arize space and project using application metadata. Covers dynamic OpenTelemetry routing for custom agent builders and multi-tenant applications, including register_with_routing, set_routing_context, multi-space tracing, and custom span routing.
Как установить скилл arize-span-routing?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл arize-span-routing запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic