Skip to content
Back to skills

Common Observability

ASecurity

The following TypeScript-style sketch shows the essential request flow. Adapt the logger and OpenTelemetry SDK setup to the service framework. ```ts import { context, propagation, trace, SpanStatusCode } from '@opentelemetry/api'; import pino from 'pino'; const logger = pino(); const tracer = trace.getTracer('user-service'); async function handleRequest(req: Request, res: Response) { const route = 'GET /users/:id'; const requestId = req.headers.get('x-request-id') ?? crypto.randomUUID(); cons...

  • 584 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 5, 2026
developmenttypescriptapiperformance

Works with

  • api

Security analysis

A100/100

Pro scans all 12 files and shows the line behind each finding

Scanned September 5, 2026

npx -y skills add HoangNguyen0403/agent-skills-standard --skill common-observability --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Common Observability?

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

Security grade badge for Common Observability
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/hoangnguyen0403-common-observability-625e81d7/badge)](https://www.skillsdirectory.com/skills/hoangnguyen0403-common-observability-625e81d7)

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
# Quick-start example

The following TypeScript-style sketch shows the essential request flow. Adapt the logger and OpenTelemetry SDK setup to the service framework.

```ts
import { context, propagation, trace, SpanStatusCode } from '@opentelemetry/api';
import pino from 'pino';

const logger = pino();
const tracer = trace.getTracer('user-service');

async function handleRequest(req: Request, res: Response) {
  const route = 'GET /users/:id';
  const requestId = req.headers.get('x-request-id') ?? crypto.randomUUID();
  const carrier = Object.fromEntries(req.headers.entries());
  const parent = propagation.extract(context.active(), carrier);

  return context.with(parent, async () => {
    const span = tracer.startSpan(route, { attributes: { 'http.request.method': 'GET' } });
    const started = performance.now();

    try {
      // Execute the handler and instrument downstream calls with child spans.
      const user = await loadUser(req.params.id);
      const durationMs = performance.now() - started;
      span.setAttribute('http.response.status_code', 200);
      logger.info({ requestId, route, statusCode: 200, durationMs }, 'request completed');
      res.status(200).json(user);
    } catch (error) {
      span.recordException(error as Error);
      span.setStatus({ code: SpanStatusCode.ERROR });
      logger.error({ requestId, route, statusCode: 500, errorType: (error as Error).name }, 'request failed');
      res.status(500).json({ error: 'internal_error' });
    } finally {
      span.end();
    }
  });
}
```

In the complete service, configure OpenTelemetry exporters and automatic instrumentation, inject the current context into outbound requests, and expose RED metrics: request count/rate, error count/rate, a latency histogram (p50/p95/p99), and saturation such as worker or connection-pool utilization. Use route templates and bounded metric labels. Add an `X-Request-Id` response header, redact secrets before logging, and create SLO burn-rate alerts rather than raw spike alerts. Test a successful request, a downstream failure, and a timeout to prove correlation, exception recording, metric updates, and span cleanup.

Files in this skill

  • eval-1.baseline.md2.8 KB
  • eval-1.with-skill.md2.3 KB
  • eval-2.baseline.md2.7 KB
  • eval-2.with-skill.md1.8 KB
  • eval-3.baseline.md2.1 KB
  • eval-3.with-skill.md2.1 KB
  • trigger-1.md124 B
  • trigger-2.md143 B
  • trigger-3.md163 B
  • trigger-4.md125 B
  • trigger-5.md156 B

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 development →

Comments

Loading comments…

Newsletter

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