Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Squashed zoom:image and send:exception client events #7953

Merged
merged 9 commits into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions cvat-core/src/enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,7 @@ export enum EventScope {
undoAction = 'action:undo',
redoAction = 'action:redo',

pressShortcut = 'press:shortcut',
debugInfo = 'send:debug_info',
debugInfo = 'debug:info',

annotationsAction = 'run:annotations_action',
clickElement = 'click:element',
Expand Down
29 changes: 25 additions & 4 deletions cvat-core/src/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ interface IgnoreRule {
update: (previousEvent: Event, currentPayload: any) => object;
}

type IgnoredRules = EventScope.zoomImage | EventScope.changeAttribute | EventScope.changeFrame;
type IgnoredRules = (
EventScope.zoomImage | EventScope.changeAttribute |
EventScope.changeFrame | EventScope.exception
);

class Logger {
public clientID: string;
Expand All @@ -50,12 +53,30 @@ class Logger {
this.ignoreRules = {
[EventScope.zoomImage]: {
lastEvent: null,
timeThreshold: 4000,
ignore(previousEvent: Event): boolean {
return (Date.now() - previousEvent.timestamp.getTime()) < this.timeThreshold;
ignore: (previousEvent: Event): boolean => {
const [lastCollectionEvent] = this.collection.slice(-1);
return previousEvent === lastCollectionEvent;
},
update: defaultUpdate,
},
[EventScope.exception]: {
lastEvent: null,
ignore: (previousEvent: Event, currentPayload: any): boolean => {
const { stack } = currentPayload;
const [lastCollectionEvent] = this.collection.slice(-1);
return lastCollectionEvent === previousEvent &&
stack && stack === previousEvent.payload.stack;
},
update(previousEvent: Event): object {
const count = Number.isInteger(previousEvent.payload.count) ?
previousEvent.payload.count : 1;
return {
...previousEvent.payload,
count: count + 1,
lastTimestamp: new Date().toISOString(),
};
},
},
[EventScope.changeAttribute]: {
lastEvent: null,
ignore(previousEvent: Event, currentPayload: any): boolean {
Expand Down
15 changes: 11 additions & 4 deletions site/content/en/docs/administration/advanced/analytics.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,25 +133,32 @@ Client events:
- `load:cvat`

- `load:job`, `save:job`, `restore:job`

- `upload:annotations`

- `send:exception`

- `send:task_info`

- `draw:object`, `paste:object`, `copy:object`, `propagate:object`, `drag:object`, `resize:object`, `delete:object`, `lock:object`, `merge:objects`
- `draw:object`, `paste:object`, `copy:object`, `propagate:object`, `drag:object`, `resize:object`, `delete:object`, `lock:object`, `merge:objects`, `split:objects`, `group:objects`, `slice:object`,
`join:objects`

- `change:attribute`

- `change:label`

- `change:frame`

- `zoom:image`, `fit:image`, `rotate:image`

- `action:undo`, `action:redo`

- `press:shortcut`
- `send:debug_info`

- `run:annotations_action`

- `click:element`

- `debug:info`
klakhov marked this conversation as resolved.
Show resolved Hide resolved

<!--lint enable maximum-line-length-->

### Request `id` for tracking
Expand Down
Loading