[ML] Trained Models: Count tests run against trained models#212927
[ML] Trained Models: Count tests run against trained models#212927rbrtj merged 10 commits intoelastic:mainfrom
Conversation
|
Pinging @elastic/ml-ui (:ml) |
There was a problem hiding this comment.
PR Overview
This PR adds UI counters to track the number of tests run against trained models (both success and failure) by updating usage events and passing the MlUsageCollection dependency to various inference modules.
- Added new ML usage event constants for test events in the constants file.
- Updated the inference classes and their constructors to accept and use MlUsageCollection.
- Modified UI components and service hooks to supply the new dependency to model inference instances.
Reviewed Changes
| File | Description |
|---|---|
| x-pack/platform/plugins/shared/ml/common/constants/usage_collection.ts | Adds new usage event constants for test counters. |
| x-pack/platform/plugins/shared/ml/public/application/model_management/test_models/models/inference_base.ts | Updates runInfer method to count test events using mlUsageCollection. |
| x-pack/platform/plugins/shared/ml/public/application/services/usage_collection.ts | Exports the MlUsageCollection type to support dependency injection. |
| x-pack/platform/plugins/shared/ml/public/application/model_management/test_models/selected_model.tsx | Retrieves and passes mlUsageCollection to the inference model constructors. |
| Other inference modules (ner, text classification, lang ident, text embedding, question answering, zero shot, text expansion, fill mask) | Their constructors are updated to receive mlUsageCollection and pass it to the superclass. |
Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (2)
x-pack/platform/plugins/shared/ml/common/constants/usage_collection.ts:15
- [nitpick] The constant name is plural (TESTED_TRAINED_MODELS) but its value is singular ('tested_trained_model'); consider aligning these for consistency.
TESTED_TRAINED_MODELS: 'tested_trained_model',
x-pack/platform/plugins/shared/ml/public/application/model_management/test_models/models/inference_base.ts:317
- Instead of using hardcoded event strings, consider using the defined constants (e.g., ML_USAGE_EVENT.TESTED_TRAINED_MODELS) to ensure consistency across the codebase.
this.mlUsageCollection.count('tested_trained_model');
There was a problem hiding this comment.
PR Overview
This PR integrates UI counters for tracking the number of tests run against trained models by adding new usage event constants and wiring up usage collection calls into the inference workflows.
- Added two new usage event constants (“tested_trained_model” and “test_failed_trained_model”) to support tracking the tests.
- Injected and utilized the mlUsageCollection dependency into various inference models to record UI counter events on success and error paths.
- Updated the usage collection service to export a type for mlUsageCollection, ensuring type consistency across the plugin.
Reviewed Changes
| File | Description |
|---|---|
| x-pack/platform/plugins/shared/ml/common/constants/usage_collection.ts | Added new usage event constants for tracking trained model tests. |
| x-pack/platform/plugins/shared/ml/public/application/model_management/test_models/models/inference_base.ts | Integrated mlUsageCollection counting in the runInfer method for both success and failure scenarios. |
| x-pack/platform/plugins/shared/ml/public/application/services/usage_collection.ts | Exported the MlUsageCollection type from the usage collection provider. |
| x-pack/platform/plugins/shared/ml/public/application/model_management/test_models/selected_model.tsx | Updated usage context extraction and passed mlUsageCollection to inference model constructors. |
| Other model files (text_embedding, ner, text_classification, lang_ident, question_answering, zero_shot_classification, text_expansion, fill_mask) | Updated constructors to accept the mlUsageCollection dependency and pass it on to their super class. |
Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.
| protected readonly inputType: INPUT_TYPE, | ||
| protected readonly deploymentId: string | ||
| protected readonly deploymentId: string, | ||
| protected readonly mlUsageCollection: MlUsageCollection |
There was a problem hiding this comment.
This isn't used in any of the derived classes and so could be private
| DEFAULT_INFERENCE_TIME_OUT | ||
| )) as unknown as TRawInferResponse; | ||
|
|
||
| this.mlUsageCollection.count('tested_trained_model'); |
There was a problem hiding this comment.
Although it's good to have counts for when testing has been performed. I think it would be a lot more valuable to also track additional information, such as the model type and pytorch task type.
There was a problem hiding this comment.
I assume we need event-based telemetry for that
There was a problem hiding this comment.
After short discussion with @peteharverson, we agreed to collect EBT events with all relevant data, updated in: 5704fb9
💚 Build Succeeded
Metrics [docs]Async chunks
Page load bundle
History
cc @rbrtj |
|
Starting backport for target branches: 8.x https://github.com/elastic/kibana/actions/runs/13764925902 |
…212927) Part of: elastic#200725 This PR adds UI Counters for tests (success and failed) run against trained models. (cherry picked from commit 6a184b4)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…12927) (#213727) # Backport This will backport the following commits from `main` to `8.x`: - [[ML] Trained Models: Count tests run against trained models (#212927)](#212927) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Robert Jaszczurek","email":"92210485+rbrtj@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-03-10T12:42:30Z","message":"[ML] Trained Models: Count tests run against trained models (#212927)\n\nPart of: https://github.com/elastic/kibana/issues/200725\nThis PR adds UI Counters for tests (success and failed) run against\ntrained models.","sha":"6a184b4b4bda6a510f07bf66faa4478c7fe9eb05","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":[":ml","release_note:skip","Feature:3rd Party Models","Team:ML","backport:version","v9.1.0","v8.19.0"],"title":"[ML] Trained Models: Count tests run against trained models","number":212927,"url":"https://github.com/elastic/kibana/pull/212927","mergeCommit":{"message":"[ML] Trained Models: Count tests run against trained models (#212927)\n\nPart of: https://github.com/elastic/kibana/issues/200725\nThis PR adds UI Counters for tests (success and failed) run against\ntrained models.","sha":"6a184b4b4bda6a510f07bf66faa4478c7fe9eb05"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/212927","number":212927,"mergeCommit":{"message":"[ML] Trained Models: Count tests run against trained models (#212927)\n\nPart of: https://github.com/elastic/kibana/issues/200725\nThis PR adds UI Counters for tests (success and failed) run against\ntrained models.","sha":"6a184b4b4bda6a510f07bf66faa4478c7fe9eb05"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Robert Jaszczurek <92210485+rbrtj@users.noreply.github.com>
…212927) Part of: elastic#200725 This PR adds UI Counters for tests (success and failed) run against trained models.
Part of: #200725
This PR adds EBT for tests (success and failed) run against trained models.