표준이 정한 방식으로 스팬 이름 짓기

읽는 데 약 32분, 8절에 5개 예제이(가) 있음.

2026.11.2판 예제 통과 2026년 11월 23 80개 예제 중 80개 통과 변경 사항

AI로 번역함. 영어 원문을 사람이 검증함. 우리가 책을 만드는 방식

영어판 2026.11.2판을 번역한 것이다. 원문 읽기

Labs

직접 해 보며 이 장을 배운다

모든 예제를 책에서 한 그대로 실행하고, 코드를 바꿔 결과를 확인하며, 책의 코드와 데이터에 자신의 아이디어를 적용해 본다. 설치할 것은 없으며 작업 내용은 저장된다. 약 30초 안에 열린다.

모든 예제를 책에서 한 그대로 실행하고, 코드를 바꿔 결과를 확인하며, 책의 코드와 데이터에 자신의 아이디어를 적용해 본다. 설치할 것은 없으며 작업 내용은 저장된다. Labs가 실행을 대신한다: 월 40시간.

Lab에서 열기, 새 탭에서

이용 시간을 확인하는 중…

Lab을 찾는 중…

자신의 컴퓨터에서, 무료로: 이 책의 노트북 내려받기, 코드와 데이터를 포함해 GitHub에서 받을 수 있다.

이 장을 마치면 어시스턴트의 트레이스에 있는 각 스팬에, 해당 단계에서 OpenTelemetry의 GenAI 규약이 요구하는 이름, 종류, 속성을 부여할 수 있다. 어떤 소프트웨어가 스팬을 만들었는지, 스팬의 이름이 어떤 스키마 버전을 따르는지 밝힐 수 있다. 스팬이 레지스트리에서 벗어나면 실패하는 검사도 실행할 수 있다.

이 책이 트레이스를 쌓아 가는 어시스턴트(메시지 하나, 트레이스 하나)를 운영하는 Ambrewick의 당직 엔지니어들은 그 트레이스를 이미 쓰고 있는 도구에서 보고 싶어 한다. 그 도구들이 아는 어휘는 하나뿐이다. 규약이 모델 호출, 검색, 도구 실행, 에이전트의 한 차례에 붙인 이름이다. 1장의 이름은 그곳에서 아무 의미가 없다. 이 장에서 만드는 검사인 검증기는 각 스팬을 레지스트리의 규칙과 비교한다. 검색이 포함된 기기 질문인 메시지 809에 실행하면, 스팬 4개에서 스팬마다 하나씩 결과 4건이 나오며, 각 결과는 그 스팬에 알려진 스팬 유형이 없다고 알려 준다. SDK는 어떤 이름이든 받아들이므로 이 중 어느 것도 SDK에서는 오류로 나타나지 않았다. 그래서 이 장에서는 각 스팬에 표준의 이름과 종류를 부여하고, 누가 만들었는지 기록하며, 이름이 올바르게 유지되도록 하는 검사를 만든다. 이어서 3장에서는 클라이언트 라이브러리의 스팬을 이 이름들에 비추어 측정한다.

Development 버전의 표준

백엔드는 스팬에 대한 질문에 스팬의 이름으로 답한다. 이번 주에 모델 호출이 얼마나 걸렸는지와 같은 질문은 어떤 스팬이 모델 호출인지 모든 백엔드가 합의해야만 답이 하나로 정해지며, 표준이 바로 그 합의이다. 시맨틱 컨벤션은 스팬, 어트리뷰트 또는 메트릭에 대해 공개된 이름, 타입, 의미를 정한 것으로, 어떤 백엔드든 같은 이름을 같은 방식으로 읽게 한다. 이 표준은 OpenTelemetry의 GenAI 시맨틱 컨벤션이다.

GenAI 이름은 처음에 OpenTelemetry의 핵심 시맨틱 컨벤션 저장소에 있었다. 이 저장소는 릴리스 1.42.0에서 gen_ai 접두사 아래의 이름을 폐기했고, 그 이름들은 별도의 저장소로 옮겨졌다(변경 내역). 이 책은 그 저장소의 첫 독립 릴리스인 GenAI 컨벤션 버전 0.1.0를 따른다(변경 내역).

컨벤션은 두 가지 형태로 제공된다. 사람이 읽는 문서 페이지와, 프로그램이 읽을 수 있는 레지스트리이다. 레지스트리는 스팬 타입, 그 종류, 어트리뷰트를 YAML로 나타낸 모델이다. 이 책의 검증기는 고정된 버전의 레지스트리를 읽으므로, 검증기가 확인하는 이름은 레지스트리에 나열된 이름이다.

GenAI 컨벤션 버전 0.1.0의 모든 페이지는 Development 상태이며, 이름은 어느 릴리스에서든 바뀔 수 있다. 명세는 자체 구성 요소에 대해 Development를 정의하고, 상태 페이지는 이러한 구성 요소에 대해 다음과 같이 말한다. "The component MAY be removed without prior notice. The component SHOULD NOT be used in production." (상태 페이지). GenAI 페이지도 같은 상태를 달고 있으며, 변경 내역에는 이름이 바뀌는 모습이 나타난다. 첫 독립 릴리스는 추론 스팬 타입의 이름을 gen_ai.inference.client에서 gen_ai.client.inference로 바꾸었다. 이 책의 이름은 그 릴리스를 따르므로, 이후 릴리스에서 이름이 바뀔 수 있다.

작업 규칙: 공개하는 모든 이름 옆에 컨벤션의 버전을 고정해 적는다. Development 이름에 의존하는 대시보드에는 이름이 바뀔 때 실행되는 검사가 필요하다.

이 부분은 아직 번역되지 않았으므로 영어로 표시된다.

Span types for each step

The registry sorts spans into span types, and each type has a name pattern, a span kind and the attributes it requires. Chapter 1's steps fall into four of them. An inference span is the span of one client call to a generative model that answers the prompt or asks for a tool call. A retrieval span is the span of one run of the application's retrieval step, which returns the documents relevant to a query. A tool-execution span is the span of one run of a tool, named for the tool. An agent-invocation span is the span of one invocation of an agent. The book's agent runs in the assistant's process, so its span is the in-process type, which also covers workflows. A remote agent's span is a CLIENT span of its own type. The route and answer steps are model calls, the retrieve step is a search, the tool runs are tool runs, and each message's root is one agent run.

