Skip to content
Back to skills

Otel Instrumentation

ASecurity

Use when a task instruments or upgrades a game with OpenTelemetry, or adds a level, save or server call to one that already reports - the TaskTrooper convention, recipes for Unity, Godot, Unreal, web engines and Bevy, and how to verify the data before and after the deploy

  • 123 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added December 1, 2026
ai-agentsrustgoc#nodegit

Works with

  • cli

Security analysis

A100/100

Scanned December 1, 2026

npx -y skills add makifbaysal/tasktrooper --skill otel-instrumentation --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Otel Instrumentation?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Otel Instrumentation
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/makifbaysal-otel-instrumentation-d2e1fd3d/badge)](https://www.skillsdirectory.com/skills/makifbaysal-otel-instrumentation-d2e1fd3d)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: otel-instrumentation
category: observability
description: Use when a task instruments or upgrades a game with OpenTelemetry, or adds a level, save or server call to one that already reports - the TaskTrooper convention, recipes for Unity, Godot, Unreal, web engines and Bevy, and how to verify the data before and after the deploy
source: open-telemetry/opentelemetry.io docs (CC BY 4.0), adapted
---

# 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

1. **Detect.** Read the manifests, the entry point and what already reports. Extend an SDK that is there; never start a second one.
2. **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.
3. **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's `before_deploy` step.
4. **Verify locally** with the receiver below, and paste its output into the closing comment.
5. **Pull request.** Hand off as usual. It is never merged by an agent.
6. **After the deploy**, when the card comes back with missing names, run `check_otel_conformance`: fix what is `missing` or `invalid`. `unknown` means 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 client sets them in code, from build values; a server part 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).

## Recipes

An engine's crash reporter is separate from OpenTelemetry; keep the one the game has. Every game carries the five resource attributes, `os.name` and `os.version`. Send a span for work a player waits on (boot, level load, save, matchmaking, a server call). Never one per frame, and never on the render thread: batch and export off it, drop when offline. A shipped token can be read by anyone: send to an endpoint that accepts telemetry only and is rate limited.

**Unity**: `OpenTelemetry` and `OpenTelemetry.Exporter.OpenTelemetryProtocol` (netstandard2.1, through NuGetForUnity, HTTP/protobuf). IL2CPP strips what reflection reaches: keep both assemblies in `link.xml` and verify in a player build, not the editor. WebGL has no background threads: use the browser recipe below from a `.jslib` plugin. Crashes: Unity Cloud Diagnostics or `io.sentry.unity`, whichever the project has.

**Godot (C#)**: the same .NET packages. **Godot (GDScript)**: no official SDK; post OTLP/JSON with one `HTTPRequest` node, an autoload holding the resource once and a bounded queue. Crashes: the Sentry Godot extension.

**Unreal**: `opentelemetry-cpp` as a third-party module with the HTTP exporter, behind `WITH_OTEL` so a platform it does not build for still compiles. Crashes: Crash Reporter or Sentry's plugin.

**Web games (Phaser, PixiJS, three.js, Babylon.js, PlayCanvas)**: `@opentelemetry/sdk-trace-web`, `resources` and `exporter-trace-otlp-http`, started before the engine, exporting to the game's own origin; exceptions from `error` and `unhandledrejection` as `exception` events.

**Bevy / Rust**: `opentelemetry`, `opentelemetry_sdk`, `opentelemetry-otlp`, `tracing-opentelemetry` on Bevy's `tracing` spans, filtered to the game's own targets.

**The game's server**: the recipe of its language (`OTEL_*` variables, HTTP and RPC instrumentation, current semantic convention names).

## Local verification

A receiver that prints which names arrive; it needs only Node and reads JSON and protobuf. Keep it in the task's scratch directory, never in the repository, and stop it by its port.

```js
// otlp.mjs: node otlp.mjs
import http from "node:http"; import zlib from "node:zlib";
const want = [/service\.name/, /service\.version/, /deployment\.environment\.name/, /tasktrooper\.component/, /tasktrooper\.convention\.version/, /os\.name/, /os\.version/, /exception\.type/];
http.createServer((q, r) => { const c = []; q.on("data", (d) => c.push(d)); q.on("end", () => {
  let b = Buffer.concat(c); if (q.headers["content-encoding"] === "gzip") b = zlib.gunzipSync(b);
  console.log(q.url, want.map((w) => b.toString("latin1").match(w)?.[0] ?? `MISSING ${w.source}`).join(" | ")); r.end();
}); }).listen(4318, "127.0.0.1");
```

Start the component with `OTEL_EXPORTER_OTLP_ENDPOINT=http://127.0.0.1:4318`, start a player build, load a level and quit. Passes when:

- The five resource attributes are on every request, and at least one span arrives on `/v1/traces`.
- The frame time with it on is within noise of the frame time with it off; give both numbers.
- With the endpoint unset the component still starts and works, and nothing but a log line changes.

A missing name on a request of another kind is normal (a metrics post carries no span attribute). "It compiles" and "the SDK is installed" prove nothing.

## Upgrading from an older version

A card that says upgrade carries both versions. Read what the new version asks (the card's missing and wrong names, and `check_otel_conformance`), change only those names, keep the old name beside the new one for one release when a dashboard reads it, and raise `tasktrooper.convention.version` in the same pull request, last: the data is judged by the version it declares.

## New code in an instrumented component

A new load, save or server call gets a span when a player waits on it.

## Traps

- Console platforms may not allow outbound telemetry: ask with a question before adding it there.
- A player's name, platform id and free text never go in an attribute.
- An export on quit must not delay the quit by more than half a second.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.