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

instrumentation

Add OpenTelemetry tracing to a new flow or hot path, frontend or backend. Use when building a user-facing flow, a cross-service call, a queue or background job, or code on a latency-sensitive path; when adding spans, span attributes, or trace propagation; or when a trace in Tempo/Datadog is missing, disconnected, or opaque.

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

연동 도구Datadog
설치 방법 보기

포함된 파일(1)

  • SKILL.md4.4 KB

SKILL.md(원문)

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

Instrumentation

New flows and hot paths ship instrumented, in the same change. The standard is the observability rule: one connected trace from the user's action through every service, with phases timed and the entity id on the spans. This skill is how to meet it.

Pick the shape first

Before writing code, sketch the trace you want to read during an incident:

doc.open                      (browser, root, document.id)
├─ doc.load
│  └─ doc.load.context        (HTTP → DSS, traceparent header)
├─ doc.seed / doc.sync.catchup
└─ sync-service connect       (WebSocket, traceparent query param)

One root span per user action, one child per phase a reader would ask about (network, queue wait, processing, each external call), and the id you'd search by on the root.

Frontend and Cloudflare Workers

Use the @macro-inc/observability facade (packages/observability); never import OpenTelemetry directly.

  • Telemetry.span(name, fn) for a phase; span.span(name, fn) for a child. Telemetry.clientSpan(name) for an outbound call, then span.injectTraceHeaders(headers).
  • span.setAttr(key, value) for ids and counts; span.error(message) on failure; manual spans must end() on every path.
  • A flow that spans components or outlives one call keeps its root span in a registry keyed by entity id and resumes it later (see the document example).
  • Transports without headers carry span.traceparent() another way, such as a WebSocket query parameter.
  • Workers wrap their handler with instrument() and createWorkerTraceConfig from @macro-inc/observability/worker, which adopts the incoming traceparent.

Rust services

  • HTTP handlers already get spans from macro_tower_layers; outbound HTTP calls macro_tower_layers::inject_trace_headers.
  • #[tracing::instrument(skip_all, fields(document_id = %id), err)] on domain operations and outbound adapters (CS-22: err only on Result, no level = "info").
  • Kafka: kafka_util injects trace headers on publish; consumers open kafka_util::consumer_span and call record_span_error on failure.
  • Agent/ACP messages: genai_telemetry::propagation::inject / set_parent carry context in _meta; GenAI spans follow CS-55.
  • Spawned tasks take the span with them (.instrument(span)) or link to it.

Worked examples

Document open lifecycle (web → DSS → sync-service). apps/web/src/features/block-md/definition.ts starts or resumes doc.open (document.id, doc.type) and times doc.load → doc.load.context. apps/web/src/features/block-md/observability.ts keeps open document spans by id so the launcher's doc.create, the collab provider, and the sync client all attach to one trace. packages/collaboration/src/collab/telemetry.ts stamps document.id and session.id on doc.seed, doc.sync.catchup, and edit.apply. The sync WebSocket carries traceparent as a query parameter, which sync-service reads with worker_rs_otel::traceparent_from_request.

Agent editing (web or Rust → ai-editing-worker → sync-service). The web client (apps/web/src/lib/service-clients/ai-editing-worker/client.ts) opens http POST /edit under the document's span; Rust callers (crates/documents/src/outbound/editing_worker_client.rs) inject headers from an instrumented method. The worker (services/ai-editing-worker/src/endpoints/edit.ts) roots an edit.session with outcome fields (edit.mode, edit.ops_total, edit.blocked, edit.aborted), then a child per phase: edit.sync_init, edit.hydrate, edit.interpret, edit.supervise.turn, edit.dispatch, edit.run_code, edit.flush. On the agent side, crates/agent_session/src/domain/session/telemetry.rs emits invoke_agent and execute_tool and propagates into the ACP agent.

Verify

Run the flow on the local stack and find its trace (see the live-debug skill): one trace from browser to the last service, each phase visible with its duration, findable by the entity id, and failures marked as errors. Report the trace as verified or say it wasn't.

리뷰

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

댓글

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

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

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

0 / 1,000자

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

같은 저장소의 스킬

Wrap a new backend endpoint in the TypeScript SDK (packages/sdk), or record it as skipped. Use when `just coverage` fails, or after adding an endpoint to a Rust service.

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

macro-inc/macro4.8천2026년 10월 19일 업데이트

add-tour

무료

Add or change an in-app feature tour (a view's guided flyover) in the web app. Use when adding a tour to a view, adding or editing tour steps, pointing a step at a new control, or when a step's target needs something opened first.

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

macro-inc/macro4.8천2026년 10월 19일 업데이트

audit

무료

Post-change checks before handing off. Works out which checks apply from the files changed (directory AGENTS.md Checks sections and matching .agents/rules), runs or verifies each, and reports pass/fail/skipped. Use before saying work is done, before pushing, or when asked to audit or verify a change.

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

macro-inc/macro4.8천2026년 10월 19일 업데이트

Enforce hexagonal architecture in the Rust backend. Use before modifying crates/ or Rust services, especially inbound axum/tool/listener adapters, domain services/ports, outbound adapters, authorization, permissions, database access, or external clients.

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

macro-inc/macro4.8천2026년 10월 19일 업데이트

Use when adding collaborative markdown, notes, or descriptions to a feature with collab surfaces. Covers parent entities, service entry points, authorization, content storage, and lifecycle.

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

macro-inc/macro4.8천2026년 10월 19일 업데이트

Build a new AI tool end-to-end — Rust implementation, toolset wiring, infra, schema generation, and frontend UI.

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

macro-inc/macro4.8천2026년 10월 19일 업데이트

macro-inc의 스킬 모두 보기

이 스킬의 문제 신고