Span type Name pattern Kind Operation name
Inference {operation} {model} CLIENT, or INTERNAL in process chat
Retrieval {operation} INTERNAL retrieval
Tool execution execute_tool {tool} INTERNAL execute_tool
Agent invocation invoke_agent {agent} INTERNAL in process; CLIENT for a remote agent invoke_agent
inference-span-names.py Python 3.13.16 · bm25s 0.3.16 · mcp 2.3.0 · numpy 2.5.5 · opentelemetry-api 1.45.2 · opentelemetry-exporter-http-transport 0.66b2 · opentelemetry-exporter-otlp-common 0.66b2 · opentelemetry-exporter-otlp-proto-common 1.45.2 · opentelemetry-exporter-otlp-proto-http 1.45.2 · opentelemetry-instrumentation 0.66b2 · opentelemetry-instrumentation-genai-openai 1.3b0 · opentelemetry-proto 1.45.2 · opentelemetry-sdk 1.45.2 · opentelemetry-semantic-conventions 0.66b2 · opentelemetry-util-genai 1.3b0 · pydantic 2.14.4 통과
"""Print the span name each step gets from the assistant, beside the registry's pattern for that span type. The names arethe spans', the patterns are the registry's, and each assert checks one span's name against its pattern.The point rests on the four name lines: the inference, tool and agent names from message 11159 (a route, an answer, atool call and a second answer), and the retrieval name from message 809."""from lib.assistant import Assistantfrom lib.bm25 import Retrieverfrom lib.case import load_articles, load_messages, load_tool_durationsfrom lib.clock import VirtualClockfrom lib.dayrun import DAY, RECORDING, RELEASEfrom lib.export import spans_to_rowsfrom lib.genai import REGISTRY_VERSION, SCHEMA_URL, SPAN_OPERATIONS, SPAN_TYPESfrom lib.ids import SequentialIdsfrom lib.replay import Replay, ReplayContactsfrom lib.tools import Toolsfrom lib.tracing import make_providerfrom opentelemetry.sdk.trace.export.in_memory_span_exporter import InMemorySpanExporterreplay = Replay(RECORDING)retriever, tools = Retriever(load_articles(), RELEASE.top_k), Tools(load_tool_durations(), ReplayContacts(replay))rows = {}for message in (m for m in load_messages(DAY) if m.message_id in ("809", "11159")):    clock, exporter = VirtualClock(DAY, start_ns=message.arrival_ns), InMemorySpanExporter()  # one exporter per message    tracer = make_provider("ambrewick-assistant", RELEASE.service_version, "dev-day-replay", clock, SequentialIds(),                           exporter, SCHEMA_URL).get_tracer("ambrewick.assistant", schema_url=SCHEMA_URL)    Assistant(replay, retriever, tools, clock, tracer, RELEASE).handle(message)    rows[message.message_id] = spans_to_rows(exporter)agent = next(row for row in rows["11159"] if row["parent_span_id"] is None)  # the root is the agent's invocationinference = next(row for row in rows["11159"] if row["attributes"].get("gen_ai.operation.name") == "chat")tool = next(row for row in rows["11159"] if row["attributes"].get("gen_ai.operation.name") == "execute_tool")retrieval = next(row for row in rows["809"] if row["attributes"].get("gen_ai.operation.name") == "retrieval")print("GenAI conventions version:", REGISTRY_VERSION)print("inference span name:", inference["name"])print("retrieval span name:", retrieval["name"])print("tool span name:", tool["name"])print("agent span name:", agent["name"])print("inference provider name:", inference["attributes"]["gen_ai.provider.name"])print("inference prompt name:", inference["attributes"]["gen_ai.prompt.name"])print("inference prompt version:", inference["attributes"]["gen_ai.prompt.version"])# Model spans are `{operation} {model}`, retrieval is its operation alone, tools are `execute_tool {tool}`, the agent is# `invoke_agent {agent}`. Each assert checks one span against its pattern.assert inference["name"] == f"chat {RELEASE.model}" and retrieval["name"] == "retrieval"assert tool["name"] == f"execute_tool {tool['attributes']['gen_ai.tool.name']}"assert agent["name"] == f"invoke_agent {agent['attributes']['gen_ai.agent.name']}"for span_type in sorted(SPAN_OPERATIONS):  # the operation names the registry defines, per span type    print(f"operation names, {span_type}:", ", ".join(SPAN_OPERATIONS[span_type]))for span_type in sorted(SPAN_TYPES):  # the attributes the validator requires, per span type    print(f"required attributes, {span_type}:", len(SPAN_TYPES[span_type]["required"]))
출력python inference-span-names.py
GenAI conventions version: 0.1.0
inference span name: chat qwen3-4b-instruct-2507
retrieval span name: retrieval
tool span name: execute_tool remove_item
agent span name: invoke_agent ambrewick-assistant
inference provider name: openai
inference prompt name: ambrewick.route
inference prompt version: p1
operation names, gen_ai.client.inference: chat, generate_content, realtime_inference, text_completion
operation names, gen_ai.execute_tool: execute_tool
operation names, gen_ai.invoke_agent.internal: invoke_agent
operation names, gen_ai.retrieval: retrieval
required attributes, gen_ai.client.inference: 2
required attributes, gen_ai.execute_tool: 2
required attributes, gen_ai.invoke_agent.internal: 1
required attributes, gen_ai.retrieval: 1
required attributes, mcp.client: 1
required attributes, mcp.server: 1
연습문제 2.1

모델 스팬의 이름은 제공자가 아니라 모델로 짓는다

+10 증명

42행은 모델 스팬의 이름을 모델이 아니라 제공자 속성으로 짓는다. 모델 스팬을 레지스트리 패턴과 대조해 검사하도록, 실행에 사용된 모델을 기준으로 42행을 고쳐라.

print("inference prompt version:", inference["attributes"]["gen_ai.prompt.version"])# Model spans are `{operation} {model}`, retrieval is its operation alone, tools are `execute_tool {tool}`, the agent is# `invoke_agent {agent}`. Each assert checks one span against its pattern.assert tool["name"] == f"execute_tool {tool['attributes']['gen_ai.tool.name']}"assert agent["name"] == f"invoke_agent {agent['attributes']['gen_ai.agent.name']}"for span_type in sorted(SPAN_OPERATIONS):  # the operation names the registry defines, per span type
Python 3.13.16 · bm25s 0.3.16 · duckdb 2.0.1 · httpx 0.28.1 · huggingface-hub 2.4.0 · matplotlib 3.11.2 · mcp 2.3.0 · mlflow 3.18.0 · mlflow-skinny 3.18.0 · mlflow-tracing 3.18.0 · numpy 2.5.5 · openai 3.57.0 · opentelemetry-api 1.45.2 · opentelemetry-exporter-http-transport 0.66b2 · opentelemetry-exporter-otlp-common 0.66b2 · opentelemetry-exporter-otlp-proto-common 1.45.2 · opentelemetry-exporter-otlp-proto-http 1.45.2 · opentelemetry-instrumentation 0.66b2 · opentelemetry-instrumentation-genai-openai 1.3b0 · opentelemetry-proto 1.45.2 · opentelemetry-sdk 1.45.2 · opentelemetry-semantic-conventions 0.66b2 · opentelemetry-util-genai 1.3b0 · pydantic 2.14.4 · tokenizers 0.23.3에서 실행된다
연습문제 2.2

