otel-instrumentation
БесплатноБез исполняемых скриптовНе проверенUse when a task instruments or upgrades a service or worker with OpenTelemetry, or adds an endpoint, job or consumer to one that already reports - the…
от makifbaysal★ 123 звезды на GitHubОб этом скилле
OpenTelemetry instrumentation
Plain OpenTelemetry, no SDK of ours. The console reads the component only when its data follows the convention below (version 1).
Order of work
- Detect. Read the manifests, the entry point and what already reports. Extend an SDK that is there; never start a second one.
- Package and configuration. Follow this stack's section. Use current package versions from the registry and the repository's lockfile; do not copy a version from memory.
- Environment. The endpoint and token come from environment variables, declared with
declare_env_vars(the token as a secret). The component must start and work with them unset. A collector, an account or a data source to connect is a person'sbefore_deploystep. - Verify locally with the receiver below, and paste its output into the closing comment.
- Pull request. Hand off as usual. It is never merged by an agent.
- After the deploy, when the card comes back with missing names, run
check_otel_conformance: fix what ismissingorinvalid.unknownmeans no connected source can answer it; say so, do not change code to chase it.
Resource attributes (every component)
| Attribute | Value |
|---|---|
service.name |
the component's name, the same in every release |
service.version |
the deployed commit's SHA, 7-40 lowercase hex digits, not the package version |
deployment.environment.name |
production, staging, preview or development |
tasktrooper.component |
the component's path in the repository, . for the root |
tasktrooper.convention.version |
1 |
Add vcs.ref.head.revision (the full SHA) when the build knows it. Never put a secret, email, token, form value or query string in any attribute, and name every route by its template. A server reads them from the standard variables, set where the deploy sets environment variables:
OTEL_SERVICE_NAME=<component>
OTEL_RESOURCE_ATTRIBUTES=service.version=<sha>,deployment.environment.name=<env>,tasktrooper.component=<path>,tasktrooper.convention.version=1
OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf, OTEL_EXPORTER_OTLP_HEADERS (secret)
service.version comes from what the deploy already exports (VERCEL_GIT_COMMIT_SHA, GITHUB_SHA as a build argument, git rev-parse HEAD in the build).
What a service sends
A backend: http.server.request.duration or server spans, with http.request.method, http.route and http.response.status_code. A worker: a span per job; per message, a consumer span. Current names only (semantic conventions 1.23 or newer).
Recipes
Next.js, on Vercel or not. Server: npm i @vercel/otel @opentelemetry/api @opentelemetry/api-logs@latest-2 @opentelemetry/sdk-logs@latest-2 @opentelemetry/instrumentation@latest-2 @opentelemetry/sdk-trace-base@latest-2. @vercel/otel accepts only the OpenTelemetry 2.x line, so take the latest-2 tag of every @opentelemetry/* package in this app, api excepted. In instrumentation.ts (in src/ when the app is there):
import { registerOTel } from "@vercel/otel";
import type { SpanProcessor } from "@opentelemetry/sdk-trace-base";
// Next.js names its own span attributes by the pre-1.23 conventions.
const currentNames: SpanProcessor = {
onStart() {},
onEnd({ attributes: a }) {
if (a["http.method"] !== undefined) a["http.request.method"] ??= a["http.method"];
if (a["http.status_code"] !== undefined) a["http.response.status_code"] ??= a["http.status_code"];
delete a["http.target"];
},
forceFlush: async () => {},
shutdown: async () => {},
};
export function register() {
const endpoint = process.env.OTEL_EXPORTER_OTLP_ENDPOINT;
const sha = process.env.VERCEL_GIT_COMMIT_SHA ?? process.env.GIT_SHA;
registerOTel({
serviceName: process.env.OTEL_SERVICE_NAME ?? "<component>",
attributes: {
...(sha ? { "service.version": sha } : {}),
"deployment.environment.name": process.env.DEPLOY_ENV ?? process.env.VERCEL_ENV ?? "development",
"tasktrooper.component": "<component path>",
"tasktrooper.convention.version": "1",
},
spanProcessors: [currentNames, "auto"],
instrumentationConfig: {
fetch: { ignoreUrls: endpoint ? [endpoint] : [] },
},
});
}
On Vercel VERCEL_GIT_COMMIT_SHA and VERCEL_ENV are there by default ("Automatically expose system environment variables"); elsewhere the deploy sets GIT_SHA and DEPLOY_ENV. Set the OTEL_EXPORTER_OTLP_* variables per environment in the project's settings. Pass: a server span with http.route (/orders/[id]), http.request.method and http.response.status_code; without the name mapping Next.js sends only the old http.method and http.status_code.
Node.js (Express, Fastify, NestJS and others): @opentelemetry/api and @opentelemetry/auto-instrumentations-node, loaded before the app: node --require @opentelemetry/auto-instrumentations-node/register app.js (or the same in `
Установить otel-instrumentation в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл otel-instrumentation?
Use when a task instruments or upgrades a service or worker with OpenTelemetry, or adds an endpoint, job or consumer to one that already reports - the TaskTrooper convention, recipes for Next.js on Vercel, Node.js, Go, Python, .NET, Java and Rust, and how to verify the data before and after the deploy
Как установить скилл otel-instrumentation?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл otel-instrumentation запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic