Skip to content

Commit

Permalink
Add try-catch when parsing profiling json string; fix default namespa…
Browse files Browse the repository at this point in the history
…ce bug (#346)

Signed-off-by: yiqianxu <yiqianxu@harmonycloud.cn>
  • Loading branch information
thousandxu authored Nov 2, 2022
1 parent 25fd95c commit f7e78f0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- Add request and response payload of `Redis` protocol message to `Span` data. ([#325](https://github.com/CloudDectective-Harmonycloud/kindling/pull/325))

### Bug fixes
- Fix the topology node naming error in the default namespace.([#346](https://github.com/CloudDectective-Harmonycloud/kindling/pull/346))
- Fix the bug that if `ReadBytes` receives negative numbers as arguments, the program panics with the error of slice outofbound. ([#327](https://github.com/CloudDectective-Harmonycloud/kindling/pull/327))

## v0.4.1 - 2022-09-21
Expand Down
18 changes: 14 additions & 4 deletions camera-front/node/routers/file.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,22 @@ router.get('/getTraceFile', function(req, res, next) {
let cpuEventsList = [];
let cpuEvents = [];

_.forEach(cpuEventStrs, (str) => cpuEventsList.push(JSON.parse(str)));
_.forEach(cpuEventStrs, (str) => {
try {
cpuEventsList.push(JSON.parse(str))
} catch (error) {
console.error(str);
}
});
cpuEvents = _.map(cpuEventsList, 'labels');
_.forEach(cpuEvents, item => {
item.cpuEvents = JSON.parse(item.cpuEvents);
item.javaFutexEvents = JSON.parse(item.javaFutexEvents);
item.transactionIds = JSON.parse(item.transactionIds);
try {
item.cpuEvents = JSON.parse(item.cpuEvents);
item.javaFutexEvents = JSON.parse(item.javaFutexEvents);
item.transactionIds = JSON.parse(item.transactionIds);
} catch (error) {
console.error(error, item);
}
});

let finalResult = {
Expand Down
2 changes: 1 addition & 1 deletion grafana-plugins/topo-plugin/src/topology/services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const showServiceOptions = [


// externalTypes:The namespace enumeration value of the current external call
const externalTypes: string[] = ['NOT_FOUND_EXTERNAL', 'NOT_FOUND_INTERNAL', 'EXTERNAL', 'external', 'default'];
const externalTypes: string[] = ['NOT_FOUND_EXTERNAL', 'NOT_FOUND_INTERNAL', 'EXTERNAL', 'external'];
// workloadTypes
const workloadTypes: string[] = ['workload', 'deployment', 'daemonset', 'statefulset', 'node'];

Expand Down

0 comments on commit f7e78f0

Please sign in to comment.