도구 이름 검사와 에이전트 이름 검사 작성하기

+10 증명

예제의 43번째 줄과 44번째 줄은 비어 있다. 도구 스팬의 이름과 에이전트 스팬의 이름을 각각의 레지스트리 패턴과 비교하는 assert 두 개를 작성한다. 이때 속성 gen_ai.tool.name과 gen_ai.agent.name을 사용한다.

# Model spans are `{operation} {model}`, retrieval is its operation alone, tools are `execute_tool {tool}`, the agent is# `invoke_agent {agent}`. Each assert checks one span against its pattern.assert inference["name"] == f"chat {RELEASE.model}" and retrieval["name"] == "retrieval"for span_type in sorted(SPAN_OPERATIONS):  # the operation names the registry defines, per span type    print(f"operation names, {span_type}:", ", ".join(SPAN_OPERATIONS[span_type]))for span_type in sorted(SPAN_TYPES):  # the attributes the validator requires, per span type
Python 3.13.16 · bm25s 0.3.16 · duckdb 2.0.1 · httpx 0.28.1 · huggingface-hub 2.4.0 · matplotlib 3.11.2 · mcp 2.3.0 · mlflow 3.18.0 · mlflow-skinny 3.18.0 · mlflow-tracing 3.18.0 · numpy 2.5.5 · openai 3.57.0 · opentelemetry-api 1.45.2 · opentelemetry-exporter-http-transport 0.66b2 · opentelemetry-exporter-otlp-common 0.66b2 · opentelemetry-exporter-otlp-proto-common 1.45.2 · opentelemetry-exporter-otlp-proto-http 1.45.2 · opentelemetry-instrumentation 0.66b2 · opentelemetry-instrumentation-genai-openai 1.3b0 · opentelemetry-proto 1.45.2 · opentelemetry-sdk 1.45.2 · opentelemetry-semantic-conventions 0.66b2 · opentelemetry-util-genai 1.3b0 · pydantic 2.14.4 · tokenizers 0.23.3에서 실행된다
연습문제 2.3

검색 span의 이름에 인덱스가 없는 이유

+10 증명

검색이 지식 베이스를 대상으로 실행되는데도 예제는 "retrieval span name: retrieval"을 출력한다. 이름에 인덱스가 들어 있지 않은 이유를 올바르게 설명한 것은 무엇인가?

검색 span의 이름에 인덱스가 없는 이유: 올바른 설명을 고른다
Python 3.13.16에서 실행된다

The model span changes most. Its name is the operation, a space, and the model's name, so a reader scanning a trace sees which model answered each call. Message 11159, a lists request with one tool call, has its first model call named chat qwen3-4b-instruct-2507. The registry gives one list of well-known values for gen_ai.operation.name on an inference span, and a custom value MAY be used beyond it (registry attributes). The validator maps each value to a span type through a map the book makes, and that map gives the inference type chat, generate_content, realtime_inference, text_completion. The assistant writes chat for each of its calls. The example asserts the model span's name against the operation and the model the run used, and it builds the tool and agent names from the attributes their spans carry, so a drift in either one fails the run.

The retrieval span is named by its operation alone, retrieval. The registry's pattern leaves no room for the index it searched, so the knowledge base's name stays out of the span name. A tool run is named for its tool, execute_tool remove_item, the run of the list tool that removed an item in message 11159. The root is named invoke_agent ambrewick-assistant, and it replaces chapter 1's message span. We keep invoke_agent rather than invoke_workflow, because the model chooses the route and whether to call a tool. The model drives the control flow through tool calls, which is the case the registry's agent type describes.

One attribute the registry leaves open is the provider. In the book, the inference span's gen_ai.provider.name is openai, and that value is our judgement. The registry's well-known values for the attribute include no value for llama.cpp, and a provider the list lacks may take a custom value (registry). The attribute's general note says it "SHOULD be set based on the instrumentation's best knowledge and may differ from the actual upstream provider" (client inference). We record openai because Ambrewick's client speaks OpenAI's API to its endpoint, and the official package records openai for that call, as chapter 3 shows. A reader whose model is served another way should choose by the same rule and say so.

Of the spans the assistant makes, the fallback span is the only one the registry does not name. The book keeps it, the validator flags it, and the validation section says why that flag is the right answer.

Working rule: Name each span from its registry pattern, not from the function that made it, and take the operation name from the registry's well-known values. Where the registry gives no value for something you run, use the value the client and its official instrumentation would write, and say that it's a judgement.

스팬 종류는 프로세스를 따른다

스팬의 종류는 그 작업이 어디에서 실행되었는지를 나타낸다. 프로세스 밖으로 나가는 호출은 CLIENT, 받은 호출은 SERVER, 내부에서 수행한 작업은 INTERNAL이다. 이 밖에 PRODUCER와 CONSUMER가 있으며, 큐에 넘긴 작업을 나타낸다. 모델 호출은 판단하기 어려운 경우다. 레지스트리는 "계측 대상인 GenAI 시스템이 보통 클라이언트와 다른 프로세스에서 실행되거나 GenAI 호출이 HTTP 같은 계측된 프로토콜을 통해 이루어질 때는 CLIENT 종류를 사용하기를 권장한다"라고 설명한다(client inference). 엔드포인트 뒤에 있는 모델은 어시스턴트의 프로세스 밖으로 나가는 호출로 접근하므로 그 스팬은 CLIENT다. 레지스트리는 같은 프로세스에서 실행되는 모델에는 INTERNAL도 허용한다. 그래서 종류를 정하는 일이 판단의 문제가 된다. 이 책은 스팬이 보여 줄 수 있는 기준으로 이 규칙을 적용한다. 기준은 호출이 서버를 명시하는지 여부다. 서버를 명시하는 호출은 CLIENT이고, 서버를 명시하지 않는 호출은 INTERNAL일 수 있다.

