Skip to content

[ML] File upload: Adds ability to cancel file upload#241297

Merged
jgowdyelastic merged 19 commits intoelastic:mainfrom
jgowdyelastic:abort-file-upload
Nov 4, 2025
Merged

[ML] File upload: Adds ability to cancel file upload#241297
jgowdyelastic merged 19 commits intoelastic:mainfrom
jgowdyelastic:abort-file-upload

Conversation

@jgowdyelastic
Copy link
Member

@jgowdyelastic jgowdyelastic commented Oct 30, 2025

Adds the ability to cancel file analysis and upload.
Closes #238706

2025-10-30.14-51-27.2025-10-30.14_52_07.mp4

For file analysis, the cancellation functionality is part of the file delete. So deleting a file while it is being analysed will kill the analysis.

Analysis can be too fast to stop, so for testing it's recommended to throttle the network when selecting a file for analysis.

Also adds three new telemetry items: analysis_cancelled, upload_cancelled and session_cancelled.
To test telemetry locally, add telemetry.localShipper: true to kibana.dev.yml

Events can then be found in the ebt-kibana-browser index.

Filter for:
event_type: file_upload.file_analysis
event_type: file_upload.file_upload
event_type: file_upload.upload_session

@jgowdyelastic jgowdyelastic marked this pull request as ready for review October 31, 2025 12:02
@jgowdyelastic jgowdyelastic requested review from a team as code owners October 31, 2025 12:02
@elasticmachine
Copy link
Contributor

Pinging @elastic/ml-ui (:ml)

@jgowdyelastic jgowdyelastic marked this pull request as draft October 31, 2025 13:18
@jgowdyelastic jgowdyelastic marked this pull request as ready for review October 31, 2025 15:09
Copy link
Contributor

@peteharverson peteharverson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and LGTM. Confirmed I can see the new EBT events for the cancellations.

Copy link
Contributor

@rbrtj rbrtj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code LGTM, left one Q

Comment on lines 261 to 263
this.setStatus({
analysisStatus: STATUS.NOT_STARTED,
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this status here? Wouldn't aborting be sufficient, since the catch block in analyzeStandardFile sets analysisStatus to ABORTED?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should set the status here, but this is the wrong status and should be ABORTED
This function isn't currently used. I added it so we can abort all ongoing analysis from the FileUploadManager class. But nothing currently triggers that.

But this has made me realise that we do need to abort all analysis and uploads when the FileUploadManager destroy method is called.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated in b8fa90a

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
dataVisualizer 824 826 +2
esql 431 433 +2
fileUpload 326 328 +2
searchPlayground 419 421 +2
total +8

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
@kbn/file-upload 83 85 +2
@kbn/file-upload-common 161 165 +4
fileUpload 52 56 +4
total +10

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
dataVisualizer 598.4KB 601.8KB +3.5KB
esql 579.4KB 582.3KB +2.9KB
searchPlayground 235.0KB 235.0KB +6.0B
total +6.4KB

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
dataVisualizer 27.1KB 27.3KB +219.0B
fileUpload 20.1KB 20.7KB +584.0B
total +803.0B
Unknown metric groups

API count

id before after diff
@kbn/file-upload 83 85 +2
@kbn/file-upload-common 163 168 +5
fileUpload 52 56 +4
total +11

History

cc @jgowdyelastic

@jgowdyelastic jgowdyelastic merged commit 98d4a6c into elastic:main Nov 4, 2025
13 checks passed
wildemat pushed a commit to wildemat/kibana that referenced this pull request Nov 5, 2025
Adds the ability to cancel file analysis and upload. 
Closes elastic#238706


https://github.com/user-attachments/assets/e5464ae7-77bd-4b4e-bcb9-a55e7ac60c76

For file analysis, the cancellation functionality is part of the file
delete. So deleting a file while it is being analysed will kill the
analysis.

Analysis can be too fast to stop, so for testing it's recommended to
throttle the network when selecting a file for analysis.

Also adds three new telemetry items: `analysis_cancelled`,
`upload_cancelled` and `session_cancelled`.
To test telemetry locally, add `telemetry.localShipper: true` to
`kibana.dev.yml`

Events can then be found in the `ebt-kibana-browser` index.

Filter for:
`event_type: file_upload.file_analysis`
`event_type: file_upload.file_upload` 
`event_type: file_upload.upload_session`
viduni94 pushed a commit to viduni94/kibana that referenced this pull request Nov 5, 2025
Adds the ability to cancel file analysis and upload. 
Closes elastic#238706


https://github.com/user-attachments/assets/e5464ae7-77bd-4b4e-bcb9-a55e7ac60c76

For file analysis, the cancellation functionality is part of the file
delete. So deleting a file while it is being analysed will kill the
analysis.

Analysis can be too fast to stop, so for testing it's recommended to
throttle the network when selecting a file for analysis.

Also adds three new telemetry items: `analysis_cancelled`,
`upload_cancelled` and `session_cancelled`.
To test telemetry locally, add `telemetry.localShipper: true` to
`kibana.dev.yml`

Events can then be found in the `ebt-kibana-browser` index.

Filter for:
`event_type: file_upload.file_analysis`
`event_type: file_upload.file_upload` 
`event_type: file_upload.upload_session`
eokoneyo pushed a commit to eokoneyo/kibana that referenced this pull request Dec 2, 2025
Adds the ability to cancel file analysis and upload. 
Closes elastic#238706


https://github.com/user-attachments/assets/e5464ae7-77bd-4b4e-bcb9-a55e7ac60c76

For file analysis, the cancellation functionality is part of the file
delete. So deleting a file while it is being analysed will kill the
analysis.

Analysis can be too fast to stop, so for testing it's recommended to
throttle the network when selecting a file for analysis.

Also adds three new telemetry items: `analysis_cancelled`,
`upload_cancelled` and `session_cancelled`.
To test telemetry locally, add `telemetry.localShipper: true` to
`kibana.dev.yml`

Events can then be found in the `ebt-kibana-browser` index.

Filter for:
`event_type: file_upload.file_analysis`
`event_type: file_upload.file_upload` 
`event_type: file_upload.upload_session`
@peteharverson peteharverson changed the title [ML] File upload: Adding ability to cancel file upload Dec 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

5 participants