observability-instrument
Add OpenTelemetry spans with user_id and tenant_id in baggage to any new code path that handles requests, runs agents, or performs billable operations.
Skill by MILTONADINA
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/miltonadina-observability-instrument
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: backend, devops, agent-building
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/observability-instrument
What's inside
- Skill name
observability-instrument- Description
- Add OpenTelemetry spans with user_id and tenant_id in baggage to any new code path that handles requests, runs agents, or performs billable operations. Use whenever creating a new API endpoint, background job, agent invocation, or external API call. Inline PII redaction at the span exporter is mandatory before any production deploy.
- License
- MIT
- Instructions
- 155 lines in SKILL.md · view on GitHub
Files (3)
- SKILL.md
- SKILL.md.bundle
- SKILL.md.sig
SKILL.md (first lines)
# Observability Instrument
> OpenTelemetry, OpenInference semantic conventions, baggage for per-tenant
> attribution, PII redaction inline. Production-grade from day one.
**Tradeoff:** Every new code path needs instrumentation. Worth it: full tracing
catches more agent quality regressions before users see them.
---
## Why baggage matters
Baggage propagates `user_id` and `tenant_id` through the trace context. Every
span automatically inherits them through the call tree. Teams that try to
propagate identity through ad-hoc argument passing always lose it at the first
tool boundary.
Decision: add baggage in week one. Costs two days. Buys per-tenant cost
attribution forever.
---
## Setup (TypeScript / Node)
```typescript
// otel-setup.ts
import { NodeSDK } from '@opentelemetry/sdk-node';
import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http';
import { getNodeAutoInstrumentations } from '@opentelemetry/auto-instrumentations-node';
import { propagation, ROOT_CONTEXT } from '@opentelemetry/api';
import { W3CBaggagePropagator, W3CTraceContextPropagator, CompositePropagator } from '@opentelemetry/core';
import { resourceFromAttributes } from '@opentelemetry/resources';
import { SemanticResourceAttributes } from '@opentelemetry/semantic-conventions';
import { piiRedactingExporter } from './pii-redaction.js';
propagation.setGlobalPropagator(new CompositePropagator({
propagators: [new W3CTraceContextPropagator(), new W3CBaggagePropagator()],
}));
const sdk = new NodeSDK({
resource: resourceFromAttributes({
[SemanticResourceAttributes.SERVICE_NAME]: 'auth-service',
[SemanticResourceAttributes.SERVICE_VERSION]: process.env.GIT_SHA,
[SemanticResourceAttributes.DEPLOYMENT_ENVIRONMENT]: process.env.ENV,
}),
traceExporter: piiRedactingExporter(new OTLPTraceExporter({
url: process.env.OTEL_EXPORTER_OTLP_ENDPOINT,
})),
instrumentations: [getNodeAutoInstrumentations()],
});
sdk.start();
```
---
## Adding baggage
At the request entry point:
```typescript
import { context, propagation } from '@opentelemetry/api';
app.use(async (req, res, next) => {
const baggage = propagation.createBaggage({
'user.id': { value: req.user?.id ?? 'anonymous' },
'tenant.id': { value: req.tenant?.id ?? 'unknown' },
'session.id': { value: req.session?.id ?? 'none' },
});
const ctx = propagation.setBaggage(context.active(), baggage);
context.with(ctx, () => next());
});
```
From this point on, every child span (HTTP call, DB query, agent invocation,
external API) inherits user.id and tenant.id automatically.
---
## OpenInference for LLM calls
Use the OpenInference semantic conventions so you can swap observability
backends (Langfuse, Laminar, Arize Phoenix) without re-instrumenting:
```typescript
import { OpenAI } from 'openai';
import { OpenAIInstrumentation } from '@arizeai/openinference-instrumentation-openai';
// or @arizeai/openinference-instrumentation-anthropic for Anthropic
registerInstrumentations({ instrumentations: [new OpenAIInstrumentation()] });
```
This adds spans like:
- `llm.provider`: anthropic
- `llm.model`: claude-sonnet-4-6
- `llm.input_messages.0.role`: user
- `llm.input_messages.0.content`: (redacted)
- `llm.token_count.prompt`: 1234
- `llm.token_count.completion`: 567
- `llm.cost_usd`: 0.0122
---
## PII redaction (mandatory)
PII never reaches the observability backend. Implement an inline-redacting
exporter at `observability/pii-redaction.ts`:
```typescript
export function piiRedactingExporter(baseExporter) {
return {
export(spans, cb) {
const redacted = spans.map(span => ({
...span,
attributes: redactObject(span.attributes),
events: span.events?.map(e => ({ ...e, attributes: redactObject(e.attributes) })),
}));
return baseExporter.export(redacted, cb);
},
shutdown() { return baseExporter.shutdown(); },From MILTONADINA/DevOPs, MIT.
More from MILTONADINA/DevOPs
- 0.565score
ears-spec-writing
MILTONADINA
Write requirement specifications in EARS (Easy Approach to Requirements Syntax) notation.
SkillAFreshness: AClaude Code +9 - 0.565score
proof-of-work
MILTONADINA
Produce structured proof artifacts for every completed claim.
SkillAFreshness: AClaude Code +9 - 0.565score
plan-decomposition
MILTONADINA
Break an approved spec into atomic, ordered, verifiable tasks before any code is written.
SkillAFreshness: AClaude Code +9 - 0.565score
multi-tool-failover
MILTONADINA
Manage session continuity when switching between Claude Code, Codex CLI, Cursor, Antigravity, Kiro, or local LLMs (OpenCode, Aider).
SkillAFreshness: AClaude Code +9 - 0.565score
goal-loop
MILTONADINA
Execute the spec-tests-implement-verify cycle for one atomic task at a time.
SkillAFreshness: AClaude Code +9 - 0.565score
baton-handoff
MILTONADINA
Write a complete handoff document at session end so the next agent (Claude Code, Codex, Cursor, Antigravity, Kiro, or local LLM) resumes exactly where this…
SkillAFreshness: AClaude Code +9 - 0.565score
cost-attribution
MILTONADINA
Track per-client and per-feature LLM and cloud spend with cryptographic audit trail.
SkillAFreshness: AClaude Code +9 - 0.565score
openapi-first
MILTONADINA
Generate API code, types, validators, mock servers, and client SDKs from a single OpenAPI 3.1 specification.
SkillAFreshness: AClaude Code +9 - 0.561score
session-summary
MILTONADINA
Generate the end-of-session human-reviewable report.
SkillAFreshness: AClaude Code +9 - 0.561score
coppa-audit
MILTONADINA
Audit code, data flows, and UI for COPPA (Children's Online Privacy Protection Act) compliance.
SkillAFreshness: AClaude Code +9 - 0.560score
supabase-rpc-functions
MILTONADINA
Supabase RPC function security patterns -- SECURITY DEFINER with `SET search_path` discipline, `REVOKE EXECUTE FROM public` for least-privilege exposure…
SkillAFreshness: AClaude Code +9 - 0.560score
rust-error-handling
MILTONADINA
Rust error-handling patterns and anti-patterns -- `unwrap()` in request hot paths, `panic!` instead of returning a `Result`, leaking error internals via…
SkillAFreshness: AClaude Code +9
Signals
- Stars
- 0
- Forks
- 0
- Open issues
- 12
- Last commit (this folder)
- Oct 12, 2026 (17 days ago)
- Last release
- Sep 23, 2026 (1 month ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/MILTONADINA/DevOPs
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from MILTONADINA
- 0.565score
goal-loop
MILTONADINA
Execute the spec-tests-implement-verify cycle for one atomic task at a time.
SkillAFreshness: AClaude Code +9 - 0.565score
baton-handoff
MILTONADINA
Write a complete handoff document at session end so the next agent (Claude Code, Codex, Cursor, Antigravity, Kiro, or local LLM) resumes exactly where this…
SkillAFreshness: AClaude Code +9 - 0.565score
openapi-first
MILTONADINA
Generate API code, types, validators, mock servers, and client SDKs from a single OpenAPI 3.1 specification.
SkillAFreshness: AClaude Code +9 - 0.565score
ears-spec-writing
MILTONADINA
Write requirement specifications in EARS (Easy Approach to Requirements Syntax) notation.
SkillAFreshness: AClaude Code +9 - 0.565score
cost-attribution
MILTONADINA
Track per-client and per-feature LLM and cloud spend with cryptographic audit trail.
SkillAFreshness: AClaude Code +9 - 0.565score
multi-tool-failover
MILTONADINA
Manage session continuity when switching between Claude Code, Codex CLI, Cursor, Antigravity, Kiro, or local LLMs (OpenCode, Aider).
SkillAFreshness: AClaude Code +9
Cite this page
observability-instrument skill. Agent Mart. https://agentmart.dev/skills/miltonadina-observability-instrument (last updated 2026-10-24)