span-kinds-by-process.py Python 3.13.16 · bm25s 0.3.16 · mcp 2.3.0 · numpy 2.5.5 · opentelemetry-api 1.45.2 · opentelemetry-exporter-http-transport 0.66b2 · opentelemetry-exporter-otlp-common 0.66b2 · opentelemetry-exporter-otlp-proto-common 1.45.2 · opentelemetry-exporter-otlp-proto-http 1.45.2 · opentelemetry-instrumentation 0.66b2 · opentelemetry-instrumentation-genai-openai 1.3b0 · opentelemetry-proto 1.45.2 · opentelemetry-sdk 1.45.2 · opentelemetry-semantic-conventions 0.66b2 · opentelemetry-util-genai 1.3b0 · pydantic 2.14.4 통과
"""Give one model call two kinds: CLIENT when the model sits behind an endpoint, as the trace shows it, and INTERNALwhen the same assistant runs the model in process. Then run the validator on both.The point rests on the two model-call kind lines and on the zero findings: the registry allows INTERNAL for anin-process model (it says MAY), and the validator accepts it when the call names no server. An endpoint span markedINTERNAL is flagged, because it names one."""from lib.dayrun import DAY, RECORDING, run_day_tracedfrom lib.genai import REGISTRY_VERSION, validatefrom lib.replay import Replayclass InProcess:    """The recorded model, run as if it shared the assistant's process: the same answers, and no endpoint."""    in_process = True    def __init__(self, replay):        self._replay = replay    def reply(self, request):        return self._replay.reply(request)rows = run_day_traced(DAY, ["809"], live=False).spans  # a devices message: a route and an answer call, behind an endpointlocal = run_day_traced(DAY, ["809"], backend=InProcess(Replay(RECORDING)), live=False).spans  # the same model in processendpoint = next(row for row in rows if row["name"].startswith("chat "))in_process = next(row for row in local if row["name"].startswith("chat "))retrieval = next(row for row in rows if row["name"] == "retrieval")root = next(row for row in rows if row["parent_span_id"] is None)marked = dict(endpoint, kind="INTERNAL")  # the endpoint's span, wrongly marked as in processprint("GenAI conventions version:", REGISTRY_VERSION)print("model call kind, behind an endpoint:", endpoint["kind"])print("model call kind, in process:", in_process["kind"])address, port = endpoint["attributes"]["server.address"], endpoint["attributes"]["server.port"]print("server the endpoint span names:", f"{address}:{port}")print("findings on the in-process span:", len(validate(in_process)))print("findings on the endpoint span marked INTERNAL:", len(validate(marked)))print("retrieval span kind:", retrieval["kind"])print("agent span kind:", root["kind"])assert validate(endpoint) == [] and validate(in_process) == []  # both kinds are the registry'sassert "server.address" not in in_process["attributes"]  # an in-process model names no serverassert len(validate(marked)) == 1 and "kind is INTERNAL" in validate(marked)[0]assert validate(retrieval) == [] and validate(root) == []  # INTERNAL is the registry's kind for these two types
출력python span-kinds-by-process.py
GenAI conventions version: 0.1.0
model call kind, behind an endpoint: CLIENT
model call kind, in process: INTERNAL
server the endpoint span names: localhost:8000
findings on the in-process span: 0
findings on the endpoint span marked INTERNAL: 1
retrieval span kind: INTERNAL
agent span kind: INTERNAL

메시지 809의 모델 호출을 두 방식으로 실행해 보면 규칙이 어떻게 작동하는지 알 수 있다. 메시지 809는 기기에 관한 질문이며 라우팅 호출과 응답 호출로 이루어진다. 엔드포인트 뒤에서 실행하면 스팬의 종류는 CLIENT이고, 같은 호출을 프로세스 안에서 실행하면 INTERNAL가 된다. 엔드포인트의 스팬은 서버를 명시하고, 프로세스 내부의 스팬은 서버를 명시하지 않는다. 검증기는 프로세스 내부 스팬에서 0개의 발견 사항을 보고하며, 예제는 이를 단언한다. 엔드포인트의 스팬을 INTERNAL로 표시하면 그 스팬은 여전히 서버를 명시하므로, 검증기는 그 스팬에서 1개의 발견 사항을 보고한다. 발견 사항의 텍스트가 종류인 kind is INTERNAL을 명시하는지 단언하며, 출력하는 것은 개수뿐이다. 이 발견 사항이 규칙이 막으려는 실패다.

이 책의 dev-day 트레이스는 모두 CLIENT다. 기록된 모델 호출이 엔드포인트를 통해 처리되었기 때문이다. 프로세스 내부 사례는 같은 모델을 어시스턴트 자신의 코드에서 호출하는 경우이며, 이 책은 이 예제에서만 실행한다. 모델을 프로세스 안으로 옮기는 독자는 종류도 함께 바뀌어야 한다고 예상해야 하고, 스팬이 여전히 서버를 명시하면 검증기가 이를 알려 주리라고 예상해야 한다.

검색 스팬과 에이전트 스팬은 둘 다 INTERNAL이며, 예제는 각각에 대해 이를 단언한다. 두 스팬의 작업이 어시스턴트 내부에서 실행되기 때문이다. 출력된 종류는 검색 스팬이 INTERNAL, 에이전트 스팬이 INTERNAL이다. 레지스트리는 두 종류를 모두 제시하며(registry), 검증기가 이를 확인한다.

작업 규칙: 호출이 서버로 가면, 같은 머신에 있는 서버라도 모델 스팬은 CLIENT로 지정한다. 모델이 자신의 프로세스에서 실행되고 스팬이 서버를 명시하지 않을 때만 INTERNAL로 지정하며, 지정한 각 종류는 검증기로 확인한다.

스팬이 반드시 가져야 하는 속성

이름은 백엔드에 스팬이 무엇인지 알려 준다. 요구 수준은 그 스팬이 어떤 속성을 반드시 가져야 하는지 알려 준다. 요구 수준은 속성이 언제 나타나야 하는지를 말하며, 필수, 조건부 필수, 권장, 옵트인의 네 가지가 있다(요구 수준). 필수 속성은 해당 유형의 모든 스팬에 나타나야 한다. 조건부 필수 속성은 조건이 성립할 때 나타나며, 레지스트리는 그 조건을 속성 옆에 적어 둔다. 권장 속성은 좋은 스팬이 무엇을 담는지를 말해 주고, 옵트인 속성은 무언가가 그것을 켤 때만 나타난다.

레지스트리는 각 스팬 유형이 반드시 가져야 하는 속성도 정해 둔다. 이 책의 모듈 lib.genai는 레지스트리의 모든 요구 수준을 담고 있다. 따라서 검증기가 확인하는 요구 수준과 종류는 누군가 직접 입력한 목록이 아니라 레지스트리의 것이다. 검증기는 종류와 필수 속성만 확인하고 그 밖의 것은 확인하지 않는다. 그래서 스팬은 검증기를 통과하고도 조건부 경우에 레지스트리가 요구하는 속성을 갖추지 못할 수 있다. inference-span-names 예제가 출력하는 검증기의 개수는 각 스팬 유형이 몇 개를 요구하는지 보여 준다. 추론 스팬에는 2, 도구 실행 스팬에는 2, 검색 스팬에는 1, 에이전트 스팬에는 1이다. 이 속성들 가운데 필수인 것은 작업 이름과 제공자 이름이므로 제공자 판단은 선택 사항이 아니다. 둘 중 하나라도 없는 스팬은 검사에 실패한다.

