fix: preserve request-rate curve buckets
This commit is contained in:
@@ -1272,13 +1272,13 @@ function finalizeDashboardRequestRateSeries(rawSeries: readonly Record<string, u
|
||||
.map((item) => {
|
||||
const points = arrayRecords(item.buckets)
|
||||
.map((bucket) => ({
|
||||
ts: stringOrNull(bucket.startAt),
|
||||
startAt: stringOrNull(bucket.startAt),
|
||||
endAt: stringOrNull(bucket.endAt),
|
||||
ts: stringOrNull(bucket.startAt) ?? stringOrNull(bucket.t),
|
||||
startAt: stringOrNull(bucket.startAt) ?? stringOrNull(bucket.t),
|
||||
endAt: stringOrNull(bucket.endAt) ?? stringOrNull(bucket.e),
|
||||
bucketStartMs: numberOrNull(bucket.bucketStartMs),
|
||||
bucketEndMs: numberOrNull(bucket.bucketEndMs),
|
||||
count: numberOrNull(bucket.count),
|
||||
requestPerMinute: numberOrNull(bucket.requestPerMinute),
|
||||
count: numberOrNull(bucket.count) ?? numberOrNull(bucket.c),
|
||||
requestPerMinute: numberOrNull(bucket.requestPerMinute) ?? numberOrNull(bucket.rpm),
|
||||
valuesRedacted: true,
|
||||
}))
|
||||
.filter((point) => point.ts !== null && point.requestPerMinute !== null);
|
||||
|
||||
@@ -2252,7 +2252,7 @@ export function runNodeWebProbeObserveAnalyze(options: NodeWebProbeObserveOption
|
||||
"const slimProjectManagement = (value) => { const v = objectOrNull(value); if (!v) return null; const s = objectOrNull(v.summary) || v; return { summary: { enabled: s.enabled === true, projectSampleCount: s.projectSampleCount ?? null, mdtodoSampleCount: s.mdtodoSampleCount ?? null, latestPageKind: clip(s.latestPageKind, 48), latestPath: clip(s.latestPath, 96), latestSourceCount: s.latestSourceCount ?? null, latestFileCount: s.latestFileCount ?? null, latestTaskCount: s.latestTaskCount ?? null, latestSelectedTaskRefHash: clip(s.latestSelectedTaskRefHash, 80), launchCommandCount: s.launchCommandCount ?? null, launchSuccessCount: s.launchSuccessCount ?? null, launchFailureCount: s.launchFailureCount ?? null, launchWithOtelTraceHeaderCount: s.launchWithOtelTraceHeaderCount ?? null, projectApiResponseCount: s.projectApiResponseCount ?? null, projectApiFailureCount: s.projectApiFailureCount ?? null, projectApiSlowPathCount: s.projectApiSlowPathCount ?? null, slowApiBudgetMs: s.slowApiBudgetMs ?? null }, commands: takeTail(v.commands, 8).map((item) => { const row = objectOrNull(item) || {}; return { ts: row.ts ?? null, phase: clip(row.phase, 16), type: clip(row.type, 32), commandId: clip(row.commandId, 80), launchStatus: row.launchStatus ?? null, sessionId: clip(row.sessionId, 80), workbenchUrl: clip(row.workbenchUrl, 120), otelTraceId: clip(row.otelTraceId, 32), selectedTaskRefHash: clip(row.selectedTaskRefHash, 80) }; }), samples: takeTail(v.samples, 8).map((item) => { const row = objectOrNull(item) || {}; return { seq: row.seq ?? null, ts: row.ts ?? null, pageRole: clip(row.pageRole, 24), path: clip(row.path, 96), pageKind: clip(row.pageKind, 48), sourceCount: row.sourceCount ?? null, fileCount: row.fileCount ?? null, taskCount: row.taskCount ?? null, selectedTaskRefHash: clip(row.selectedTaskRefHash, 80), launchButtonEnabled: row.launchButtonEnabled === true, workbenchLinkCount: row.workbenchLinkCount ?? null }; }), projectApiByPath: takeHead(v.projectApiByPath, 8).map(slimNetworkGroup), valuesRedacted: true }; };",
|
||||
"const slimDomGroup = (item) => { const v = objectOrNull(item) || {}; return { count: v.count ?? null, firstAt: v.firstAt ?? null, lastAt: v.lastAt ?? null, text: clip(v.text ?? v.preview, 180) }; };",
|
||||
"const slimNetworkGroup = (item) => { const v = objectOrNull(item) || {}; return { count: v.count ?? null, method: clip(v.method, 12), status: v.status ?? null, path: clip(v.path ?? v.urlPath, 96), firstAt: v.firstAt ?? null, lastAt: v.lastAt ?? null, promptIndexes: Array.isArray(v.promptIndexes) ? v.promptIndexes.slice(0, 6) : [], failureKinds: Array.isArray(v.failureKinds) ? v.failureKinds.slice(0, 4).map((x) => clip(x, 48)) : [] }; };",
|
||||
"const slimRequestBucket = (item) => { const v = objectOrNull(item) || {}; return { startAt: v.startAt ?? null, endAt: v.endAt ?? null, count: v.count ?? null, requestPerMinute: v.requestPerMinute ?? null, pageKey: clip(v.pageKey, 96), path: clip(v.path, 96), apiKey: clip(v.apiKey, 120), valuesRedacted: true }; };",
|
||||
"const slimRequestBucket = (item) => { const v = objectOrNull(item) || {}; return { t: v.startAt ?? null, e: v.endAt ?? null, c: v.count ?? null, rpm: v.requestPerMinute ?? null }; };",
|
||||
"const slimRequestCurve = (item, isApi = false) => { const v = objectOrNull(item) || {}; return { pageKey: clip(v.pageKey, 96), pageRole: clip(v.pageRole, 24), pageId: clip(v.pageId, 32), pageEpoch: v.pageEpoch ?? null, apiKey: clip(v.apiKey, 120), method: clip(v.method, 12), path: clip(v.path, isApi ? 120 : 96), count: v.count ?? null, bucketCount: v.bucketCount ?? null, peakRequestPerMinute: v.peakRequestPerMinute ?? null, peakBucket: slimRequestBucket(v.peakBucket), buckets: takeTail(v.buckets, 12).map(slimRequestBucket), valuesRedacted: true }; };",
|
||||
"const slimRequestPeak = (item) => { const v = objectOrNull(item) || {}; return { scope: clip(v.scope, 16), thresholdPerMinute: v.thresholdPerMinute ?? null, bucketMs: v.bucketMs ?? null, startAt: v.startAt ?? null, endAt: v.endAt ?? null, count: v.count ?? null, requestPerMinute: v.requestPerMinute ?? null, pageKey: clip(v.pageKey, 96), path: clip(v.path, 96), apiKey: clip(v.apiKey, 120), valuesRedacted: true }; };",
|
||||
"const slimRequestRateCurve = (value) => { const v = objectOrNull(value); if (!v) return null; return { summary: objectOrNull(v.summary) || v, buckets: takeTail(v.buckets, 12).map(slimRequestBucket), pageCurves: takeHead(v.pageCurves, 8).map((item) => slimRequestCurve(item, false)), apiPathCurves: takeHead(v.apiPathCurves, 12).map((item) => slimRequestCurve(item, true)), peaks: takeHead(v.peaks, 12).map(slimRequestPeak), valuesRedacted: true }; };",
|
||||
@@ -2430,7 +2430,7 @@ export function runNodeWebProbeObserveAnalyze(options: NodeWebProbeObserveOption
|
||||
" runtimeAlerts: compact.runtimeAlerts ?? null,",
|
||||
" pagePerformance: compact.pagePerformance ?? null,",
|
||||
" requestRate: compact.requestRate ?? null,",
|
||||
" requestRateCurve: compact.requestRateCurve ? { summary: compact.requestRateCurve.summary ?? null, buckets: Array.isArray(compact.requestRateCurve.buckets) ? compact.requestRateCurve.buckets.slice(-6) : [], pageCurves: Array.isArray(compact.requestRateCurve.pageCurves) ? compact.requestRateCurve.pageCurves.slice(0, 4).map((item) => ({ pageKey: item.pageKey ?? null, path: item.path ?? null, count: item.count ?? null, peakRequestPerMinute: item.peakRequestPerMinute ?? null, peakBucket: item.peakBucket ?? null })) : [], apiPathCurves: Array.isArray(compact.requestRateCurve.apiPathCurves) ? compact.requestRateCurve.apiPathCurves.slice(0, 6).map((item) => ({ apiKey: item.apiKey ?? null, path: item.path ?? null, count: item.count ?? null, peakRequestPerMinute: item.peakRequestPerMinute ?? null, peakBucket: item.peakBucket ?? null })) : [], valuesRedacted: true } : null,",
|
||||
" requestRateCurve: compact.requestRateCurve ? { summary: compact.requestRateCurve.summary ?? null, buckets: Array.isArray(compact.requestRateCurve.buckets) ? compact.requestRateCurve.buckets.slice(-6) : [], pageCurves: Array.isArray(compact.requestRateCurve.pageCurves) ? compact.requestRateCurve.pageCurves.slice(0, 4).map((item) => ({ pageKey: item.pageKey ?? null, path: item.path ?? null, count: item.count ?? null, peakRequestPerMinute: item.peakRequestPerMinute ?? null, peakBucket: item.peakBucket ?? null, buckets: Array.isArray(item.buckets) ? item.buckets.slice(-6) : [] })) : [], apiPathCurves: Array.isArray(compact.requestRateCurve.apiPathCurves) ? compact.requestRateCurve.apiPathCurves.slice(0, 6).map((item) => ({ apiKey: item.apiKey ?? null, path: item.path ?? null, count: item.count ?? null, peakRequestPerMinute: item.peakRequestPerMinute ?? null, peakBucket: item.peakBucket ?? null, buckets: Array.isArray(item.buckets) ? item.buckets.slice(-6) : [] })) : [], valuesRedacted: true } : null,",
|
||||
" requestRatePeaks: Array.isArray(compact.requestRatePeaks) ? compact.requestRatePeaks.slice(0, 6) : [],",
|
||||
" projectManagement: compact.projectManagement ?? null,",
|
||||
" promptNetwork: compact.promptNetwork ?? null,",
|
||||
@@ -2497,7 +2497,7 @@ export function runNodeWebProbeObserveAnalyze(options: NodeWebProbeObserveOption
|
||||
" runtimeAlerts: compact.runtimeAlerts ?? null,",
|
||||
" pagePerformance: compact.pagePerformance ?? null,",
|
||||
" requestRate: compact.requestRate ?? null,",
|
||||
" requestRateCurve: compact.requestRateCurve ? { summary: compact.requestRateCurve.summary ?? null, pageCurves: Array.isArray(compact.requestRateCurve.pageCurves) ? compact.requestRateCurve.pageCurves.slice(0, 3).map((item) => ({ pageKey: item.pageKey ?? null, path: item.path ?? null, count: item.count ?? null, peakRequestPerMinute: item.peakRequestPerMinute ?? null })) : [], apiPathCurves: Array.isArray(compact.requestRateCurve.apiPathCurves) ? compact.requestRateCurve.apiPathCurves.slice(0, 4).map((item) => ({ apiKey: item.apiKey ?? null, path: item.path ?? null, count: item.count ?? null, peakRequestPerMinute: item.peakRequestPerMinute ?? null })) : [], valuesRedacted: true } : null,",
|
||||
" requestRateCurve: compact.requestRateCurve ? { summary: compact.requestRateCurve.summary ?? null, buckets: Array.isArray(compact.requestRateCurve.buckets) ? compact.requestRateCurve.buckets.slice(-6) : [], pageCurves: Array.isArray(compact.requestRateCurve.pageCurves) ? compact.requestRateCurve.pageCurves.slice(0, 3).map((item) => ({ pageKey: item.pageKey ?? null, path: item.path ?? null, count: item.count ?? null, peakRequestPerMinute: item.peakRequestPerMinute ?? null, peakBucket: item.peakBucket ?? null, buckets: Array.isArray(item.buckets) ? item.buckets.slice(-6) : [] })) : [], apiPathCurves: Array.isArray(compact.requestRateCurve.apiPathCurves) ? compact.requestRateCurve.apiPathCurves.slice(0, 4).map((item) => ({ apiKey: item.apiKey ?? null, path: item.path ?? null, count: item.count ?? null, peakRequestPerMinute: item.peakRequestPerMinute ?? null, peakBucket: item.peakBucket ?? null, buckets: Array.isArray(item.buckets) ? item.buckets.slice(-6) : [] })) : [], valuesRedacted: true } : null,",
|
||||
" requestRatePeaks: Array.isArray(compact.requestRatePeaks) ? compact.requestRatePeaks.slice(0, 4) : [],",
|
||||
" projectManagement: compact.projectManagement ? { summary: compact.projectManagement.summary ?? compact.projectManagement, samples: Array.isArray(compact.projectManagement.samples) ? compact.projectManagement.samples.slice(-4) : [], commands: Array.isArray(compact.projectManagement.commands) ? compact.projectManagement.commands.slice(-4) : [], launchCommands: Array.isArray(compact.projectManagement.launchCommands) ? compact.projectManagement.launchCommands.slice(-4) : [], projectApiByPath: Array.isArray(compact.projectManagement.projectApiByPath) ? compact.projectManagement.projectApiByPath.slice(0, 4) : [], slowProjectApiPerformance: Array.isArray(compact.projectManagement.slowProjectApiPerformance) ? compact.projectManagement.slowProjectApiPerformance.slice(0, 4) : [], valuesRedacted: true } : null,",
|
||||
" toolFindings: Array.isArray(compact.toolFindings) ? compact.toolFindings.slice(0, 8) : [],",
|
||||
@@ -2566,7 +2566,7 @@ export function runNodeWebProbeObserveAnalyze(options: NodeWebProbeObserveOption
|
||||
" output = compactOutput(ultratiny);",
|
||||
" }",
|
||||
" if (Buffer.byteLength(output, 'utf8') > compactStdoutLimitBytes) {",
|
||||
" output = compactOutput({ ok: compact.ok, counts: compact.counts ?? null, jsonlScope: compact.jsonlScope ?? null, analysisWindow: compact.analysisWindow ?? null, archiveSummary: compact.archiveSummary ? { redFindingCount: compact.archiveSummary.redFindingCount ?? null, findingCount: compact.archiveSummary.findingCount ?? null, sampleCount: compact.archiveSummary.sampleMetrics?.sampleCount ?? null, slowPathCount: compact.archiveSummary.pagePerformance?.slowPathCount ?? null } : null, requestRate: compact.requestRate ?? null, requestRateCurve: compact.requestRateCurve ? { summary: compact.requestRateCurve.summary ?? null, pageCurves: Array.isArray(compact.requestRateCurve.pageCurves) ? compact.requestRateCurve.pageCurves.slice(0, 2).map((item) => ({ path: item.path ?? item.pageKey ?? null, count: item.count ?? null, peakRequestPerMinute: item.peakRequestPerMinute ?? null, peakBucket: item.peakBucket ?? null })) : [], apiPathCurves: Array.isArray(compact.requestRateCurve.apiPathCurves) ? compact.requestRateCurve.apiPathCurves.slice(0, 3).map((item) => ({ apiKey: item.apiKey ?? item.path ?? null, count: item.count ?? null, peakRequestPerMinute: item.peakRequestPerMinute ?? null, peakBucket: item.peakBucket ?? null })) : [], valuesRedacted: true } : null, requestRatePeaks: Array.isArray(compact.requestRatePeaks) ? compact.requestRatePeaks.slice(0, 3) : [], projectManagement: compact.projectManagement ? { summary: compact.projectManagement.summary ?? compact.projectManagement, samples: Array.isArray(compact.projectManagement.samples) ? compact.projectManagement.samples.slice(-2) : [], commands: Array.isArray(compact.projectManagement.commands) ? compact.projectManagement.commands.slice(-2) : [], launchCommands: Array.isArray(compact.projectManagement.launchCommands) ? compact.projectManagement.launchCommands.slice(-2) : [], projectApiByPath: Array.isArray(compact.projectManagement.projectApiByPath) ? compact.projectManagement.projectApiByPath.slice(0, 2) : [], valuesRedacted: true } : null, toolFindings: Array.isArray(compact.toolFindings) ? compact.toolFindings.slice(0, 8) : [], commandState: compact.commandState ? { pendingCount: compact.commandState.pendingCount ?? null, processingCount: compact.commandState.processingCount ?? null, abandonedCount: compact.commandState.abandonedCount ?? null, failedCount: compact.commandState.failedCount ?? null } : null, findings: Array.isArray(compact.findings) ? compact.findings.slice(0, 4).map((item) => ({ kind: item.kind ?? item.code ?? null, severity: item.severity ?? item.level ?? null, count: item.count ?? item.sampleCount ?? null, timingSourceOfTruth: item.timingSourceOfTruth ?? null, timingStatus: item.timingStatus ?? null, timingAlert: item.timingAlert === true, summary: clip(item.summary ?? item.message, 120) })) : [], archiveRedFindings: Array.isArray(compact.archiveRedFindings) ? compact.archiveRedFindings.slice(0, 4).map((item) => ({ kind: item.kind ?? item.code ?? null, severity: item.severity ?? item.level ?? null, count: item.count ?? item.sampleCount ?? null, timingSourceOfTruth: item.timingSourceOfTruth ?? null, timingStatus: item.timingStatus ?? null, timingAlert: item.timingAlert === true, summary: clip(item.summary ?? item.message, 120) })) : [], commandFailures: Array.isArray(compact.commandFailures) ? compact.commandFailures.slice(-3).map((item) => ({ ts: item.ts ?? null, type: item.type ?? null, commandId: item.commandId ?? null, durationMs: item.durationMs ?? null, sampleSeq: item.sampleSeq ?? null, beforePath: item.beforePath ?? null, afterPath: item.afterPath ?? null, message: clip(item.message ?? item.failureKind ?? item.name, 120) })) : [], archivePagePerformanceSlowApi: Array.isArray(compact.archivePagePerformanceSlowApi) ? compact.archivePagePerformanceSlowApi.slice(0, 4).map((item) => ({ path: item.path ?? item.route ?? null, sampleCount: item.sampleCount ?? null, p95Ms: item.p95Ms ?? null, maxMs: item.maxMs ?? null, overFiveSecondCount: item.overFiveSecondCount ?? null })) : [], reportJsonPath: compact.reportJsonPath ?? reportJsonPath, reportJsonSha256: compact.reportJsonSha256 ?? sha256(reportJsonPath), reportMdPath: compact.reportMdPath ?? reportMdPath, reportMdSha256: compact.reportMdSha256 ?? sha256(reportMdPath), analyzer: { ...(compact.analyzer ?? {}), compactStdoutLimited: true, ultratiny: true, hardFallback: true, compactStdoutLimitBytes }, valuesRedacted: true });",
|
||||
" output = compactOutput({ ok: compact.ok, counts: compact.counts ?? null, jsonlScope: compact.jsonlScope ?? null, analysisWindow: compact.analysisWindow ?? null, archiveSummary: compact.archiveSummary ? { redFindingCount: compact.archiveSummary.redFindingCount ?? null, findingCount: compact.archiveSummary.findingCount ?? null, sampleCount: compact.archiveSummary.sampleMetrics?.sampleCount ?? null, slowPathCount: compact.archiveSummary.pagePerformance?.slowPathCount ?? null } : null, requestRate: compact.requestRate ?? null, requestRateCurve: compact.requestRateCurve ? { summary: compact.requestRateCurve.summary ?? null, buckets: Array.isArray(compact.requestRateCurve.buckets) ? compact.requestRateCurve.buckets.slice(-4) : [], pageCurves: Array.isArray(compact.requestRateCurve.pageCurves) ? compact.requestRateCurve.pageCurves.slice(0, 2).map((item) => ({ path: item.path ?? item.pageKey ?? null, count: item.count ?? null, peakRequestPerMinute: item.peakRequestPerMinute ?? null, peakBucket: item.peakBucket ?? null, buckets: Array.isArray(item.buckets) ? item.buckets.slice(-4) : [] })) : [], apiPathCurves: Array.isArray(compact.requestRateCurve.apiPathCurves) ? compact.requestRateCurve.apiPathCurves.slice(0, 3).map((item) => ({ apiKey: item.apiKey ?? item.path ?? null, count: item.count ?? null, peakRequestPerMinute: item.peakRequestPerMinute ?? null, peakBucket: item.peakBucket ?? null, buckets: Array.isArray(item.buckets) ? item.buckets.slice(-4) : [] })) : [], valuesRedacted: true } : null, requestRatePeaks: Array.isArray(compact.requestRatePeaks) ? compact.requestRatePeaks.slice(0, 3) : [], projectManagement: compact.projectManagement ? { summary: compact.projectManagement.summary ?? compact.projectManagement, samples: Array.isArray(compact.projectManagement.samples) ? compact.projectManagement.samples.slice(-2) : [], commands: Array.isArray(compact.projectManagement.commands) ? compact.projectManagement.commands.slice(-2) : [], launchCommands: Array.isArray(compact.projectManagement.launchCommands) ? compact.projectManagement.launchCommands.slice(-2) : [], projectApiByPath: Array.isArray(compact.projectManagement.projectApiByPath) ? compact.projectManagement.projectApiByPath.slice(0, 2) : [], valuesRedacted: true } : null, toolFindings: Array.isArray(compact.toolFindings) ? compact.toolFindings.slice(0, 8) : [], commandState: compact.commandState ? { pendingCount: compact.commandState.pendingCount ?? null, processingCount: compact.commandState.processingCount ?? null, abandonedCount: compact.commandState.abandonedCount ?? null, failedCount: compact.commandState.failedCount ?? null } : null, findings: Array.isArray(compact.findings) ? compact.findings.slice(0, 4).map((item) => ({ kind: item.kind ?? item.code ?? null, severity: item.severity ?? item.level ?? null, count: item.count ?? item.sampleCount ?? null, timingSourceOfTruth: item.timingSourceOfTruth ?? null, timingStatus: item.timingStatus ?? null, timingAlert: item.timingAlert === true, summary: clip(item.summary ?? item.message, 120) })) : [], archiveRedFindings: Array.isArray(compact.archiveRedFindings) ? compact.archiveRedFindings.slice(0, 4).map((item) => ({ kind: item.kind ?? item.code ?? null, severity: item.severity ?? item.level ?? null, count: item.count ?? item.sampleCount ?? null, timingSourceOfTruth: item.timingSourceOfTruth ?? null, timingStatus: item.timingStatus ?? null, timingAlert: item.timingAlert === true, summary: clip(item.summary ?? item.message, 120) })) : [], commandFailures: Array.isArray(compact.commandFailures) ? compact.commandFailures.slice(-3).map((item) => ({ ts: item.ts ?? null, type: item.type ?? null, commandId: item.commandId ?? null, durationMs: item.durationMs ?? null, sampleSeq: item.sampleSeq ?? null, beforePath: item.beforePath ?? null, afterPath: item.afterPath ?? null, message: clip(item.message ?? item.failureKind ?? item.name, 120) })) : [], archivePagePerformanceSlowApi: Array.isArray(compact.archivePagePerformanceSlowApi) ? compact.archivePagePerformanceSlowApi.slice(0, 4).map((item) => ({ path: item.path ?? item.route ?? null, sampleCount: item.sampleCount ?? null, p95Ms: item.p95Ms ?? null, maxMs: item.maxMs ?? null, overFiveSecondCount: item.overFiveSecondCount ?? null })) : [], reportJsonPath: compact.reportJsonPath ?? reportJsonPath, reportJsonSha256: compact.reportJsonSha256 ?? sha256(reportJsonPath), reportMdPath: compact.reportMdPath ?? reportMdPath, reportMdSha256: compact.reportMdSha256 ?? sha256(reportMdPath), analyzer: { ...(compact.analyzer ?? {}), compactStdoutLimited: true, ultratiny: true, hardFallback: true, compactStdoutLimitBytes }, valuesRedacted: true });",
|
||||
" }",
|
||||
" }",
|
||||
"}",
|
||||
@@ -2726,6 +2726,7 @@ function compactWebObserveAnalyzeRequestRateCurveForRaw(value: Record<string, un
|
||||
|| arrayRecordsValue(value.peaks).length > 0;
|
||||
if (!hasCurve) return null;
|
||||
return {
|
||||
summary,
|
||||
buckets: arrayRecordsValue(value.buckets).slice(-4).map(compactWebObserveAnalyzeRequestRateBucketForRaw),
|
||||
pageCurves: arrayRecordsValue(value.pageCurves).slice(0, 8).map(compactWebObserveAnalyzeRequestRateSeriesForRaw),
|
||||
apiPathCurves: arrayRecordsValue(value.apiPathCurves).slice(0, 12).map(compactWebObserveAnalyzeRequestRateSeriesForRaw),
|
||||
@@ -2736,11 +2737,10 @@ function compactWebObserveAnalyzeRequestRateCurveForRaw(value: Record<string, un
|
||||
|
||||
function compactWebObserveAnalyzeRequestRateBucketForRaw(value: Record<string, unknown>): Record<string, unknown> {
|
||||
return {
|
||||
startAt: stringOrNullValue(value.startAt),
|
||||
endAt: stringOrNullValue(value.endAt),
|
||||
count: numberOrNullValue(value.count),
|
||||
requestPerMinute: numberOrNullValue(value.requestPerMinute),
|
||||
valuesRedacted: true,
|
||||
t: stringOrNullValue(value.startAt ?? value.t),
|
||||
e: stringOrNullValue(value.endAt ?? value.e),
|
||||
c: numberOrNullValue(value.count ?? value.c),
|
||||
rpm: numberOrNullValue(value.requestPerMinute ?? value.rpm),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -2750,6 +2750,7 @@ function compactWebObserveAnalyzeRequestRateSeriesForRaw(value: Record<string, u
|
||||
bucketCount: numberOrNullValue(value.bucketCount),
|
||||
peakRequestPerMinute: numberOrNullValue(value.peakRequestPerMinute),
|
||||
peakBucket: compactWebObserveAnalyzeRequestRateBucketForRaw(recordValue(value.peakBucket)),
|
||||
buckets: arrayRecordsValue(value.buckets).slice(-20).map(compactWebObserveAnalyzeRequestRateBucketForRaw),
|
||||
valuesRedacted: true,
|
||||
};
|
||||
const pageKey = stringOrNullValue(value.pageKey);
|
||||
@@ -2894,7 +2895,7 @@ export function recoverWebObserveAnalyzeFromArtifacts(options: NodeWebProbeObser
|
||||
"const slimGroup = (item) => { const v = objectOrNull(item) || {}; return { count: v.count ?? null, method: clip(v.method, 12), status: v.status ?? null, path: clip(v.path ?? v.urlPath ?? v.route, 96), firstAt: v.firstAt ?? null, lastAt: v.lastAt ?? null, text: clip(v.text ?? v.preview, 180), failureKinds: arr(v.failureKinds).slice(0, 4).map((x) => clip(x, 48)), traceIds: arr(v.traceIds).slice(0, 3).map((x) => clip(x, 64)) }; };",
|
||||
"const slimSlowSample = (item) => { const v = objectOrNull(item) || {}; return { ts: v.ts ?? null, seq: v.seq ?? null, path: clip(v.path ?? v.rawPath, 96), initiatorType: clip(v.initiatorType, 24), durationMs: v.durationMs ?? null, requestToResponseStartMs: v.requestToResponseStartMs ?? v.streamOpenMs ?? null, responseTransferMs: v.responseTransferMs ?? null, timingStatus: clip(v.timingStatus, 16), nextHopProtocol: clip(v.nextHopProtocol, 24), serverTimingNames: arr(v.serverTimingNames).slice(0, 4).map((x) => clip(x, 32)), otelTraceId: clip(v.otelTraceId, 32) }; };",
|
||||
"const slimSlowApi = (item) => { const v = objectOrNull(item) || {}; return { path: clip(v.path ?? v.route, 96), route: clip(v.route ?? v.path, 96), sampleCount: v.sampleCount ?? null, p95Ms: v.p95Ms ?? v.p95 ?? null, maxMs: v.maxMs ?? v.max ?? null, budgetMs: v.budgetMs ?? null, overBudgetCount: v.overBudgetCount ?? null, overFiveSecondCount: v.overFiveSecondCount ?? null, slowSamples: arr(v.slowSamples).slice(0, 3).map(slimSlowSample) }; };",
|
||||
"const slimRequestBucket = (item) => { const v = objectOrNull(item) || {}; return { startAt: v.startAt ?? null, endAt: v.endAt ?? null, count: v.count ?? null, requestPerMinute: v.requestPerMinute ?? null, pageKey: clip(v.pageKey, 96), path: clip(v.path, 96), apiKey: clip(v.apiKey, 120), valuesRedacted: true }; };",
|
||||
"const slimRequestBucket = (item) => { const v = objectOrNull(item) || {}; return { t: v.startAt ?? null, e: v.endAt ?? null, c: v.count ?? null, rpm: v.requestPerMinute ?? null }; };",
|
||||
"const slimRequestCurve = (item, isApi = false) => { const v = objectOrNull(item) || {}; return { pageKey: clip(v.pageKey, 96), pageRole: clip(v.pageRole, 24), pageId: clip(v.pageId, 32), pageEpoch: v.pageEpoch ?? null, apiKey: clip(v.apiKey, 120), method: clip(v.method, 12), path: clip(v.path, isApi ? 120 : 96), count: v.count ?? null, bucketCount: v.bucketCount ?? null, peakRequestPerMinute: v.peakRequestPerMinute ?? null, peakBucket: slimRequestBucket(v.peakBucket), buckets: arr(v.buckets).slice(-12).map(slimRequestBucket), valuesRedacted: true }; };",
|
||||
"const slimRequestPeak = (item) => { const v = objectOrNull(item) || {}; return { scope: clip(v.scope, 16), thresholdPerMinute: v.thresholdPerMinute ?? null, bucketMs: v.bucketMs ?? null, startAt: v.startAt ?? null, endAt: v.endAt ?? null, count: v.count ?? null, requestPerMinute: v.requestPerMinute ?? null, pageKey: clip(v.pageKey, 96), path: clip(v.path, 96), apiKey: clip(v.apiKey, 120), valuesRedacted: true }; };",
|
||||
"const slimRequestRateCurve = (value) => { const v = objectOrNull(value); if (!v) return null; return { summary: objectOrNull(v.summary) || v, buckets: arr(v.buckets).slice(-12).map(slimRequestBucket), pageCurves: arr(v.pageCurves).slice(0, 8).map((item) => slimRequestCurve(item, false)), apiPathCurves: arr(v.apiPathCurves).slice(0, 12).map((item) => slimRequestCurve(item, true)), peaks: arr(v.peaks).slice(0, 12).map(slimRequestPeak), valuesRedacted: true }; };",
|
||||
|
||||
Reference in New Issue
Block a user