plugins/postman-testgen/skills/trace-assertion/SKILL.md
This skill should be used when writing Postman test script assertions for VictoriaTraces call chain verification, when the user asks to "assert trace path", "verify call chain", "check span relationships", "validate distributed trace", "query VictoriaTraces from Postman", or mentions trace/span verification in API tests.
npx skillsauth add hicaosen/skills Trace Assertion PatternsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Provide templates for querying VictoriaTraces and asserting call chain structure within Postman test scripts.
GET /select/jaeger/api/traces on the vtUrl environment variableservice (mandatory)start/end in microsecondsAccountID: 0, ProjectID: 0 (multi-tenancy)pm.environment.set('traceStartUs', Date.now() * 1000);
var vtUrl = pm.environment.get('vtUrl');
var traceStartUs = pm.environment.get('traceStartUs');
var endUs = Date.now() * 1000;
var traceUrl = vtUrl + '/select/jaeger/api/traces?' +
'service=' + encodeURIComponent('service-name') +
'&start=' + traceStartUs +
'&end=' + endUs +
'&limit=5';
pm.sendRequest({
url: traceUrl,
method: 'GET',
header: { 'AccountID': '0', 'ProjectID': '0' }
}, function (err, response) {
var result = response.json();
var traces = result.data || [];
// assertions here
});
Trace assertions should focus on three key aspects:
status.statusCode = OK (no ERROR status)Assert all expected services/layers appear in the trace:
var services = {};
spans.forEach(function (s) { services[s.process.serviceName] = true; });
pm.expect(services).to.include.all.keys(['api-gateway', 'order-service', 'order-repo']);
var rootSpan = spans.find(function (s) { return !s.parentSpanID || s.parentSpanID === '0'; });
pm.expect(rootSpan.tags['http.method']).to.eql('POST');
pm.expect(rootSpan.tags['http.status_code']).to.eql('200');
var errorSpans = spans.filter(function (s) {
return s.tags && s.tags['status.code'] === 'ERROR';
});
pm.expect(errorSpans).to.have.lengthOf(0, 'Found error spans: ' +
errorSpans.map(function (s) { return s.operationName; }).join(', '));
pm.expect(childSpan.parentSpanID).to.eql(parentSpan.spanID);
Wrap in IIFE to avoid variable conflicts. Use [TRACE] prefix:
// --- TRACE LAYER ---
(function () {
var vtUrl = pm.environment.get('vtUrl');
var traceStartUs = pm.environment.get('traceStartUs');
if (!vtUrl || !traceStartUs) return;
var traceUrl = vtUrl + '/select/jaeger/api/traces?' +
'service=' + encodeURIComponent('target-service') +
'&start=' + traceStartUs + '&end=' + (Date.now() * 1000) + '&limit=5';
pm.sendRequest({
url: traceUrl,
method: 'GET',
header: { 'AccountID': '0', 'ProjectID': '0' }
}, function (err, response) {
if (err) {
pm.test('[TRACE] Query succeeded', function () {
pm.expect.fail('Trace query failed: ' + err.message);
});
return;
}
var traces = (response.json().data || []);
pm.test('[TRACE] Found trace', function () {
pm.expect(traces.length).to.be.above(0);
});
if (!traces.length) return;
var spans = traces[0].spans || [];
pm.test('[TRACE] Call chain correct', function () {
var svcs = {};
spans.forEach(function (s) { svcs[s.process.serviceName] = true; });
pm.expect(svcs).to.include.all.keys(['expected-service-a', 'expected-service-b']);
});
});
})();
Prefix all trace assertions with [TRACE] to distinguish from [HTTP] and [LOG] layers.
For complete query and assertion patterns, consult:
references/trace-query-patterns.md — Full patterns including operation filters, tags, duration, depth verification, dependency queries, span count, and complete assertion blocksdevelopment
VictoriaTraces HTTP API reference for querying distributed traces via Jaeger-compatible API. This skill should be used when searching traces, listing services/operations, getting trace details by ID, querying service dependencies, constructing HTTP requests to VictoriaTraces, or working with Jaeger API endpoints for distributed tracing analysis.
development
VictoriaMetrics HTTP API reference for querying metrics, exporting/importing data, TSDB stats, and administrative operations. This skill should be used when constructing HTTP requests to VictoriaMetrics, understanding query endpoints (/api/v1/query, /api/v1/query_range, /api/v1/export, /api/v1/import), response formats, checking cardinality, creating snapshots, or integrating with VictoriaMetrics API.
development
VictoriaLogs HTTP API reference for querying logs, hits stats, field discovery, live tailing, and log statistics. This skill should be used when constructing HTTP requests to VictoriaLogs, understanding query endpoints (/select/logsql/query, /select/logsql/tail, /select/logsql/hits, /select/logsql/field_names), response formats, or integrating with VictoriaLogs API for log search and analysis.
testing
PromQL query language fundamentals for Prometheus and Prometheus-compatible systems. Use for understanding PromQL instant/range vectors, label matchers, aggregation operators, offset/@ modifiers, or when targeting non-VictoriaMetrics Prometheus systems. For VictoriaMetrics-specific features like default_rollup, rollup, or outlier detection, use the metricsql skill.