개인정보 측면에서 주의해야 할 것은 옵트인 속성이다. 모델 호출의 메시지 내용은 옵트인이므로, 스위치로 요청하지 않는 한 이 책의 스팬에는 그 내용이 하나도 들어가지 않는다. 그 스위치가 무엇을 하는지는 3장에서 설명한다.

검증기가 읽지 않는 것은 조건부 요구 사항이다. gen_ai.prompt.version는 스팬이 gen_ai.prompt.name을 가지고 있고 버전을 알 수 있을 때 추론 스팬에서 조건부 필수이다. gen_ai.prompt.name은 이름이 붙은 프롬프트 템플릿을 사용할 때 조건부 필수이다(레지스트리). 어시스턴트의 프롬프트에는 이름과 버전이 있으므로 추론 스팬은 둘 다 가진다. 메시지 11159의 라우팅 호출에는 ambrewick.route와 p1가 모두 붙어 있다. 10장은 이 쌍을 질의하여 릴리스를 구분한다. 검증기는 필수 속성만 읽기 때문에 둘 중 하나라도 없는 스팬을 보고하지 않으며, 조건부 속성의 누락은 검증기가 보고하지 않는 누락이다.

작업 규칙: 스팬의 이름을 읽기 전에 요구 수준을 먼저 읽는다. 필수 속성이 없으면 스팬의 결함이다. 조건부 필수 속성이 없는 경우는 조건이 성립할 때만 결함이므로, 결함으로 등록하기 전에 레지스트리에서 조건을 읽는다.

스팬을 만든 주체

스팬은 무엇을 측정했는지를 말해 주고, 누가 측정했는지는 다른 두 곳이 말해 준다. 리소스와 계측 스코프(instrumentation scope)이다. 계측 스코프는 스팬을 만든 코드 단위의 이름을 나타내며, 보통은 계측 라이브러리이고 여기서는 어시스턴트 자체의 모듈이다. 스키마 URL은 텔레메트리가 따르는, 공개된 텔레메트리 스키마인 시맨틱 규약의 한 릴리스를 가리킨다. 본문에서는 스키마 URL을 직접 적지 않으며, 여기에 나오는 URL은 모두 예제가 출력한 것이다.

리소스에는 이 책이 직접 설정하는 속성이 세 가지 있다. service.name은 ambrewick-assistant이다. service.version은 1.0.0이며 릴리스를 표시하는데, 10장에서 이 값을 읽어 릴리스별로 트레이스를 나눈다. service.instance.id은 dev-day-replay이다. 리플레이는 인스턴스 ID를 직접 설정하므로, 다시 실행해도 같은 인스턴스를 가리키고 실행마다 트레이스를 비교할 수 있다. 재시작하는 프로세스는 인스턴스 ID가 설정되어 있을 때만 그 ID를 유지하며, 재시작을 거쳐 하나의 인스턴스를 따라가는 쿼리에는 ID가 고정되어 있어야 한다.

resource-and-schema.py Python 3.13.16 · bm25s 0.3.16 · mcp 2.3.0 · numpy 2.5.5 · opentelemetry-api 1.45.2 · opentelemetry-exporter-http-transport 0.66b2 · opentelemetry-exporter-otlp-common 0.66b2 · opentelemetry-exporter-otlp-proto-common 1.45.2 · opentelemetry-exporter-otlp-proto-http 1.45.2 · opentelemetry-instrumentation 0.66b2 · opentelemetry-instrumentation-genai-openai 1.3b0 · opentelemetry-proto 1.45.2 · opentelemetry-sdk 1.45.2 · opentelemetry-semantic-conventions 0.66b2 · opentelemetry-util-genai 1.3b0 · pydantic 2.14.4 통과
"""Print the resource and the instrumentation scope of the renamed spans, with the schema URL each one carries, besidechapter 1's stamp.The point rests on the schema lines: chapter 1's resource said 1.44.0, the renamed spans say 1.45.0, and the SDK'sconstants have no 1.45.0 schema, which the assert checks. The book takes that URL from the registry's manifest(genai.SCHEMA_URL), and make_provider puts it on the tracer as well as the resource."""from lib.dayrun import RELEASEfrom lib.genai import SCHEMA_URLfrom lib.ids import SequentialIdsfrom lib.tracing import make_provider, spanfrom opentelemetry.sdk.trace.export.in_memory_span_exporter import InMemorySpanExporterfrom opentelemetry.semconv.schemas import SchemasCHAPTER_1_SCHEMA = "https://opentelemetry.io/schemas/1.44.0"def version_key(url):    """Sort key for a schema URL: its version as numbers, so 1.9 sorts before 1.44."""    return tuple(int(part) for part in url.rsplit("/", 1)[1].split("."))exporter = InMemorySpanExporter()provider = make_provider("ambrewick-assistant", RELEASE.service_version, "dev-day-replay", None, SequentialIds(),                         exporter)tracer = provider.get_tracer("ambrewick.assistant")  # no schema given: the tracer carries the provider'sspan(tracer, "resource probe", 1, 2)  # one ended span, so the scope's schema can be read from itscope = exporter.get_finished_spans()[0].instrumentation_scopechapter_1 = make_provider("ambrewick-assistant", RELEASE.service_version, "dev-day-replay", None, SequentialIds(),                          InMemorySpanExporter(), CHAPTER_1_SCHEMA)  # the resource chapter 1 built, read back from itknown = {schema.value for schema in Schemas}  # what opentelemetry-semantic-conventions 0.66b2 can stampprint("chapter 1's resource schema URL:", chapter_1.resource.schema_url)print("renamed spans' resource schema URL:", provider.resource.schema_url)print("renamed spans' scope schema URL:", scope.schema_url)print("instrumentation scope name:", scope.name)print("highest schema in the SDK's constants:", max(known, key=version_key))print("service.name:", provider.resource.attributes["service.name"])print("service.version:", provider.resource.attributes["service.version"])print("service.instance.id:", provider.resource.attributes["service.instance.id"])assert SCHEMA_URL not in known  # the constants stop at 1.44.0, so the book takes its 1.45.0 from the registryassert provider.resource.schema_url == scope.schema_url == SCHEMA_URLassert provider.resource.attributes["service.instance.id"] == "dev-day-replay"  # set, not drawn at random
출력python resource-and-schema.py
chapter 1's resource schema URL: https://opentelemetry.io/schemas/1.44.0
renamed spans' resource schema URL: https://opentelemetry.io/schemas/1.45.0
renamed spans' scope schema URL: https://opentelemetry.io/schemas/1.45.0
instrumentation scope name: ambrewick.assistant
highest schema in the SDK's constants: https://opentelemetry.io/schemas/1.44.0
service.name: ambrewick-assistant
service.version: 1.0.0
service.instance.id: dev-day-replay
연습문제 2.4

스키마 URL을 레지스트리에서 가져오는 이유

+10 증명

