Skip to content

Commit

Permalink
2617 console instrumentation (#2851)
Browse files Browse the repository at this point in the history
* Instrument Job editor

* Update CHANGELOG

* Update labels based on PR feedback.

* Change per PR feedback
  • Loading branch information
rorymckinley authored Jan 24, 2025
1 parent 42cf950 commit f0f6111
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ and this project adheres to
[#2495](https://github.com/OpenFn/lightning/issues/2495)
- Audit the provisioning of projects via the API
[#2718](https://github.com/OpenFn/lightning/issues/2718)
- Temporary instrumentation for JobEditor to help identify performance issues.
[#2617](https://github.com/OpenFn/lightning/issues/2617)

### Changed

Expand Down
15 changes: 15 additions & 0 deletions assets/js/job-editor/mount.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ export default {
// this.handleContentChange(this.currentContent);
},
mounted(this: JobEditorEntrypoint) {
instrumentStart('editor load');

window.jobEditor = this;

this._debouncedPushChange = pDebounce(this.pushChange, EDITOR_DEBOUNCE_MS);
Expand All @@ -76,6 +78,9 @@ export default {
}
this.setupObserver();
this.render();

instrumentFinish('editor load');

this.requestMetadata().then(() => this.render());
});
},
Expand Down Expand Up @@ -189,3 +194,13 @@ function checkAdaptorVersion(adaptor: string) {
);
}
}

function instrumentStart(label: string) {
console.debug(`${label} - start`, new Date().toISOString());
console.time(label);
}

function instrumentFinish(label: string) {
console.debug(`${label} - finish`, new Date().toISOString());
console.timeEnd(label);
}
4 changes: 4 additions & 0 deletions assets/js/workflow-editor/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,8 @@ export default {
});
},
getWorkflowParams() {
console.debug('get-initial-state pushed', new Date().toISOString());
console.time('workflow-params load');
this.pushEventTo(this.el, 'get-initial-state', {});
},
handleWorkflowParams({ workflow_params: payload }) {
Expand All @@ -239,6 +241,8 @@ export default {
}

this.maybeMountComponent();
console.debug('current-worflow-params processed', new Date().toISOString());
console.timeEnd('workflow-params load');
},
maybeMountComponent() {
if (!this._isMounting && !this.component) {
Expand Down

0 comments on commit f0f6111

Please sign in to comment.