Skip to content

Commit

Permalink
Merge pull request #62 from mbehr1/fix/seq_reading_steptype
Browse files Browse the repository at this point in the history
Fix/seq reading steptype
  • Loading branch information
mbehr1 authored Jan 7, 2025
2 parents 15b5b72 + ff339fd commit 2e1eb9f
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 10 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
},
"dependencies": {
"@vscode/extension-telemetry": "^0.9.8",
"dlt-logs-utils": "0.10.0",
"dlt-logs-utils": "0.10.1",
"jju": "github:mbehr1/jju#3aa4169df926e99083fdd511d7c20b5bd9ba789f",
"js-yaml": "^4.1.0",
"json5": "2.2.3",
Expand Down
42 changes: 42 additions & 0 deletions src/extension/fbaNBRQRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,7 @@ export class FBANBRestQueryRenderer {
): Promise<void> {
try {
const perfStart: number = performance.now()
const maxNrMsgs = 1_000_000
const sequences = JSON5.parse(cell.document.getText())
if (Array.isArray(sequences) && sequences.length > 0) {
// code similar to fba-cli.processSequences (todo refactor to dlt-log-utils/sequences?)
Expand Down Expand Up @@ -706,6 +707,7 @@ export class FBANBRestQueryRenderer {
} else {
// we do want lifecycle infos as well
allFilters[0].addLifecycles = true
allFilters[0].maxNrMsgs = maxNrMsgs + 1 // one more to detect whether we ran into the limit
}
const allFiltersRq: RQ = {
path: 'ext:mbehr1.dlt-logs/get/docs/0/filters?', // todo get from cell data!
Expand Down Expand Up @@ -751,6 +753,10 @@ export class FBANBRestQueryRenderer {
receptionTimeInMs: lifecycle ? lifecycle.lifecycleStart.valueOf() + d.attributes.timeStamp / 10000 : 0,
}
})
const hitMaxNrMsgsLimit = msgs.length > maxNrMsgs
if (hitMaxNrMsgsLimit) {
msgs.splice(maxNrMsgs)
}
const slicedMsgs = msgs.slice(0, 50)
perfNow = performance.now()
perfInterims = perfNow - perfStep
Expand All @@ -771,6 +777,15 @@ export class FBANBRestQueryRenderer {
texts: msgsText,
},
])
if (hitMaxNrMsgsLimit) {
exec.appendOutput(
new NotebookCellOutput([
vscode.NotebookCellOutputItem.stderr(
`Query results were limited to ${maxNrMsgs} messages! Please adjust filters to reduce the amount of messages!`,
),
]),
)
}
perfNow = performance.now()
perfInterims = perfNow - perfStep
perfStep = perfNow
Expand Down Expand Up @@ -820,6 +835,33 @@ export class FBANBRestQueryRenderer {
exec.appendOutput(
new NotebookCellOutput([vscode.NotebookCellOutputItem.stderr(`converting result to md got err:${e}`)]),
)
// see which occurrence fails/throws:
let foundFailingOcc = false
for (const [occIdx, occ] of seqResult.occurrences.entries()) {
const partSeq: FbSequenceResult = { ...seqResult, occurrences: [occ] }
try {
const partResAsMd = seqResultToMdAst(partSeq)
} catch (e) {
appendMarkdown(exec, [
{
open: true,
summary: `Failing sequence details: '${seqChecker.name}'. Occurrence #${occIdx} partial seqResult=:`,
texts: codeBlock(JSON.stringify(partSeq, undefined, 2), 'json'),
},
])
foundFailingOcc = true
break
}
}
if (!foundFailingOcc) {
appendMarkdown(exec, [
{
open: true,
summary: `Failing sequence details: '${seqChecker.name}'. seqResult=:`,
texts: codeBlock(JSON.stringify(seqResult, undefined, 2), 'json'),
},
])
}
}
appendMarkdown(exec, [
{
Expand Down
2 changes: 1 addition & 1 deletion src/webview/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^14.4.3",
"dlt-logs-utils": "0.10.0",
"dlt-logs-utils": "0.10.1",
"dompurify": "^2.4.0",
"jju": "github:mbehr1/jju#3aa4169df926e99083fdd511d7c20b5bd9ba789f",
"js-yaml": "^4.1.0",
Expand Down
8 changes: 4 additions & 4 deletions src/webview/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4259,10 +4259,10 @@ dir-glob@^3.0.1:
dependencies:
path-type "^4.0.0"

[email protected].0:
version "0.10.0"
resolved "https://registry.yarnpkg.com/dlt-logs-utils/-/dlt-logs-utils-0.10.0.tgz#e8651aaf053497efc45d0e6fb93f08026c4bd819"
integrity sha512-YWDWyzlwKM2Lsp4F/+o+feFwNaKxj4SngT6XpJqcW5CIIyQgnFza1HxiFh3Kp8V0d5O1gBJJw7fUYFzyTRremQ==
[email protected].1:
version "0.10.1"
resolved "https://registry.yarnpkg.com/dlt-logs-utils/-/dlt-logs-utils-0.10.1.tgz#a869a6f9940dabb5cfbee029a75395c83595f878"
integrity sha512-WMppeBhtAlkhJoULy9Sn1i01CmuKfefV9faHqc0sC54vl28nx+glfI3pEnP4g5m2pHPGMdakBVtfSS8aJxMzSQ==

dlv@^1.1.3:
version "1.1.3"
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2283,10 +2283,10 @@ dir-glob@^3.0.0, dir-glob@^3.0.1:
dependencies:
path-type "^4.0.0"

[email protected].0:
version "0.10.0"
resolved "https://registry.yarnpkg.com/dlt-logs-utils/-/dlt-logs-utils-0.10.0.tgz#e8651aaf053497efc45d0e6fb93f08026c4bd819"
integrity sha512-YWDWyzlwKM2Lsp4F/+o+feFwNaKxj4SngT6XpJqcW5CIIyQgnFza1HxiFh3Kp8V0d5O1gBJJw7fUYFzyTRremQ==
[email protected].1:
version "0.10.1"
resolved "https://registry.yarnpkg.com/dlt-logs-utils/-/dlt-logs-utils-0.10.1.tgz#a869a6f9940dabb5cfbee029a75395c83595f878"
integrity sha512-WMppeBhtAlkhJoULy9Sn1i01CmuKfefV9faHqc0sC54vl28nx+glfI3pEnP4g5m2pHPGMdakBVtfSS8aJxMzSQ==

doctrine@^3.0.0:
version "3.0.0"
Expand Down

0 comments on commit 2e1eb9f

Please sign in to comment.