출력에서 이름이 바뀐 스팬에는 SDK 상수에 있는 가장 높은 URL보다 더 새로운 스키마 URL이 붙어 있다. 이 예제는 왜 그 상수가 아니라 레지스트리의 매니페스트에서 URL을 가져오는가?

스키마 URL을 레지스트리에서 가져오는 이유: 올바른 설명을 고른다
Python 3.13.16에서 실행된다

이 장에서 스키마 URL이 바뀌었으며, 예제는 두 값을 모두 출력한다. 1장의 리소스는 https://opentelemetry.io/schemas/1.44.0라고 적었다. 그것은 고정된 semantic-conventions 패키지가 담고 있는 가장 새로운 스키마인 0.66b2의 값이었고, 이 SDK 상수에서 가장 높은 스키마는 https://opentelemetry.io/schemas/1.44.0이다. 1장의 이름은 어떤 규약도 따르지 않았으므로, 그 스탬프는 이 책의 스팬이 말한 어떤 것도 설명하지 못했다. 이름을 바꾼 스팬은 https://opentelemetry.io/schemas/1.45.0를 스탬프로 찍는데, 이것은 GenAI 규약 v0.1.0이 의존하는 핵심 시맨틱 규약 릴리스이다. GenAI 규약은 v0.1.0에서 자체 스키마 URL을 공개하지 않는다. 핵심 규약은 gen_ai.* 이름을 1.42.0에서 폐기했고, 이때 해당 이름은 별도의 저장소로 옮겨졌다. 따라서 스탬프는 리소스의 service.* 이름이 따르는 핵심 릴리스가 무엇인지를 말해 주고, GenAI 버전은 검사 옆에 함께 기록된다(0.1.0). 이 책이 생성하는 모듈은 레지스트리의 매니페스트에서 그 URL을 가져오며, 예제는 SDK의 상수에 그 URL이 들어 있지 않다는 것을 단언한다. 상수는 자기 릴리스에서 멈춰 있다. service.* 속성 가운데 그 URL이 가리키는 릴리스가 폐기하는 것은 service.peer.name과 service.peer.namespace뿐이므로(변경 이력), 리소스가 설정하는 세 속성은 어느 URL에서든 똑같이 해석된다.

이름을 바꾼 스팬의 계측 스코프는 ambrewick.assistant이며, 그 스키마 URL은 리소스의 것과 같다. 예제가 이를 단언한다. 공식 클라이언트 라이브러리는 자체 스코프를 기록한다.

작업 규칙: 리소스에 service.name과 service.version을 직접 설정하고, service.instance.id에는 프로덕션 절에서 설명하는 대로 인스턴스마다 고유한 값을 지정한다. 그런 다음 트레이서에 사용 중인 규약이 의존하는 핵심 릴리스의 스키마 URL을 지정하되, 규약보다 뒤처질 수 있는 SDK의 상수가 아니라 레지스트리의 매니페스트에서 가져온다. GenAI 규약의 버전은 검증기 옆에 고정한다. v0.1.0에는 스탬프로 찍을 스키마 URL이 없기 때문이다.

레지스트리를 기준으로 검증하기

이름은 레지스트리에 대한 주장이며, 검증기는 그 주장을 검증할 수 있게 해 준다. 검증기는 각 스팬의 유형을 gen_ai.operation.name에서 찾고, MCP 스팬이면 메서드에서 찾는다. MCP는 Model Context Protocol로, 도구 서버가 사용하는 프로토콜이다. 그런 다음 검증기는 스팬의 종류(kind)와 필수 속성이 레지스트리의 규칙에 맞는지 확인한다. 유형을 찾지 못한 스팬에는 그 사실을 알리는 결과 항목이 붙고, 각 항목은 해당 스팬의 이름을 밝히므로 출력은 고쳐야 할 항목의 목록처럼 읽힌다.

검증기는 1장의 스팬의 유형을 알아낼 수 없다. 이 스팬들에는 검증기가 스팬의 유형을 찾을 때 읽는 속성인 gen_ai.operation.name가 없기 때문이다. 메시지 809의 스팬 4개는 message, route, retrieve, answer이며, 검사는 각각에 대해 no known span type for this row라는 항목을 하나씩 출력한다. 이 항목이 그 이유를 알려 준다. 루트의 이름을 바꾸면 message는 invoke_agent ambrewick-assistant가 되고, 그 스팬은 자신의 유형에 따라 검사된다.

validate-the-spans.py Python 3.13.16 · bm25s 0.3.16 · mcp 2.3.0 · numpy 2.5.5 · opentelemetry-api 1.45.2 · opentelemetry-exporter-http-transport 0.66b2 · opentelemetry-exporter-otlp-common 0.66b2 · opentelemetry-exporter-otlp-proto-common 1.45.2 · opentelemetry-exporter-otlp-proto-http 1.45.2 · opentelemetry-instrumentation 0.66b2 · opentelemetry-instrumentation-genai-openai 1.3b0 · opentelemetry-proto 1.45.2 · opentelemetry-sdk 1.45.2 · opentelemetry-semantic-conventions 0.66b2 · opentelemetry-util-genai 1.3b0 · pydantic 2.14.4 통과
"""Run the validator over chapter 1's rough spans for message 809: every span fails, because none names a registry spantype.The point rests on the count of findings, one per span, and on the text of each: "no known span type" means the spancarries neither `gen_ai.operation.name` nor an MCP method, which is how the validator finds a registry span's type."""from lib.dayrun import RELEASE, run_dev_dayfrom lib.export import spans_to_rowsfrom lib.genai import REGISTRY_VERSION, validatefrom lib.ids import SequentialIdsfrom lib.report import fmt_intfrom lib.tracing import make_provider, spanfrom opentelemetry.sdk.trace.export.in_memory_span_exporter import InMemorySpanExporter# Chapter 1 stamped this schema; kept so the spans are the ones chapter 1 printed.CHAPTER_1_SCHEMA = "https://opentelemetry.io/schemas/1.44.0"(run,) = run_dev_day(["809"])  # message 809: a route call, a retrieval, and an answer calloutcome = run.outcomeexporter = InMemorySpanExporter()provider = make_provider("ambrewick-assistant", RELEASE.service_version, "dev-day-replay", run.clock, SequentialIds(),                         exporter, CHAPTER_1_SCHEMA)tracer = provider.get_tracer("ambrewick.assistant")# Chapter 1's names: the root is the message, each step is named by its step, and no kind is set (INTERNAL).root = span(tracer, "message", run.arrived_ns, run.replied_ns,            attributes={"ambrewick.route": outcome.route, "ambrewick.reply.source": outcome.source})for step in outcome.steps:    attributes = {"ambrewick.step": step.step}    if step.step in ("route", "answer"):  # model calls carry their token counts, under the book's own keys        attributes |= {"ambrewick.tokens.input": step.prompt_tokens, "ambrewick.tokens.cached": step.cached_tokens,                       "ambrewick.tokens.output": step.completion_tokens}    span(tracer, step.step, step.start_ns, step.end_ns, parent=root, attributes=attributes)rows = spans_to_rows(exporter)  # sorted by (trace, start, span), so the findings print in the same order every runfindings = [finding for row in rows for finding in validate(row)]print("GenAI conventions version:", REGISTRY_VERSION)print("spans checked:", fmt_int(len(rows)))for finding in findings:    print("finding:", finding)print("findings, no known span type:", fmt_int(sum("no known span type" in finding for finding in findings)))print("findings, all:", fmt_int(len(findings)))assert all(len(validate(row)) == 1 for row in rows)  # each span fails once, and only once
출력python validate-the-spans.py
GenAI conventions version: 0.1.0
spans checked: 4
finding: message: no known span type for this row
finding: route: no known span type for this row
finding: retrieve: no known span type for this row
finding: answer: no known span type for this row
findings, no known span type: 4
findings, all: 4
연습문제 2.5

