-
Notifications
You must be signed in to change notification settings - Fork 529
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor Critical Path code to prevent it from ever throwing exceptio…
…ns (#1785) Resolves #1779 In this PR switch statement is refactored to if-else block and covered all of our decision space. --------- Signed-off-by: GLVS Kiriti <[email protected]>
- Loading branch information
1 parent
103fef5
commit 7ef6909
Showing
4 changed files
with
146 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
packages/jaeger-ui/src/components/TracePage/CriticalPath/testCases/test9.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
// Copyright (c) 2023 The Jaeger Authors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
import transformTraceData from '../../../../model/transform-trace-data'; | ||
|
||
/* | ||
┌──────────┐ | | ||
│ Span A │ | span A | ||
└──────────┘ | / | ||
++++++++++++ | / | ||
┌────────────┐ | span B | ||
│ Span B │ | | ||
└────────────┘ | (parent-child tree) | ||
spanB will be dropped. | | ||
span A is on critical path(+++++) | | ||
*/ | ||
|
||
const trace = { | ||
traceID: 'trace-abc', | ||
spans: [ | ||
{ | ||
spanID: 'span-A', | ||
operationName: 'op-A', | ||
references: [], | ||
startTime: 10, | ||
duration: 20, | ||
processID: 'p1', | ||
}, | ||
{ | ||
spanID: 'span-B', | ||
operationName: 'op-B', | ||
references: [ | ||
{ | ||
refType: 'CHILD_OF', | ||
spanID: 'span-A', | ||
}, | ||
], | ||
startTime: 1, | ||
duration: 4, | ||
processID: 'p1', | ||
}, | ||
], | ||
processes: { | ||
p1: { | ||
serviceName: 'service-one', | ||
}, | ||
}, | ||
}; | ||
|
||
const transformedTrace = transformTraceData(trace); | ||
|
||
const criticalPathSections = [ | ||
{ | ||
spanId: 'span-A', | ||
section_start: 10, | ||
section_end: 30, | ||
}, | ||
]; | ||
|
||
const test9 = { | ||
criticalPathSections, | ||
trace: transformedTrace, | ||
}; | ||
|
||
export default test9; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters