Common Observability
ASecurityThe 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
Works with
Security analysis
100/100Pro scans all 12 files and shows the line behind each finding
npx -y skills add HoangNguyen0403/agent-skills-standard --skill common-observability --agent claude-codeAre you the author of Common Observability?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/hoangnguyen0403-common-observability-625e81d7)# 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.md
- eval-1.with-skill.md
- eval-2.baseline.md
- eval-2.with-skill.md
- eval-3.baseline.md
- eval-3.with-skill.md
- trigger-1.md
- trigger-2.md
- trigger-3.md
- trigger-4.md
- trigger-5.md
Attribution
Related skills
View all in development →Comments
Loading comments…
Newsletter
Get the weekly list of safe new skills, and the ones we pulled.