1장의 스팬에 타입이 없는 이유

+10 증명

메시지 809의 모든 스팬이 "no known span type for this row"를 출력한다. 그 이유를 설명하는 진술은 무엇인가?

1장의 스팬에 타입이 없는 이유: 올바른 설명을 고른다
Python 3.13.16에서 실행된다

이름을 바꾸면 스팬이 검사를 통과한다. 이 예제는 개발일 메시지 20개 전체에서 스팬 74개를 검사하며, 레지스트리가 정의하는 스팬에서는 문제를 0건 찾는다. 단일 단언문이 이 개수를 0으로 고정하므로, 이름을 깨뜨리는 변경은 새로운 숫자를 출력하는 대신 실행을 실패시킨다.

validate-the-renamed-spans.py Python 3.13.16 · bm25s 0.3.16 · mcp 2.3.0 · numpy 2.5.5 · opentelemetry-api 1.45.2 · opentelemetry-exporter-http-transport 0.66b2 · opentelemetry-exporter-otlp-common 0.66b2 · opentelemetry-exporter-otlp-proto-common 1.45.2 · opentelemetry-exporter-otlp-proto-http 1.45.2 · opentelemetry-instrumentation 0.66b2 · opentelemetry-instrumentation-genai-openai 1.3b0 · opentelemetry-proto 1.45.2 · opentelemetry-sdk 1.45.2 · opentelemetry-semantic-conventions 0.66b2 · opentelemetry-util-genai 1.3b0 · pydantic 2.14.4 통과
"""Run the validator over every span of the dev day's twenty messages: no finding on any span the registry defines, andone on each of the book's own fallback spans, which the registry does not define.The point rests on the line "findings on registry spans: 0", which is asserted, and on the fallback count, whichequals the fallback replies."""from lib.assistant import Assistantfrom lib.bm25 import Retrieverfrom lib.case import load_articles, load_messages, load_tool_durationsfrom lib.clock import VirtualClockfrom lib.dayrun import DAY, RECORDING, RELEASEfrom lib.export import spans_to_rowsfrom lib.genai import REGISTRY_VERSION, SCHEMA_URL, validatefrom lib.ids import SequentialIdsfrom lib.replay import Replay, ReplayContactsfrom lib.report import fmt_intfrom lib.tools import Toolsfrom lib.tracing import make_providerfrom opentelemetry.sdk.trace.export.in_memory_span_exporter import InMemorySpanExporterfrom collections import Counterreplay = Replay(RECORDING)retriever, tools = Retriever(load_articles(), RELEASE.top_k), Tools(load_tool_durations(), ReplayContacts(replay))messages, fallback_replies, rows = load_messages(DAY), 0, []for message in messages:  # arrival order, as the replay needs; each message gets its own clock, exporter and trace    clock = VirtualClock(DAY, start_ns=message.arrival_ns)    exporter = InMemorySpanExporter()  # one per message, so each message's IDs start from 1    tracer = make_provider("ambrewick-assistant", RELEASE.service_version, "dev-day-replay", clock, SequentialIds(),                           exporter, SCHEMA_URL).get_tracer("ambrewick.assistant", schema_url=SCHEMA_URL)    fallback_replies += Assistant(replay, retriever, tools, clock, tracer, RELEASE).handle(message).source == "fallback"    rows += spans_to_rows(exporter)book = [row for row in rows if row["name"] == "ambrewick.fallback"]# The book's own fallback span is not a registry span, so it is checked apart from the others.registry_findings = [finding for row in rows if row["name"] != "ambrewick.fallback" for finding in validate(row)]book_findings = [finding for row in book for finding in validate(row)]# A span with no gen_ai.operation.name is counted under its own name, which is how the fallback span appears.operations = Counter(row["attributes"].get("gen_ai.operation.name", row["name"]) for row in rows)print("GenAI conventions version:", REGISTRY_VERSION)print("messages:", fmt_int(len(messages)))print("spans checked:", fmt_int(len(rows)))for operation in sorted(operations):    print(f"spans, {operation}:", fmt_int(operations[operation]))print("findings on registry spans:", fmt_int(len(registry_findings)))print("fallback replies:", fmt_int(fallback_replies))print("findings on the book's fallback span:", fmt_int(len(book_findings)))assert not registry_findings  # zero findings on every span the registry definesassert len(book_findings) == len(book) == fallback_replies  # one per fallback span, and each span is a fallback replyassert all("no known span type" in finding for finding in book_findings)
출력python validate-the-renamed-spans.py
GenAI conventions version: 0.1.0
messages: 20
spans checked: 74
spans, ambrewick.fallback: 6
spans, chat: 37
spans, execute_tool: 3
spans, invoke_agent: 20
spans, retrieval: 8
findings on registry spans: 0
fallback replies: 6
findings on the book's fallback span: 6

검증기는 다른 스팬에는 항목을 붙인다. 6건의 대체 응답에는 각각 ambrewick.fallback 스팬이 있고, 검사는 그 6건 모두에 no known span type 항목을 붙인다. 이는 올바른 결과이며 규약의 실패가 아니다. 레지스트리는 자신이 명시한 유형만 정의하고, 그 밖의 스팬에는 유형이 없다. 이 책의 스팬과 속성은 책의 네임스페이스인 ambrewick.에 속하며, 명명 규칙은 이름이 네임스페이스 안에 있도록 요구한다(명명 규칙). 스팬이 레지스트리 밖에 있다는 항목은 그 스팬이 책 고유의 스팬이라는 뜻이다. 각 표시가 바로 이 항목이며 다른 항목이 아니라고 단언하므로, 레지스트리 스팬에 항목이 새로 붙으면 실행이 실패한다.

