Skip to content

Commit c9aee4f

Browse files
[FSMCPB-165194]: Add Shell SDK tracing (#185)
1 parent 4131423 commit c9aee4f

11 files changed

Lines changed: 465 additions & 35 deletions

File tree

.github/workflows/fsh-shell_pull-request.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ jobs:
2222
missing_files=""
2323
for i in "${array[@]}"
2424
do
25-
[[ ${FILES_CHANGED[*]} =~ $i ]] && echo "$i file found in the changeset" || missing_files="$missing_files $i"
25+
i_lower=$(echo "$i" | tr '[:upper:]' '[:lower:]')
26+
[[ ${FILES_CHANGED[*]} =~ $i_lower ]] && echo "$i file found in the changeset" || missing_files="$missing_files $i"
2627
done
2728
echo ""
2829
[ -z "$missing_files" ] && echo "All mandatory files have been modified" || echo "Following files $missing_files have not been modified"

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [1.24.0] - 2026-03-23
9+
10+
### Added
11+
12+
- Add `trace` tracking to SDK messages for debugging and analytics
13+
- Added `TraceEntry` interface for the tracing information model
14+
815
## [1.23.0] - 2026-03-13
916

1017
### Added

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "fsm-shell",
3-
"version": "1.23.0",
3+
"version": "1.24.0",
44
"description": "client library for FSM shell",
55
"main": "release/fsm-shell-client.js",
66
"module": "release/fsm-shell-client.es.js",

src/Debugger.ts

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
21
import { EventType, ALL_SHELL_EVENTS_ARRAY } from './ShellEvents';
32
import { EventDirection, DebugEvent } from './models/debug/debug-event';
43
import { MessageLogger } from './MessageLogger';
4+
import { TraceEntry } from './models/trace/trace-entry.model';
55

66
interface DebuggableWindow extends Window {
77
fsmShellMessageLogger: MessageLogger | undefined;
@@ -10,29 +10,35 @@ interface DebuggableWindow extends Window {
1010
interface Routing {
1111
to?: string[];
1212
from?: string[];
13+
trace?: TraceEntry[];
1314
}
1415

1516
const FSM_SHELL_DEBUG_KEY = 'cs.fsm-shell.debug';
1617

1718
export class Debugger {
18-
1919
private debugMode: boolean = false;
2020

21-
constructor(
22-
private winRef: Window,
23-
private debugId: string
24-
) {
21+
constructor(private winRef: Window, private debugId: string) {
2522
if (this.debugId) {
2623
const win = this.winRef as DebuggableWindow;
2724
const localStorageValue = win.localStorage.getItem(FSM_SHELL_DEBUG_KEY);
28-
if (!!localStorageValue && localStorageValue.split(',').some(it => it === debugId)) {
25+
if (
26+
!!localStorageValue &&
27+
localStorageValue.split(',').some((it) => it === debugId)
28+
) {
2929
this.debugMode = true;
3030
}
3131
}
3232
}
3333

34-
public traceEvent(direction: EventDirection, type: EventType, payload: any, routing: Routing, hasHandler: boolean) {
35-
if (this.debugMode && ALL_SHELL_EVENTS_ARRAY.some(it => it === type)) {
34+
public traceEvent(
35+
direction: EventDirection,
36+
type: EventType,
37+
payload: any,
38+
routing: Routing,
39+
hasHandler: boolean
40+
) {
41+
if (this.debugMode && ALL_SHELL_EVENTS_ARRAY.some((it) => it === type)) {
3642
const debugEvent: DebugEvent<any> = {
3743
timestamp: new Date(),
3844
component: this.debugId,
@@ -41,8 +47,9 @@ export class Debugger {
4147
handled: direction === 'incoming' ? (hasHandler ? 'yes' : 'no') : 'n/a',
4248
to: routing.to,
4349
from: routing.from,
44-
payload
45-
}
50+
trace: routing.trace,
51+
payload,
52+
};
4653
this.logEvent(debugEvent);
4754
}
4855
}
@@ -54,5 +61,4 @@ export class Debugger {
5461
}
5562
win.fsmShellMessageLogger.push(debugEvent, this.debugId);
5663
}
57-
5864
}

0 commit comments

Comments
 (0)