agentic-qe 1.8.3 → 1.8.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/skills/cicd-pipeline-qe-orchestrator/README.md +2 -2
- package/.claude/skills/cicd-pipeline-qe-orchestrator/SKILL.md +6 -6
- package/CHANGELOG.md +220 -0
- package/README.md +36 -3
- package/config/constitution.schema.json +423 -0
- package/config/otel-collector.yaml +234 -0
- package/dist/cli/commands/init-claude-md-template.js +3 -3
- package/dist/constitution/index.d.ts +105 -0
- package/dist/constitution/index.d.ts.map +1 -0
- package/dist/constitution/index.js +207 -0
- package/dist/constitution/index.js.map +1 -0
- package/dist/constitution/loader.d.ts +141 -0
- package/dist/constitution/loader.d.ts.map +1 -0
- package/dist/constitution/loader.js +515 -0
- package/dist/constitution/loader.js.map +1 -0
- package/dist/constitution/schema.d.ts +409 -0
- package/dist/constitution/schema.d.ts.map +1 -0
- package/dist/constitution/schema.js +71 -0
- package/dist/constitution/schema.js.map +1 -0
- package/dist/core/memory/MemoryManagerFactory.d.ts +77 -0
- package/dist/core/memory/MemoryManagerFactory.d.ts.map +1 -0
- package/dist/core/memory/MemoryManagerFactory.js +270 -0
- package/dist/core/memory/MemoryManagerFactory.js.map +1 -0
- package/dist/core/memory/SwarmMemoryManager.d.ts +18 -0
- package/dist/core/memory/SwarmMemoryManager.d.ts.map +1 -1
- package/dist/core/memory/SwarmMemoryManager.js +96 -11
- package/dist/core/memory/SwarmMemoryManager.js.map +1 -1
- package/dist/core/memory/index.d.ts +1 -0
- package/dist/core/memory/index.d.ts.map +1 -1
- package/dist/core/memory/index.js +12 -1
- package/dist/core/memory/index.js.map +1 -1
- package/dist/mcp/handlers/memory/memory-backup.js +6 -6
- package/dist/mcp/handlers/memory/memory-backup.js.map +1 -1
- package/dist/mcp/handlers/phase2/Phase2Tools.d.ts.map +1 -1
- package/dist/mcp/handlers/phase2/Phase2Tools.js +4 -2
- package/dist/mcp/handlers/phase2/Phase2Tools.js.map +1 -1
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +4 -38
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/services/AgentRegistry.d.ts.map +1 -1
- package/dist/mcp/services/AgentRegistry.js +4 -4
- package/dist/mcp/services/AgentRegistry.js.map +1 -1
- package/dist/persistence/event-store.d.ts +162 -0
- package/dist/persistence/event-store.d.ts.map +1 -0
- package/dist/persistence/event-store.js +315 -0
- package/dist/persistence/event-store.js.map +1 -0
- package/dist/persistence/index.d.ts +145 -0
- package/dist/persistence/index.d.ts.map +1 -0
- package/dist/persistence/index.js +227 -0
- package/dist/persistence/index.js.map +1 -0
- package/dist/persistence/metrics-aggregator.d.ts +187 -0
- package/dist/persistence/metrics-aggregator.d.ts.map +1 -0
- package/dist/persistence/metrics-aggregator.js +495 -0
- package/dist/persistence/metrics-aggregator.js.map +1 -0
- package/dist/persistence/reasoning-store.d.ts +178 -0
- package/dist/persistence/reasoning-store.d.ts.map +1 -0
- package/dist/persistence/reasoning-store.js +440 -0
- package/dist/persistence/reasoning-store.js.map +1 -0
- package/dist/persistence/schema.d.ts +181 -0
- package/dist/persistence/schema.d.ts.map +1 -0
- package/dist/persistence/schema.js +186 -0
- package/dist/persistence/schema.js.map +1 -0
- package/dist/telemetry/bootstrap.d.ts +67 -0
- package/dist/telemetry/bootstrap.d.ts.map +1 -0
- package/dist/telemetry/bootstrap.js +320 -0
- package/dist/telemetry/bootstrap.js.map +1 -0
- package/dist/telemetry/index.d.ts +16 -0
- package/dist/telemetry/index.d.ts.map +1 -0
- package/dist/telemetry/index.js +84 -0
- package/dist/telemetry/index.js.map +1 -0
- package/dist/telemetry/metrics/agent-metrics.d.ts +109 -0
- package/dist/telemetry/metrics/agent-metrics.d.ts.map +1 -0
- package/dist/telemetry/metrics/agent-metrics.js +213 -0
- package/dist/telemetry/metrics/agent-metrics.js.map +1 -0
- package/dist/telemetry/metrics/index.d.ts +51 -0
- package/dist/telemetry/metrics/index.d.ts.map +1 -0
- package/dist/telemetry/metrics/index.js +100 -0
- package/dist/telemetry/metrics/index.js.map +1 -0
- package/dist/telemetry/metrics/quality-metrics.d.ts +171 -0
- package/dist/telemetry/metrics/quality-metrics.d.ts.map +1 -0
- package/dist/telemetry/metrics/quality-metrics.js +259 -0
- package/dist/telemetry/metrics/quality-metrics.js.map +1 -0
- package/dist/telemetry/metrics/system-metrics.d.ts +129 -0
- package/dist/telemetry/metrics/system-metrics.d.ts.map +1 -0
- package/dist/telemetry/metrics/system-metrics.js +380 -0
- package/dist/telemetry/metrics/system-metrics.js.map +1 -0
- package/dist/telemetry/types.d.ts +195 -0
- package/dist/telemetry/types.d.ts.map +1 -0
- package/dist/telemetry/types.js +90 -0
- package/dist/telemetry/types.js.map +1 -0
- package/package.json +18 -2
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Quality Engineering Metrics for Agentic QE Fleet
|
|
3
|
+
*
|
|
4
|
+
* Metrics for tracking test quality, coverage, defects, and quality gates.
|
|
5
|
+
*/
|
|
6
|
+
import { Meter, Counter, Histogram, UpDownCounter, Attributes } from '@opentelemetry/api';
|
|
7
|
+
/**
|
|
8
|
+
* Quality metrics registry
|
|
9
|
+
*/
|
|
10
|
+
export interface QualityMetrics {
|
|
11
|
+
/** Total number of tests executed */
|
|
12
|
+
testCount: Counter;
|
|
13
|
+
/** Number of passed tests */
|
|
14
|
+
testPassCount: Counter;
|
|
15
|
+
/** Number of failed tests */
|
|
16
|
+
testFailCount: Counter;
|
|
17
|
+
/** Number of skipped tests */
|
|
18
|
+
testSkipCount: Counter;
|
|
19
|
+
/** Test execution duration */
|
|
20
|
+
testDuration: Histogram;
|
|
21
|
+
/** Line coverage percentage */
|
|
22
|
+
coverageLine: Histogram;
|
|
23
|
+
/** Branch coverage percentage */
|
|
24
|
+
coverageBranch: Histogram;
|
|
25
|
+
/** Function coverage percentage */
|
|
26
|
+
coverageFunction: Histogram;
|
|
27
|
+
/** Statement coverage percentage */
|
|
28
|
+
coverageStatement: Histogram;
|
|
29
|
+
/** Number of flaky tests detected */
|
|
30
|
+
flakyTestCount: UpDownCounter;
|
|
31
|
+
/** Defect density per KLOC */
|
|
32
|
+
defectDensity: Histogram;
|
|
33
|
+
/** Number of quality gate evaluations */
|
|
34
|
+
qualityGateCount: Counter;
|
|
35
|
+
/** Security vulnerabilities found */
|
|
36
|
+
securityVulnerabilityCount: Counter;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Initialize quality metrics
|
|
40
|
+
*
|
|
41
|
+
* @param meter - OpenTelemetry Meter instance
|
|
42
|
+
* @returns Quality metrics registry
|
|
43
|
+
*/
|
|
44
|
+
export declare function createQualityMetrics(meter?: Meter): QualityMetrics;
|
|
45
|
+
/**
|
|
46
|
+
* Get initialized quality metrics
|
|
47
|
+
*
|
|
48
|
+
* @returns Quality metrics registry
|
|
49
|
+
*/
|
|
50
|
+
export declare function getQualityMetrics(): QualityMetrics;
|
|
51
|
+
/**
|
|
52
|
+
* Test execution result for recording
|
|
53
|
+
*/
|
|
54
|
+
export interface TestExecutionResult {
|
|
55
|
+
/** Test framework (jest, mocha, pytest) */
|
|
56
|
+
framework: string;
|
|
57
|
+
/** Test suite name */
|
|
58
|
+
suite: string;
|
|
59
|
+
/** Total tests in this execution */
|
|
60
|
+
total: number;
|
|
61
|
+
/** Number of passed tests */
|
|
62
|
+
passed: number;
|
|
63
|
+
/** Number of failed tests */
|
|
64
|
+
failed: number;
|
|
65
|
+
/** Number of skipped tests */
|
|
66
|
+
skipped: number;
|
|
67
|
+
/** Total duration in milliseconds */
|
|
68
|
+
durationMs: number;
|
|
69
|
+
/** Test type (unit, integration, e2e) */
|
|
70
|
+
testType?: string;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Record test execution results
|
|
74
|
+
*
|
|
75
|
+
* @param result - Test execution result
|
|
76
|
+
*/
|
|
77
|
+
export declare function recordTestExecution(result: TestExecutionResult): void;
|
|
78
|
+
/**
|
|
79
|
+
* Coverage report for recording
|
|
80
|
+
*/
|
|
81
|
+
export interface CoverageReport {
|
|
82
|
+
/** Source file or module */
|
|
83
|
+
target: string;
|
|
84
|
+
/** Line coverage percentage (0-100) */
|
|
85
|
+
line: number;
|
|
86
|
+
/** Branch coverage percentage (0-100) */
|
|
87
|
+
branch: number;
|
|
88
|
+
/** Function coverage percentage (0-100) */
|
|
89
|
+
function: number;
|
|
90
|
+
/** Statement coverage percentage (0-100) */
|
|
91
|
+
statement?: number;
|
|
92
|
+
/** Coverage tool used */
|
|
93
|
+
tool?: string;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Record coverage metrics
|
|
97
|
+
*
|
|
98
|
+
* @param report - Coverage report
|
|
99
|
+
*/
|
|
100
|
+
export declare function recordCoverage(report: CoverageReport): void;
|
|
101
|
+
/**
|
|
102
|
+
* Quality gate evaluation result
|
|
103
|
+
*/
|
|
104
|
+
export interface QualityGateResult {
|
|
105
|
+
/** Gate name */
|
|
106
|
+
gateName: string;
|
|
107
|
+
/** Whether the gate passed */
|
|
108
|
+
passed: boolean;
|
|
109
|
+
/** Threshold value */
|
|
110
|
+
threshold: number;
|
|
111
|
+
/** Actual value */
|
|
112
|
+
actual: number;
|
|
113
|
+
/** Metric type (coverage, test_pass_rate, etc.) */
|
|
114
|
+
metricType: string;
|
|
115
|
+
/** Severity if failed (warning, error, critical) */
|
|
116
|
+
severity?: string;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Record quality gate evaluation
|
|
120
|
+
*
|
|
121
|
+
* @param result - Quality gate result
|
|
122
|
+
*/
|
|
123
|
+
export declare function recordQualityGate(result: QualityGateResult): void;
|
|
124
|
+
/**
|
|
125
|
+
* Security scan result for recording
|
|
126
|
+
*/
|
|
127
|
+
export interface SecurityScanResult {
|
|
128
|
+
/** Target scanned (file, package, etc.) */
|
|
129
|
+
target: string;
|
|
130
|
+
/** Scanner tool used */
|
|
131
|
+
scanner: string;
|
|
132
|
+
/** Vulnerabilities by severity */
|
|
133
|
+
vulnerabilities: {
|
|
134
|
+
critical: number;
|
|
135
|
+
high: number;
|
|
136
|
+
medium: number;
|
|
137
|
+
low: number;
|
|
138
|
+
info: number;
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Record security scan results
|
|
143
|
+
*
|
|
144
|
+
* @param result - Security scan result
|
|
145
|
+
*/
|
|
146
|
+
export declare function recordSecurityScan(result: SecurityScanResult): void;
|
|
147
|
+
/**
|
|
148
|
+
* Record flaky test detection
|
|
149
|
+
*
|
|
150
|
+
* @param testName - Name of the flaky test
|
|
151
|
+
* @param flakinessScore - Flakiness score (0-1)
|
|
152
|
+
* @param isResolved - Whether the flaky test was resolved
|
|
153
|
+
*/
|
|
154
|
+
export declare function recordFlakyTest(testName: string, flakinessScore: number, isResolved?: boolean): void;
|
|
155
|
+
/**
|
|
156
|
+
* Record defect density
|
|
157
|
+
*
|
|
158
|
+
* @param module - Module or file name
|
|
159
|
+
* @param defectCount - Number of defects
|
|
160
|
+
* @param linesOfCode - Total lines of code
|
|
161
|
+
*/
|
|
162
|
+
export declare function recordDefectDensity(module: string, defectCount: number, linesOfCode: number): void;
|
|
163
|
+
/**
|
|
164
|
+
* API contract validation metrics
|
|
165
|
+
*/
|
|
166
|
+
export declare function createApiContractMetrics(meter?: Meter): {
|
|
167
|
+
contractValidationCount: Counter<Attributes>;
|
|
168
|
+
contractViolationCount: Counter<Attributes>;
|
|
169
|
+
schemaValidationDuration: Histogram<Attributes>;
|
|
170
|
+
};
|
|
171
|
+
//# sourceMappingURL=quality-metrics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quality-metrics.d.ts","sourceRoot":"","sources":["../../../src/telemetry/metrics/quality-metrics.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAS,aAAa,EAAE,UAAU,EAAE,MAAM,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,EAAE,kBAAkB,GAAG,IAAI,CAyBnE;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,MAAM,EAChB,cAAc,EAAE,MAAM,EACtB,UAAU,GAAE,OAAe,GAC1B,IAAI,CAUN;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,GAClB,IAAI,CAUN;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,CAAC,EAAE,KAAK;;;;EAsBrD"}
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Quality Engineering Metrics for Agentic QE Fleet
|
|
4
|
+
*
|
|
5
|
+
* Metrics for tracking test quality, coverage, defects, and quality gates.
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.createQualityMetrics = createQualityMetrics;
|
|
9
|
+
exports.getQualityMetrics = getQualityMetrics;
|
|
10
|
+
exports.recordTestExecution = recordTestExecution;
|
|
11
|
+
exports.recordCoverage = recordCoverage;
|
|
12
|
+
exports.recordQualityGate = recordQualityGate;
|
|
13
|
+
exports.recordSecurityScan = recordSecurityScan;
|
|
14
|
+
exports.recordFlakyTest = recordFlakyTest;
|
|
15
|
+
exports.recordDefectDensity = recordDefectDensity;
|
|
16
|
+
exports.createApiContractMetrics = createApiContractMetrics;
|
|
17
|
+
const bootstrap_1 = require("../bootstrap");
|
|
18
|
+
const types_1 = require("../types");
|
|
19
|
+
// Singleton metrics instance
|
|
20
|
+
let qualityMetrics = null;
|
|
21
|
+
/**
|
|
22
|
+
* Initialize quality metrics
|
|
23
|
+
*
|
|
24
|
+
* @param meter - OpenTelemetry Meter instance
|
|
25
|
+
* @returns Quality metrics registry
|
|
26
|
+
*/
|
|
27
|
+
function createQualityMetrics(meter) {
|
|
28
|
+
if (qualityMetrics) {
|
|
29
|
+
return qualityMetrics;
|
|
30
|
+
}
|
|
31
|
+
const m = meter || (0, bootstrap_1.getMeter)();
|
|
32
|
+
qualityMetrics = {
|
|
33
|
+
testCount: m.createCounter(types_1.METRIC_NAMES.TEST_COUNT, {
|
|
34
|
+
description: 'Total number of tests executed',
|
|
35
|
+
unit: 'tests',
|
|
36
|
+
}),
|
|
37
|
+
testPassCount: m.createCounter(`${types_1.METRIC_NAMES.TEST_COUNT}.pass`, {
|
|
38
|
+
description: 'Number of passed tests',
|
|
39
|
+
unit: 'tests',
|
|
40
|
+
}),
|
|
41
|
+
testFailCount: m.createCounter(`${types_1.METRIC_NAMES.TEST_COUNT}.fail`, {
|
|
42
|
+
description: 'Number of failed tests',
|
|
43
|
+
unit: 'tests',
|
|
44
|
+
}),
|
|
45
|
+
testSkipCount: m.createCounter(`${types_1.METRIC_NAMES.TEST_COUNT}.skip`, {
|
|
46
|
+
description: 'Number of skipped tests',
|
|
47
|
+
unit: 'tests',
|
|
48
|
+
}),
|
|
49
|
+
testDuration: m.createHistogram(types_1.METRIC_NAMES.TEST_DURATION, {
|
|
50
|
+
description: 'Test execution duration',
|
|
51
|
+
unit: 'ms',
|
|
52
|
+
advice: {
|
|
53
|
+
explicitBucketBoundaries: types_1.HISTOGRAM_BOUNDARIES.taskDuration,
|
|
54
|
+
},
|
|
55
|
+
}),
|
|
56
|
+
coverageLine: m.createHistogram(types_1.METRIC_NAMES.COVERAGE_LINE, {
|
|
57
|
+
description: 'Line coverage percentage',
|
|
58
|
+
unit: 'percent',
|
|
59
|
+
advice: {
|
|
60
|
+
explicitBucketBoundaries: types_1.HISTOGRAM_BOUNDARIES.coveragePercent,
|
|
61
|
+
},
|
|
62
|
+
}),
|
|
63
|
+
coverageBranch: m.createHistogram(types_1.METRIC_NAMES.COVERAGE_BRANCH, {
|
|
64
|
+
description: 'Branch coverage percentage',
|
|
65
|
+
unit: 'percent',
|
|
66
|
+
advice: {
|
|
67
|
+
explicitBucketBoundaries: types_1.HISTOGRAM_BOUNDARIES.coveragePercent,
|
|
68
|
+
},
|
|
69
|
+
}),
|
|
70
|
+
coverageFunction: m.createHistogram(types_1.METRIC_NAMES.COVERAGE_FUNCTION, {
|
|
71
|
+
description: 'Function coverage percentage',
|
|
72
|
+
unit: 'percent',
|
|
73
|
+
advice: {
|
|
74
|
+
explicitBucketBoundaries: types_1.HISTOGRAM_BOUNDARIES.coveragePercent,
|
|
75
|
+
},
|
|
76
|
+
}),
|
|
77
|
+
coverageStatement: m.createHistogram(`${types_1.METRIC_NAMES.COVERAGE_LINE}.statement`, {
|
|
78
|
+
description: 'Statement coverage percentage',
|
|
79
|
+
unit: 'percent',
|
|
80
|
+
advice: {
|
|
81
|
+
explicitBucketBoundaries: types_1.HISTOGRAM_BOUNDARIES.coveragePercent,
|
|
82
|
+
},
|
|
83
|
+
}),
|
|
84
|
+
flakyTestCount: m.createUpDownCounter(types_1.METRIC_NAMES.FLAKY_TEST_COUNT, {
|
|
85
|
+
description: 'Number of flaky tests currently tracked',
|
|
86
|
+
unit: 'tests',
|
|
87
|
+
}),
|
|
88
|
+
defectDensity: m.createHistogram(types_1.METRIC_NAMES.DEFECT_DENSITY, {
|
|
89
|
+
description: 'Defect density per 1000 lines of code',
|
|
90
|
+
unit: 'defects/KLOC',
|
|
91
|
+
advice: {
|
|
92
|
+
explicitBucketBoundaries: [0.1, 0.5, 1, 2, 5, 10, 20, 50],
|
|
93
|
+
},
|
|
94
|
+
}),
|
|
95
|
+
qualityGateCount: m.createCounter(types_1.METRIC_NAMES.QUALITY_GATE_PASS_RATE, {
|
|
96
|
+
description: 'Number of quality gate evaluations',
|
|
97
|
+
unit: 'evaluations',
|
|
98
|
+
}),
|
|
99
|
+
securityVulnerabilityCount: m.createCounter(types_1.METRIC_NAMES.SECURITY_VULNERABILITY_COUNT, {
|
|
100
|
+
description: 'Number of security vulnerabilities found',
|
|
101
|
+
unit: 'vulnerabilities',
|
|
102
|
+
}),
|
|
103
|
+
};
|
|
104
|
+
return qualityMetrics;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Get initialized quality metrics
|
|
108
|
+
*
|
|
109
|
+
* @returns Quality metrics registry
|
|
110
|
+
*/
|
|
111
|
+
function getQualityMetrics() {
|
|
112
|
+
if (!qualityMetrics) {
|
|
113
|
+
return createQualityMetrics();
|
|
114
|
+
}
|
|
115
|
+
return qualityMetrics;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Record test execution results
|
|
119
|
+
*
|
|
120
|
+
* @param result - Test execution result
|
|
121
|
+
*/
|
|
122
|
+
function recordTestExecution(result) {
|
|
123
|
+
const metrics = getQualityMetrics();
|
|
124
|
+
const attributes = {
|
|
125
|
+
'qe.test_framework': result.framework,
|
|
126
|
+
'test.suite': result.suite,
|
|
127
|
+
};
|
|
128
|
+
if (result.testType) {
|
|
129
|
+
attributes['test.type'] = result.testType;
|
|
130
|
+
}
|
|
131
|
+
// Record counts
|
|
132
|
+
metrics.testCount.add(result.total, attributes);
|
|
133
|
+
metrics.testPassCount.add(result.passed, { ...attributes, 'test.result': 'pass' });
|
|
134
|
+
metrics.testFailCount.add(result.failed, { ...attributes, 'test.result': 'fail' });
|
|
135
|
+
metrics.testSkipCount.add(result.skipped, { ...attributes, 'test.result': 'skip' });
|
|
136
|
+
// Record duration
|
|
137
|
+
metrics.testDuration.record(result.durationMs, attributes);
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Record coverage metrics
|
|
141
|
+
*
|
|
142
|
+
* @param report - Coverage report
|
|
143
|
+
*/
|
|
144
|
+
function recordCoverage(report) {
|
|
145
|
+
const metrics = getQualityMetrics();
|
|
146
|
+
const attributes = {
|
|
147
|
+
'coverage.target': report.target,
|
|
148
|
+
};
|
|
149
|
+
if (report.tool) {
|
|
150
|
+
attributes['coverage.tool'] = report.tool;
|
|
151
|
+
}
|
|
152
|
+
metrics.coverageLine.record(report.line, { ...attributes, 'qe.coverage_type': 'line' });
|
|
153
|
+
metrics.coverageBranch.record(report.branch, { ...attributes, 'qe.coverage_type': 'branch' });
|
|
154
|
+
metrics.coverageFunction.record(report.function, { ...attributes, 'qe.coverage_type': 'function' });
|
|
155
|
+
if (report.statement !== undefined) {
|
|
156
|
+
metrics.coverageStatement.record(report.statement, { ...attributes, 'qe.coverage_type': 'statement' });
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Record quality gate evaluation
|
|
161
|
+
*
|
|
162
|
+
* @param result - Quality gate result
|
|
163
|
+
*/
|
|
164
|
+
function recordQualityGate(result) {
|
|
165
|
+
const metrics = getQualityMetrics();
|
|
166
|
+
const attributes = {
|
|
167
|
+
'qe.gate_name': result.gateName,
|
|
168
|
+
'gate.result': result.passed ? 'pass' : 'fail',
|
|
169
|
+
'gate.metric_type': result.metricType,
|
|
170
|
+
};
|
|
171
|
+
if (result.severity) {
|
|
172
|
+
attributes['gate.severity'] = result.severity;
|
|
173
|
+
}
|
|
174
|
+
metrics.qualityGateCount.add(1, attributes);
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Record security scan results
|
|
178
|
+
*
|
|
179
|
+
* @param result - Security scan result
|
|
180
|
+
*/
|
|
181
|
+
function recordSecurityScan(result) {
|
|
182
|
+
const metrics = getQualityMetrics();
|
|
183
|
+
const baseAttributes = {
|
|
184
|
+
'security.target': result.target,
|
|
185
|
+
'security.scanner': result.scanner,
|
|
186
|
+
};
|
|
187
|
+
// Record vulnerabilities by severity
|
|
188
|
+
const severities = [
|
|
189
|
+
['critical', 'critical'],
|
|
190
|
+
['high', 'high'],
|
|
191
|
+
['medium', 'medium'],
|
|
192
|
+
['low', 'low'],
|
|
193
|
+
['info', 'info'],
|
|
194
|
+
];
|
|
195
|
+
for (const [key, severity] of severities) {
|
|
196
|
+
if (result.vulnerabilities[key] > 0) {
|
|
197
|
+
metrics.securityVulnerabilityCount.add(result.vulnerabilities[key], {
|
|
198
|
+
...baseAttributes,
|
|
199
|
+
'qe.security_severity': severity,
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Record flaky test detection
|
|
206
|
+
*
|
|
207
|
+
* @param testName - Name of the flaky test
|
|
208
|
+
* @param flakinessScore - Flakiness score (0-1)
|
|
209
|
+
* @param isResolved - Whether the flaky test was resolved
|
|
210
|
+
*/
|
|
211
|
+
function recordFlakyTest(testName, flakinessScore, isResolved = false) {
|
|
212
|
+
const metrics = getQualityMetrics();
|
|
213
|
+
const attributes = {
|
|
214
|
+
'test.name': testName,
|
|
215
|
+
'flaky.score': flakinessScore,
|
|
216
|
+
};
|
|
217
|
+
// Update flaky test count
|
|
218
|
+
metrics.flakyTestCount.add(isResolved ? -1 : 1, attributes);
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Record defect density
|
|
222
|
+
*
|
|
223
|
+
* @param module - Module or file name
|
|
224
|
+
* @param defectCount - Number of defects
|
|
225
|
+
* @param linesOfCode - Total lines of code
|
|
226
|
+
*/
|
|
227
|
+
function recordDefectDensity(module, defectCount, linesOfCode) {
|
|
228
|
+
const metrics = getQualityMetrics();
|
|
229
|
+
const density = (defectCount / linesOfCode) * 1000; // per KLOC
|
|
230
|
+
metrics.defectDensity.record(density, {
|
|
231
|
+
'code.module': module,
|
|
232
|
+
'defect.count': defectCount,
|
|
233
|
+
'code.lines': linesOfCode,
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* API contract validation metrics
|
|
238
|
+
*/
|
|
239
|
+
function createApiContractMetrics(meter) {
|
|
240
|
+
const m = meter || (0, bootstrap_1.getMeter)();
|
|
241
|
+
return {
|
|
242
|
+
contractValidationCount: m.createCounter('aqe.quality.api.contract.validation.count', {
|
|
243
|
+
description: 'Number of API contract validations',
|
|
244
|
+
unit: 'validations',
|
|
245
|
+
}),
|
|
246
|
+
contractViolationCount: m.createCounter('aqe.quality.api.contract.violation.count', {
|
|
247
|
+
description: 'Number of API contract violations',
|
|
248
|
+
unit: 'violations',
|
|
249
|
+
}),
|
|
250
|
+
schemaValidationDuration: m.createHistogram('aqe.quality.api.schema.validation.duration', {
|
|
251
|
+
description: 'API schema validation duration',
|
|
252
|
+
unit: 'ms',
|
|
253
|
+
advice: {
|
|
254
|
+
explicitBucketBoundaries: [1, 5, 10, 25, 50, 100, 250, 500],
|
|
255
|
+
},
|
|
256
|
+
}),
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
//# sourceMappingURL=quality-metrics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quality-metrics.js","sourceRoot":"","sources":["../../../src/telemetry/metrics/quality-metrics.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AA+CH,oDA6FC;AAOD,8CAKC;AA6BD,kDAoBC;AAyBD,wCAkBC;AAyBD,8CAcC;AAyBD,gDAyBC;AASD,0CAcC;AASD,kDAcC;AAKD,4DAsBC;AAnZD,4CAAwC;AACxC,oCAA8D;AAkC9D,6BAA6B;AAC7B,IAAI,cAAc,GAA0B,IAAI,CAAC;AAEjD;;;;;GAKG;AACH,SAAgB,oBAAoB,CAAC,KAAa;IAChD,IAAI,cAAc,EAAE,CAAC;QACnB,OAAO,cAAc,CAAC;IACxB,CAAC;IAED,MAAM,CAAC,GAAG,KAAK,IAAI,IAAA,oBAAQ,GAAE,CAAC;IAE9B,cAAc,GAAG;QACf,SAAS,EAAE,CAAC,CAAC,aAAa,CAAC,oBAAY,CAAC,UAAU,EAAE;YAClD,WAAW,EAAE,gCAAgC;YAC7C,IAAI,EAAE,OAAO;SACd,CAAC;QAEF,aAAa,EAAE,CAAC,CAAC,aAAa,CAAC,GAAG,oBAAY,CAAC,UAAU,OAAO,EAAE;YAChE,WAAW,EAAE,wBAAwB;YACrC,IAAI,EAAE,OAAO;SACd,CAAC;QAEF,aAAa,EAAE,CAAC,CAAC,aAAa,CAAC,GAAG,oBAAY,CAAC,UAAU,OAAO,EAAE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,CAAC,aAAa,CAAC,0CAA0C,EAAE;YAClF,WAAW,EAAE,mCAAmC;YAChD,IAAI,EAAE,YAAY;SACnB,CAAC;QAEF,wBAAwB,EAAE,CAAC,CAAC,eAAe,CAAC,4CAA4C,EAAE;YACxF,WAAW,EAAE,gCAAgC;YAC7C,IAAI,EAAE,IAAI;YACV,MAAM,EAAE;gBACN,wBAAwB,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;aAC5D;SACF,CAAC;KACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* System Metrics for Agentic QE Fleet
|
|
3
|
+
*
|
|
4
|
+
* Metrics for tracking system resources, queues, databases, and infrastructure.
|
|
5
|
+
*/
|
|
6
|
+
import { Meter, Counter, Histogram, UpDownCounter, Attributes, ObservableGauge } from '@opentelemetry/api';
|
|
7
|
+
/**
|
|
8
|
+
* System metrics registry
|
|
9
|
+
*/
|
|
10
|
+
export interface SystemMetrics {
|
|
11
|
+
/** Current heap memory usage */
|
|
12
|
+
memoryHeapUsed: ObservableGauge;
|
|
13
|
+
/** Total heap memory */
|
|
14
|
+
memoryHeapTotal: ObservableGauge;
|
|
15
|
+
/** RSS memory usage */
|
|
16
|
+
memoryRss: ObservableGauge;
|
|
17
|
+
/** External memory usage */
|
|
18
|
+
memoryExternal: ObservableGauge;
|
|
19
|
+
/** CPU usage percentage */
|
|
20
|
+
cpuUsage: ObservableGauge;
|
|
21
|
+
/** Event loop lag */
|
|
22
|
+
eventLoopLag: Histogram;
|
|
23
|
+
/** Task queue depth */
|
|
24
|
+
queueDepth: UpDownCounter;
|
|
25
|
+
/** Queue wait time */
|
|
26
|
+
queueWaitTime: Histogram;
|
|
27
|
+
/** Database query count */
|
|
28
|
+
dbQueryCount: Counter;
|
|
29
|
+
/** Database query duration */
|
|
30
|
+
dbQueryDuration: Histogram;
|
|
31
|
+
/** Database connection count */
|
|
32
|
+
dbConnectionCount: UpDownCounter;
|
|
33
|
+
/** Event bus publish count */
|
|
34
|
+
eventBusPublishCount: Counter;
|
|
35
|
+
/** Event bus latency */
|
|
36
|
+
eventBusLatency: Histogram;
|
|
37
|
+
/** File system operations */
|
|
38
|
+
fsOperationCount: Counter;
|
|
39
|
+
/** Network request count */
|
|
40
|
+
networkRequestCount: Counter;
|
|
41
|
+
/** Network request duration */
|
|
42
|
+
networkRequestDuration: Histogram;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Initialize system metrics
|
|
46
|
+
*
|
|
47
|
+
* @param meter - OpenTelemetry Meter instance
|
|
48
|
+
* @returns System metrics registry
|
|
49
|
+
*/
|
|
50
|
+
export declare function createSystemMetrics(meter?: Meter): SystemMetrics;
|
|
51
|
+
/**
|
|
52
|
+
* Get initialized system metrics
|
|
53
|
+
*
|
|
54
|
+
* @returns System metrics registry
|
|
55
|
+
*/
|
|
56
|
+
export declare function getSystemMetrics(): SystemMetrics;
|
|
57
|
+
/**
|
|
58
|
+
* Record database query
|
|
59
|
+
*
|
|
60
|
+
* @param operation - Query operation (select, insert, update, delete)
|
|
61
|
+
* @param table - Table or collection name
|
|
62
|
+
* @param durationMs - Query duration in milliseconds
|
|
63
|
+
* @param success - Whether the query succeeded
|
|
64
|
+
*/
|
|
65
|
+
export declare function recordDatabaseQuery(operation: string, table: string, durationMs: number, success?: boolean): void;
|
|
66
|
+
/**
|
|
67
|
+
* Record database connection change
|
|
68
|
+
*
|
|
69
|
+
* @param delta - Change in connection count (+1 for open, -1 for close)
|
|
70
|
+
* @param poolName - Connection pool name
|
|
71
|
+
*/
|
|
72
|
+
export declare function recordDatabaseConnection(delta: number, poolName?: string): void;
|
|
73
|
+
/**
|
|
74
|
+
* Record queue operation
|
|
75
|
+
*
|
|
76
|
+
* @param queueName - Name of the queue
|
|
77
|
+
* @param operation - Operation type (enqueue, dequeue)
|
|
78
|
+
* @param waitTimeMs - Time item waited in queue (for dequeue)
|
|
79
|
+
*/
|
|
80
|
+
export declare function recordQueueOperation(queueName: string, operation: 'enqueue' | 'dequeue', waitTimeMs?: number): void;
|
|
81
|
+
/**
|
|
82
|
+
* Record event bus operation
|
|
83
|
+
*
|
|
84
|
+
* @param eventType - Type of event
|
|
85
|
+
* @param latencyMs - Publish-to-receive latency
|
|
86
|
+
*/
|
|
87
|
+
export declare function recordEventBusOperation(eventType: string, latencyMs?: number): void;
|
|
88
|
+
/**
|
|
89
|
+
* Record network request
|
|
90
|
+
*
|
|
91
|
+
* @param method - HTTP method
|
|
92
|
+
* @param url - Request URL
|
|
93
|
+
* @param statusCode - Response status code
|
|
94
|
+
* @param durationMs - Request duration
|
|
95
|
+
*/
|
|
96
|
+
export declare function recordNetworkRequest(method: string, url: string, statusCode: number, durationMs: number): void;
|
|
97
|
+
/**
|
|
98
|
+
* Record file system operation
|
|
99
|
+
*
|
|
100
|
+
* @param operation - FS operation (read, write, delete, etc.)
|
|
101
|
+
* @param path - File path
|
|
102
|
+
* @param success - Whether operation succeeded
|
|
103
|
+
*/
|
|
104
|
+
export declare function recordFileSystemOperation(operation: string, path: string, success?: boolean): void;
|
|
105
|
+
/**
|
|
106
|
+
* Record event loop lag
|
|
107
|
+
*
|
|
108
|
+
* @param lagMs - Event loop lag in milliseconds
|
|
109
|
+
*/
|
|
110
|
+
export declare function recordEventLoopLag(lagMs: number): void;
|
|
111
|
+
/**
|
|
112
|
+
* Create memory-specific detailed metrics
|
|
113
|
+
*/
|
|
114
|
+
export declare function createMemoryDetailMetrics(meter?: Meter): {
|
|
115
|
+
heapSpaceUsed: ObservableGauge<Attributes>;
|
|
116
|
+
heapSpaceAvailable: ObservableGauge<Attributes>;
|
|
117
|
+
gcDuration: Histogram<Attributes>;
|
|
118
|
+
gcCount: Counter<Attributes>;
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* Create fleet coordination metrics
|
|
122
|
+
*/
|
|
123
|
+
export declare function createFleetCoordinationMetrics(meter?: Meter): {
|
|
124
|
+
coordinationRoundtrip: Histogram<Attributes>;
|
|
125
|
+
taskDistributionTime: Histogram<Attributes>;
|
|
126
|
+
agentSyncCount: Counter<Attributes>;
|
|
127
|
+
memoryShareSize: Histogram<Attributes>;
|
|
128
|
+
};
|
|
129
|
+
//# sourceMappingURL=system-metrics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"system-metrics.d.ts","sourceRoot":"","sources":["../../../src/telemetry/metrics/system-metrics.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAM3G;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,gCAAgC;IAChC,cAAc,EAAE,eAAe,CAAC;IAChC,wBAAwB;IACxB,eAAe,EAAE,eAAe,CAAC;IACjC,uBAAuB;IACvB,SAAS,EAAE,eAAe,CAAC;IAC3B,4BAA4B;IAC5B,cAAc,EAAE,eAAe,CAAC;IAChC,2BAA2B;IAC3B,QAAQ,EAAE,eAAe,CAAC;IAC1B,qBAAqB;IACrB,YAAY,EAAE,SAAS,CAAC;IACxB,uBAAuB;IACvB,UAAU,EAAE,aAAa,CAAC;IAC1B,sBAAsB;IACtB,aAAa,EAAE,SAAS,CAAC;IACzB,2BAA2B;IAC3B,YAAY,EAAE,OAAO,CAAC;IACtB,8BAA8B;IAC9B,eAAe,EAAE,SAAS,CAAC;IAC3B,gCAAgC;IAChC,iBAAiB,EAAE,aAAa,CAAC;IACjC,8BAA8B;IAC9B,oBAAoB,EAAE,OAAO,CAAC;IAC9B,wBAAwB;IACxB,eAAe,EAAE,SAAS,CAAC;IAC3B,6BAA6B;IAC7B,gBAAgB,EAAE,OAAO,CAAC;IAC1B,4BAA4B;IAC5B,mBAAmB,EAAE,OAAO,CAAC;IAC7B,+BAA+B;IA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