작업 규칙: 레지스트리 스팬에 붙은 항목은 결함으로 읽는다. 자신의 네임스페이스에 속한 스팬에 붙은 항목은 그 스팬이 자신의 것이라는 레지스트리의 답으로 읽는다.

프로덕션에서 스팬 이름 짓기

여기서 다루는 검증기는 예제 안에서 기록된 스팬을 대상으로 실행된다. 프로덕션에서도 같은 검사를 서비스가 실제로 내보내는 스팬에 실행해야 하는데, 이때 검사가 조용히 실패하게 만드는 요인이 세 가지 있다. 네 번째 요인은 인스턴스 ID가 의미를 갖는지를 결정한다. 우리는 Development 이름이 고정되고 검증된 경우에 프로덕션에서 사용할 것을 권장한다. 업그레이드 후 검증기를 처음 실행하면 무엇이 바뀌었는지 알 수 있기 때문이다.

첫 번째는 이름의 내용이다. 명세는 스팬 이름이 해당 스팬 부류에 대해 "가장 일반적인 문자열"이어야 한다고 요구하며, get_account/42을 지나치게 구체적인 예로 든다(span API). 모델 스팬의 이름에는 짧은 고정 목록에서 고른 모델이 들어가며, 이 정도면 충분히 일반적이다. 사용자 ID로 만든 이름은 사용자마다 새로운 이름이 되는데, 레지스트리의 패턴에는 그런 이름이 들어갈 자리가 없다. 스팬 이름에 식별자가 들어 있는 것을 본 검토자는 검증기의 결과와 무관하게 이를 결함으로 다루어야 한다.

두 번째는 SDK이다. SDK는 잘못된 이름을 막지 않는다. 1장의 거친 이름들은 그대로 통과했고, 레지스트리 이름의 철자가 틀려도 마찬가지로 통과할 것이다. 레지스트리를 읽는 것은 검증기뿐이므로, 검증기를 실행하지 않고 스팬을 내보내는 파이프라인에는 검사가 전혀 없는 셈이다. 검증기는 테스트에서만 실행하지 말고 스팬을 내보내는 파이프라인에서도 실행할 것을 권장한다.

세 번째는 업그레이드이다. Development 이름은 어느 릴리스에서든 바뀔 수 있으며, 업그레이드 후 검증기를 처음 실행하면 바뀐 항목이 목록으로 나온다. 고정된 버전을 바꾸기 전에 그 목록을 읽고, 이름은 버전과 같은 풀 리퀘스트에서 바꾼다. 이전 이름을 쓰는 다른 패키지의 스팬이 같은 백엔드에 도달할 수도 있다. 그런 스팬과 이 책의 스팬을 함께 담은 백엔드에서는 하나의 단계에 두 가지 어휘가 보인다.

네 번째는 인스턴스 ID이다. service.namespace, service.name, service.instance.id의 세 값 조합은 전역에서 고유해야 한다(MUST)(service registry). SDK의 기본값은 프로세스마다 새로 만든 무작위 UUID이다. 프로덕션에서는 이 무작위 UUID를 유지하거나 인스턴스마다 고유한 ID에서 UUIDv5를 도출하되, 하나의 값을 여러 레플리카가 공유하게 해서는 안 된다. 리플레이에서 쓰는 고정 인스턴스 ID는 리플레이에는 맞지만 그대로 복사해서는 안 된다.

스팬을 추가할 때는 레지스트리 유형을 먼저 쓰고, 그다음 이름, 마지막으로 종류를 쓴다. 유형이 이름 패턴과 종류를 정하므로 이 순서를 권장한다.

작업 규칙: 스팬을 내보내는 파이프라인에서 검증기를 실행하고, 지적 사항이 있으면 빌드를 실패시킨다. 컨벤션의 버전을 검사 옆에 고정하고, 버전을 올리기 전에 변경 내역을 읽는다.

이 장에서 결정한 것

레지스트리는 바뀔 것이고, 이름도 함께 바뀔 것이다. 이 장이 정하는 것은 이 책의 스팬이 따르는 버전, 그리고 스팬이 그 버전을 따르지 않게 되었을 때 이를 알려 주는 검사다. 아래의 각 선택은 이 책의 나머지 부분이 기대고 있는 것이며, 예제는 검증할 수 있는 선택마다 그것을 단언한다.

  • 이 책의 이름은 GenAI conventions 0.1.0을 따르며, 레지스트리가 Development 단계이므로 그 버전은 검증기 옆에 고정한다.
  • 검색 스팬의 이름은 연산만으로 retrieval라고 짓는다. 레지스트리의 패턴에는 그 밖의 것을 넣을 자리가 없기 때문이다.
  • 제공자 값은 openai이다. 이것은 우리의 판단이며 레지스트리의 안내와 나란히 인용한다. 레지스트리에는 llama.cpp의 값을 대조해 볼 기준이 없으므로 검증기는 이를 검사할 수 없다.
  • 어시스턴트의 프롬프트에는 이름과 버전을 붙인다. 따라서 추론 스팬은 gen_ai.prompt.name와 gen_ai.prompt.version를 함께 가지며, 레지스트리는 이를 조건부 필수로 정한다.
  • 모델 스팬의 종류는 프로세스를 따른다. 서버 뒤에서는 CLIENT이고, 스팬이 서버를 지정하지 않는 프로세스 내부에서만 INTERNAL이다.
  • 이 책의 리소스와 트레이서는 SDK의 최신 상수가 아니라, 레지스트리가 의존하는 코어 릴리스의 스키마 URL을 가진다.
  • 검증기는 레지스트리에 있는 스팬에서 나온 발견 사항을 결함으로 보고하고, 이 책 자체의 대체 스팬에는 결함이 아닌 별도의 발견 사항을 붙인다.

이 판의 이 장

2026.11.2판예제 통과 2026년 11월 235 of 5개 예제 in this chapter pass

영어판 2026.11.2판을 번역한 것이다.

Labs 시작

도서는 계속 무료로 읽을 수 있다.

요금 보기

이 절 인용

형식

각 형식은 이 번역이 따르는 영문 원서를 출처로 표기한다.

모든 형식은 이 판을 명시한다. 링크는 현재 판을 열며, 여기서 절의 제목은 본문이 마지막으로 바뀐 시점을 알려 준다. 접근 날짜와 검색 날짜는 이 자료를 여는 날짜다.

이 페이지의 내용

12장 중 2장: 표준이 정한 방식으로 스팬 이름 짓기

  1. Development 버전의 표준
  2. Span types for each step
  3. 스팬 종류는 프로세스를 따른다
  4. 스팬이 반드시 가져야 하는 속성
  5. 스팬을 만든 주체
  6. 레지스트리를 기준으로 검증하기
  7. 프로덕션에서 스팬 이름 짓기
  8. 이 장에서 결정한 것

맨 위로 돌아가기전체 장