Skip to content

Commit

Permalink
Severity Levels for Activity Tracking (#3909)
Browse files Browse the repository at this point in the history
  • Loading branch information
lbwexler authored Jan 21, 2025
1 parent 89c9a44 commit efc53d6
Show file tree
Hide file tree
Showing 6 changed files with 634 additions and 515 deletions.
10 changes: 10 additions & 0 deletions admin/columns/Tracking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@ export const browser: ColumnSpec = {
width: 100
};

export const severity: ColumnSpec = {
field: {
name: 'severity',
type: 'string',
isDimension: true,
aggregator: 'UNIQUE'
},
width: 80
};

export const category: ColumnSpec = {
field: {
name: 'category',
Expand Down
2 changes: 2 additions & 0 deletions admin/tabs/activity/tracking/ActivityTrackingModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ export class ActivityTrackingModel extends HoistModel {
fields: [
Col.browser.field,
Col.category.field,
Col.severity.field,
Col.correlationId.field,
Col.data.field,
{...(Col.dateCreated.field as FieldSpec), displayName: 'Timestamp'},
Expand Down Expand Up @@ -131,6 +132,7 @@ export class ActivityTrackingModel extends HoistModel {
{field: 'userAgent'},
{field: 'url', displayName: 'URL'},
{field: 'instance'},
{field: 'severity'},
{field: 'appVersion'},
{field: 'appEnvironment', displayName: 'Environment'}
]
Expand Down
1 change: 1 addition & 0 deletions admin/tabs/activity/tracking/detail/ActivityDetailModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export class ActivityDetailModel extends HoistModel {
{...Col.url},
{...Col.correlationId},
{...Col.instance, hidden},
{...Col.severity, hidden},
{...Col.elapsed},
{...Col.dateCreatedWithSec, displayName: 'Timestamp'}
]
Expand Down
16 changes: 13 additions & 3 deletions core/types/Interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,11 @@ export interface AppOptionSpec {
omit?: Thunkable<boolean>;
}

/**
* Severity levels for tracking. Default is 'INFO'.
*/
export type TrackSeverity = 'DEBUG' | 'INFO' | 'WARN';

/**
* Options for tracking activity on the server via TrackService.
*/
Expand All @@ -219,11 +224,16 @@ export interface TrackOptions {
logData?: boolean | string[];

/**
* Flag to indicate relative importance of activity.
* Default 'INFO'. Note, errors should be tracked via {@link XH.handleException}, which
* Flag to indicate relative importance of activity. Default 'INFO'.
*
* Allows conditional saving of messages depending on the currently active
* level configuration for the category/user. See HoistCore's 'TrackService' for
* more information.
*
* Note, errors should be tracked via {@link XH.handleException}, which
* will post to the server for dedicated logging if requested.
*/
severity?: string;
severity?: TrackSeverity;

/**
* Set to true to log this message only once during the current session. The category and
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
"@ag-grid-community/react": "31.x",
"@types/react": "18.x",
"@types/react-dom": "18.x",
"@xh/hoist-dev-utils": "9.x",
"@xh/hoist-dev-utils": "10.x",
"csstype": "3.x",
"eslint": "8.x",
"eslint-config-prettier": "9.x",
Expand Down
Loading

0 comments on commit efc53d6

Please sign in to comment.