From 68cee3fae8629f9961089646495db34e7c889a9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juraci=20Paix=C3=A3o=20Kr=C3=B6hling?= Date: Fri, 3 Apr 2026 17:53:02 +0200 Subject: [PATCH] feat: add RES-006 and RES-007 resource attribute rules Add two new instrumentation scoring rules based on OTel community resource attribute standards (community#2837): - RES-006: Validates service.criticality enum values (Normal impact) - RES-007: Checks deployment.environment.name presence (Important impact) Relates to OTEL-99. Co-Authored-By: Claude Opus 4.6 (1M context) --- rules/RES-006.md | 16 ++++++++++++++++ rules/RES-007.md | 16 ++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 rules/RES-006.md create mode 100644 rules/RES-007.md diff --git a/rules/RES-006.md b/rules/RES-006.md new file mode 100644 index 0000000..300faba --- /dev/null +++ b/rules/RES-006.md @@ -0,0 +1,16 @@ +**Rule ID:** RES-006 + +**Description:** `service.criticality` uses a valid enum value + +**Rationale:** The `service.criticality` resource attribute indicates the operational importance level of a service. Using standardized enum values enables automated prioritization of alerts, incidents, and resource allocation decisions across heterogeneous environments. Without consistent values, tooling cannot reliably compare or act on criticality levels. Defined in the [OTel Service and Deployment Semantic Conventions](https://github.com/open-telemetry/community/blob/main/projects/service-and-deployment-semconv.md) (Phase 1). + +**Target:** Resource + +**Criteria:** If the `service.criticality` resource attribute is present, its value MUST be one of the following enum values: `mission_critical`, `high`, `medium`, `low`. The attribute MUST NOT contain any other value. + +**Examples:** + +- "Resource attribute `service.criticality` is set to `critical` instead of a valid enum value (`mission_critical`, `high`, `medium`, `low`)." +- "Resource attribute `service.criticality` is set to `HIGH` (uppercase) instead of the expected lowercase `high`." + +**Impact:** Normal diff --git a/rules/RES-007.md b/rules/RES-007.md new file mode 100644 index 0000000..b2d8d2b --- /dev/null +++ b/rules/RES-007.md @@ -0,0 +1,16 @@ +**Rule ID:** RES-007 + +**Description:** `deployment.environment.name` is present + +**Rationale:** The `deployment.environment.name` resource attribute specifies the environment where the service is deployed (e.g., `production`, `staging`). This attribute is essential for environment-aware analysis, enabling teams to filter telemetry by environment, apply environment-specific alerting thresholds, and prevent confusion between production and non-production data. It is part of the [OpenTelemetry Resource Semantic Conventions](https://opentelemetry.io/docs/specs/semconv/resource/deployment-environment/) and is being stabilized as part of the [OTel Service and Deployment Semantic Conventions](https://github.com/open-telemetry/community/blob/main/projects/service-and-deployment-semconv.md) (Phase 2). + +**Target:** Resource + +**Criteria:** Resource attributes MUST contain a `deployment.environment.name` key with a non-empty string value. The attribute MUST NOT be null, undefined, or an empty string. + +**Examples:** + +- "Resource attribute `deployment.environment.name` is missing from the resource attributes." +- "Resource attribute `deployment.environment.name` is present but has an empty string value." + +**Impact:** Important