1.3 KiB
1.3 KiB
Metric Label Analyzer (Static Analysis)
Module
Telemetry
Status
IMPLEMENTED
Description
Roslyn-based analyzer that validates metric label usage at compile time to prevent telemetry cardinality issues.
Implementation Details
- MetricLabelAnalyzer:
src/Telemetry/StellaOps.Telemetry.Analyzers/MetricLabelAnalyzer.cs-- Roslyn-based DiagnosticAnalyzer that validates metric label usage at compile time; detects high-cardinality labels, missing required labels, and naming convention violations - MetricLabelGuard:
src/Telemetry/StellaOps.Telemetry.Core/StellaOps.Telemetry.Core/MetricLabelGuard.cs-- runtime guard that validates metric labels before emission - Tests:
src/Telemetry/StellaOps.Telemetry.Analyzers/StellaOps.Telemetry.Analyzers.Tests/MetricLabelAnalyzerTests.cs,src/Telemetry/StellaOps.Telemetry.Core/StellaOps.Telemetry.Core.Tests/MetricLabelGuardTests.cs - Source: Feature matrix scan
E2E Test Plan
- Verify Roslyn analyzer detects high-cardinality metric labels at compile time
- Test analyzer flags missing required labels (tenant, service, environment)
- Verify naming convention violations produce diagnostic warnings
- Test runtime MetricLabelGuard rejects labels exceeding cardinality thresholds
- Verify analyzer integrates with CI build pipeline for automated enforcement