본문으로 건너뛰기
cccskills
무료GitHub에 공개

genai:semantic-conventions

OpenTelemetry GenAI semantic conventions for agent instrumentation - the standard attributes for LLM observability

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

rossoctl/rossoctl스타 303(GitHub 303 + cccskills 0)
연동 도구OpenAI

실행 점수 미검증

설치 방법 보기

포함된 파일(1)

  • SKILL.md5.4 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

OpenTelemetry GenAI Semantic Conventions

Reference for instrumenting agents with OpenTelemetry GenAI semantic conventions.

Spec: https://opentelemetry.io/docs/specs/semconv/gen-ai/

Architecture

Agent (gen_ai.* only) → OTEL Collector → Transform → Phoenix (llm.*) + MLflow (mlflow.trace.*)

Agents emit only gen_ai.* attributes. The OTEL Collector transforms these to:

  • OpenInference format (llm.*) for Phoenix
  • MLflow metadata (mlflow.trace.*) for MLflow session tracking

Core Attributes

Request Attributes (on LLM call spans)

AttributeTypeDescriptionExample
gen_ai.systemstringGenAI provider/systemopenai, anthropic, langchain
gen_ai.request.modelstringModel requestedgpt-4, claude-3-opus
gen_ai.request.max_tokensintMax tokens to generate1024
gen_ai.request.temperaturefloatSampling temperature0.7
gen_ai.request.top_pfloatNucleus sampling0.9

Response Attributes

AttributeTypeDescriptionExample
gen_ai.response.modelstringModel that respondedgpt-4-0613
gen_ai.response.idstringResponse identifierchatcmpl-abc123
gen_ai.response.finish_reasonsstring[]Why generation stopped["stop"]
gen_ai.usage.input_tokensintPrompt tokens150
gen_ai.usage.output_tokensintCompletion tokens250

Conversation/Session Attributes

AttributeTypeDescriptionExample
gen_ai.conversation.idstringSession/conversation IDuuid-123-456
gen_ai.promptstringUser prompt (truncated)What is the weather?
gen_ai.completionstringResponse (truncated)The weather is sunny

Agent Attributes (custom, for A2A agents)

AttributeTypeDescriptionExample
gen_ai.agent.namestringAgent nameweather-assistant
gen_ai.agent.idstringAgent/task IDtask-uuid-789

Python Usage

Auto-instrumentation (Recommended)

# Install: pip install opentelemetry-instrumentation-openai
from opentelemetry.instrumentation.openai import OpenAIInstrumentor

# Instruments all OpenAI SDK calls automatically
OpenAIInstrumentor().instrument()

Manual Span Attributes

from opentelemetry import trace

tracer = trace.get_tracer(__name__)

with tracer.start_as_current_span(
    "gen_ai.agent.invoke",
    attributes={
        "gen_ai.conversation.id": context_id,
        "gen_ai.agent.name": "my-agent",
        "gen_ai.system": "langchain",
        "gen_ai.request.model": "gpt-4",
        "gen_ai.prompt": user_input[:500],  # Truncate for size
    }
) as span:
    # Agent logic here
    result = await agent.run(user_input)

    # Add response attributes
    span.set_attribute("gen_ai.completion", str(result)[:500])

Adding to Existing Span

current_span = trace.get_current_span()
if current_span and current_span.is_recording():
    current_span.set_attribute("gen_ai.conversation.id", session_id)
    current_span.set_attribute("gen_ai.agent.name", "weather-assistant")

OTEL Collector Transforms

The collector transforms gen_ai.* to target formats:

GenAI → OpenInference (Phoenix)

GenAI AttributeOpenInference Attribute
gen_ai.request.modelllm.model_name
gen_ai.usage.input_tokensllm.token_count.prompt
gen_ai.usage.output_tokensllm.token_count.completion
gen_ai.systemllm.provider, llm.system

GenAI → MLflow

GenAI AttributeMLflow Metadata
gen_ai.conversation.idmlflow.trace.session (resource)
Span name gen_ai.agent.*mlflow.spanType=AGENT
Span with gen_ai.request.modelmlflow.spanType=LLM
Span name gen_ai.tool.*mlflow.spanType=TOOL

Span Naming Conventions

Use GenAI operation names for spans:

OperationSpan Name
Agent invocationgen_ai.agent.invoke
LLM chat completiongen_ai.chat
Tool callgen_ai.tool.{tool_name}
Embeddinggen_ai.embeddings

Best Practices

  1. Always set gen_ai.conversation.id for session tracking in MLflow
  2. Truncate prompts/completions to ~500 chars to avoid span size issues
  3. Use auto-instrumentation when available (OpenAI, Anthropic SDKs)
  4. Add manual attributes for custom agent spans
  5. Never emit OpenInference (llm.*) directly - let the collector transform

Dependencies

# pyproject.toml
dependencies = [
    "opentelemetry-sdk",
    "opentelemetry-exporter-otlp",
    "opentelemetry-instrumentation-openai>=0.34b0",  # For OpenAI auto-instrumentation
]

Related Skills

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

auth

무료

Authentication and authorization patterns for Rossoctl services

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

rossoctl/rossoctl3032026년 10월 25일 업데이트

Create confidential OAuth2 clients in Keycloak for server-to-service authentication

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

rossoctl/rossoctl3032026년 10월 25일 업데이트

Configure MLflow with mlflow-oidc-auth plugin for Keycloak OIDC authentication

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

rossoctl/rossoctl3032026년 10월 25일 업데이트

Configure OpenTelemetry Collector with OAuth2 authentication for trace export

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

rossoctl/rossoctl3032026년 10월 25일 업데이트

ci

무료

CI pipeline monitoring, status checks, and PR validation workflows

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

rossoctl/rossoctl3032026년 10월 25일 업데이트

Monitor running CI jobs, wait for completion, create tasks for results

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

rossoctl/rossoctl3032026년 10월 25일 업데이트

rossoctl의 스킬 모두 보기

이 스킬의 문제 신고