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

otel-instrumentation

Use when an "enable observability" card asks for metrics, traces or logs - what the developer task must add per language (Go, Node/TS, Python, Java/Kotlin, .NET, Ruby, PHP), the zero-code agents, the OTEL_* environment variables and resource attributes, and how to reach GCP, AWS, Vercel or a plain OTLP endpoint

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

설치 방법 보기

포함된 파일(1)

  • SKILL.md7.5 KB

SKILL.md(원문)

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

OpenTelemetry instrumentation

You never write this code yourself. This skill is what you put into the developer's task: exact packages, where the SDK starts, the environment it reads, and acceptance criteria that can be observed in the target environment.

Always the same

Every service gets the same identity, set through the environment rather than in code:

VariableValue
OTEL_SERVICE_NAMEthe component's name, stable across deploys (checkout-api)
OTEL_RESOURCE_ATTRIBUTES`service.version=<release tag or commit>,deployment.environment.name=<production
OTEL_EXPORTER_OTLP_ENDPOINTthe collector or backend base URL (http://otel-collector:4318)
OTEL_EXPORTER_OTLP_PROTOCOLhttp/protobuf (default for most SDKs) or grpc (port 4317)
OTEL_EXPORTER_OTLP_HEADERSauth for a hosted endpoint (authorization=Bearer …) — a secret, declared with declare_env_vars, never committed
OTEL_TRACES_SAMPLER / _ARGparentbased_traceidratio / 0.1 for a busy production service; parentbased_always_on otherwise
OTEL_METRICS_EXPORTER, OTEL_LOGS_EXPORTERotlp (or none when the platform already ships stdout logs)

service.version is what lets a deploy-impact read tell the release apart; leaving it out makes every release look the same.

Per language

  • Go — no general zero-code agent (the eBPF opentelemetry-go-instrumentation is not production-grade for most stacks). Add go.opentelemetry.io/otel, go.opentelemetry.io/otel/sdk, .../exporters/otlp/otlptrace/otlptracehttp and .../otlpmetric/otlpmetrichttp; build the tracer and meter providers in main from resource.Default() merged with the env, register them globally, and Shutdown them on exit. Wrap the router with go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp (or otelgin, otelecho, otelgrpc), outbound clients with otelhttp.NewTransport, the database with github.com/XSAM/otelsql. Logs: the go.opentelemetry.io/contrib/bridges/otelslog handler, or keep slog JSON on stdout with trace_id/span_id fields.
  • Node.js / TypeScript — zero-code: @opentelemetry/api + @opentelemetry/auto-instrumentations-node, started with NODE_OPTIONS="--require @opentelemetry/auto-instrumentations-node/register". With code: @opentelemetry/sdk-node and getNodeAutoInstrumentations() in an instrumentation.ts loaded before anything else (--import ./instrumentation.mjs for ESM). Next.js: @vercel/otel with registerOTel({ serviceName }) in instrumentation.ts.
  • Python — zero-code: opentelemetry-distro and opentelemetry-exporter-otlp, then opentelemetry-bootstrap -a install in the image build, and run under opentelemetry-instrument (opentelemetry-instrument gunicorn app:app; with gunicorn's --preload or forking servers, initialise in post_fork). Logs: OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED=true.
  • Java / Kotlin — zero-code: the opentelemetry-javaagent.jar from the opentelemetry-java-instrumentation releases, attached with JAVA_TOOL_OPTIONS=-javaagent:/otel/opentelemetry-javaagent.jar. Spring Boot without an agent (native images): io.opentelemetry.instrumentation:opentelemetry-spring-boot-starter. Micrometer metrics: micrometer-registry-otlp.
  • .NET — zero-code: OpenTelemetry .NET Automatic Instrumentation (its install script sets the CORECLR_* profiler variables). With code: OpenTelemetry.Extensions.Hosting, OpenTelemetry.Instrumentation.AspNetCore, OpenTelemetry.Instrumentation.Http, OpenTelemetry.Exporter.OpenTelemetryProtocol, then builder.Services.AddOpenTelemetry().WithTracing(t => t.AddAspNetCoreInstrumentation().AddHttpClientInstrumentation()).WithMetrics(m => m.AddAspNetCoreInstrumentation()).UseOtlpExporter(); and builder.Logging.AddOpenTelemetry().
  • Ruby — opentelemetry-sdk, opentelemetry-exporter-otlp, opentelemetry-instrumentation-all; in an initializer OpenTelemetry::SDK.configure { |c| c.use_all }.
  • PHP — the opentelemetry PECL extension plus open-telemetry/sdk and open-telemetry/exporter-otlp, with OTEL_PHP_AUTOLOAD_ENABLED=true; framework packages such as open-telemetry/opentelemetry-auto-laravel or -auto-symfony do the instrumentation.

Prefer the zero-code route wherever it exists: it is one image or start-command change the developer can verify, instead of edits through the codebase.

Where it goes

  • Google Cloud (own_cloud, gcp). Traces go by OTLP to the Cloud Telemetry API, https://telemetry.googleapis.com (enable telemetry.googleapis.com on the project); it needs Google credentials, so the service exports to an OpenTelemetry Collector (a Cloud Run sidecar, or a GKE deployment) whose otlphttp exporter uses the googleclientauth extension. Metrics go through that collector's googlemanagedprometheus exporter (Managed Service for Prometheus), read back by a gcp_monitoring data source. Logs: JSON on stdout — Cloud Run and GKE ship it to Cloud Logging; put the trace id in logging.googleapis.com/trace. The runtime service account needs roles/cloudtrace.agent (or the Telemetry API's traces writer role), roles/monitoring.metricWriter and roles/logging.logWriter — granting them is a before_deploy step for a person.
  • AWS (own_cloud, aws). Run the AWS Distro for OpenTelemetry (ADOT) collector: an ECS sidecar, the EKS add-on, or the ADOT Lambda layer (AWS_LAMBDA_EXEC_WRAPPER=/opt/otel-instrument). Its awsxray exporter sends traces to X-Ray, awsemf sends metrics to CloudWatch (read back by an aws_cloudwatch data source), awscloudwatchlogs sends logs. The task role needs AWSXRayDaemonWriteAccess and CloudWatchAgentServerPolicy.
  • Vercel. @vercel/otel, exporting to the OTLP endpoint of the team's backend (OTEL_EXPORTER_OTLP_ENDPOINT in the project's environment variables) or through a Vercel observability integration.
  • otlp_endpoint. Set OTEL_EXPORTER_OTLP_ENDPOINT to it; its credentials go in OTEL_EXPORTER_OTLP_HEADERS.
  • self_hosted. See self-hosted-stack; the service exports to that stack's collector.

Acceptance criteria that can be checked

  • "Given the service is deployed to production, when it serves a request, then a span with service.name=checkout-api and deployment.environment.name=production reaches <target> within a minute."
  • "Given the service runs, then http.server.request.duration is exported with http.route and http.response.status_code" (the route label is what makes per-endpoint golden signals possible).
  • "Given a request fails, then its log line carries the trace_id of that request's span."

Never "the SDK is installed" or "it compiles" — those pass without one span arriving.

After it ships

list_data_source_metrics shows whether the new metric names (http_server_request_duration_seconds_* in Prometheus naming) are there, and propose_signal_binding binds the golden signals to them. No data source reads the target yet: say so on the card — a person adds it under Operations → Data sources.

리뷰

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

댓글

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

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

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

0 / 1,000자

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

같은 저장소의 스킬

Use when writing acceptance criteria for a task - express each as an observable Given/When/Then that QA can execute, including negative cases

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

makifbaysal/tasktrooper1172026년 10월 20일 업데이트

Use when the diff adds or changes an endpoint, resolver, RPC, job or query that takes an object id, a role check, a request binding or a tenant filter - BOLA/IDOR, function-level authorization, mass assignment and tenant scoping

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

makifbaysal/tasktrooper1172026년 10월 20일 업데이트

Use on every UI change - semantic HTML, labels for controls, keyboard-navigable dialogs/menus, visible focus, and never color as the only signal

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

makifbaysal/tasktrooper1172026년 10월 20일 업데이트

Use when a task changes any screen, form, dialog, menu or control - Lighthouse/axe scan of the changed screens, a keyboard walk, and the thresholds that fail a task

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

makifbaysal/tasktrooper1172026년 10월 20일 업데이트

How to work a task returned with review, QA or UAT findings. Use when a task is in need_revision or PR review comments are in your context.

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

makifbaysal/tasktrooper1172026년 10월 20일 업데이트

Use when the repository keeps its alerting in code, or a person asks for alerts outside TaskTrooper - PrometheusRule YAML, a Cloud Monitoring alert policy in Terraform, a Datadog monitor, each routed to TaskTrooper's alert ingest URL so it opens an incident here

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

makifbaysal/tasktrooper1172026년 10월 20일 업데이트

makifbaysal의 스킬 모두 보기

이 스킬의 문제 신고