Skip to content
← All rules
ObservabilityTelemetry context

observability/require-operation-context

Log and telemetry events should use a specific message or structured field to name the operation; IDs and status alone are insufficient.

loggingoperationsstructured-data
TypeScript
logger.info({ orderId, status });
Finding

Require a stable operation identity in events.

Setup

Install the package, register its plugin factory, then enable the rule.

Install the package

pnpm add -D @scruple/observability

Register the plugin

In scruple.config.ts, register the factory under the observability namespace used by the rule ID.

import { observability } from "@scruple/observability";

plugins: {
  "observability": observability(),
},

Enable the rule

"observability/require-operation-context": "warn"
Package
@scruple/observability
Default threshold
0.8
Minimum confidence
0.7

Released under the MIT License.