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

[ML] Single Metric Viewer: Enable cross-filtering for 'by', 'over' and 'partition' field values #193255

Conversation

rbrtj
Copy link
Contributor

@rbrtj rbrtj commented Sep 18, 2024

Summary

Enables cross-filtering for 'by', 'over' and 'partition' field values in the Single Metric Viewer.

Fixes #171932

Before:

Screen.Recording.2024-09-18.at.11.29.48.mov

After:

Screen.Recording.2024-09-27.at.10.59.38.mov

@rbrtj rbrtj changed the title [ML] Single Metric Viewer: Filter by field values for selected partition field value [ML] Single Metric Viewer: Filter 'by' field values for selected 'partition' field value Sep 18, 2024
@rbrtj rbrtj self-assigned this Sep 18, 2024
@rbrtj rbrtj added :ml Team:ML Team label for ML (also use :ml) release_note:enhancement Feature:Anomaly Detection ML anomaly detection v8.16.0 labels Sep 18, 2024
@rbrtj rbrtj marked this pull request as ready for review September 18, 2024 09:33
@rbrtj rbrtj requested a review from a team as a code owner September 18, 2024 09:33
@elasticmachine
Copy link
Contributor

Pinging @elastic/ml-ui (:ml)

@rbrtj rbrtj changed the title [ML] Single Metric Viewer: Filter 'by' field values for selected 'partition' field value [ML] Single Metric Viewer: Enable cross-filtering for 'by', 'over' and 'partition' field values Sep 24, 2024
@rbrtj rbrtj added the backport:prev-minor Backport to (8.x) the previous minor version (i.e. one version back from main) label Sep 24, 2024
@peteharverson
Copy link
Contributor

peteharverson commented Sep 24, 2024

Unrelated to the changes here, but testing with this job with 'by' and 'partition' fields, I noticed there is an issue to the way points are connected in the anomaly explorer charts when there is sparse data:

For example:

Screenshot 2024-09-24 at 12 32 28

Compared to the SMV chart, which correctly doesn't connect non-adjacent buckets:

Screenshot 2024-09-24 at 12 32 52

Job config used for testing:

"analysis_config": {
    "bucket_span": "3h",
    "detectors": [
      {
        "detector_description": "sum(bytes) by clientip partitionfield=method",
        "function": "sum",
        "field_name": "bytes",
        "by_field_name": "clientip",
        "partition_field_name": "method",
        "detector_index": 0
      },
      {
        "detector_description": "high_count by status partitionfield=method",
        "function": "high_count",
        "by_field_name": "status",
        "partition_field_name": "method",
        "detector_index": 1
      }
    ],
    "influencers": [
      "clientip",
      "method",
      "status"
    ],
    "model_prune_window": "30d"
  },

@peteharverson
Copy link
Contributor

Created #193885 to cover #193255 (comment).

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 latest changes and LGTM

Copy link
Contributor

@walterra walterra 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.

Copy link
Contributor

@darnautov darnautov left a comment

Choose a reason for hiding this comment

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

LGTM 🚀 Left some minor suggestions

@rbrtj rbrtj enabled auto-merge (squash) September 27, 2024 09:03
@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

Metrics [docs]

Async chunks

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

id before after diff
ml 4.6MB 4.6MB +410.0B

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @rbrtj

@rbrtj rbrtj merged commit 07290bf into elastic:main Sep 27, 2024
21 checks passed
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.x

https://github.com/elastic/kibana/actions/runs/11069036354

@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.x

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Sep 27, 2024
…#x27;, 'over' and 'partition' field values (#193255) (#194280)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[ML] Single Metric Viewer: Enable cross-filtering for 'by',
'over' and 'partition' field values
(#193255)](#193255)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Robert
Jaszczurek","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-09-27T10:30:53Z","message":"[ML]
Single Metric Viewer: Enable cross-filtering for 'by', 'over' and
'partition' field values (#193255)\n\n## Summary\r\n\r\nEnables
cross-filtering for 'by', 'over' and 'partition' field values in\r\nthe
Single Metric Viewer.\r\n\r\nFixes
[#171932](https://github.com/elastic/kibana/issues/171932)\r\n\r\nBefore:\r\n\r\n\r\nhttps://github.com/user-attachments/assets/9a279375-7d0b-4422-b9eb-644ae3c0d291\r\n\r\nAfter:\r\n\r\n\r\nhttps://github.com/user-attachments/assets/d86d0688-dc69-43f0-aa24-130ff38935e6","sha":"07290bfac955c7d62ba93b52d888499dd6006cf3","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:enhancement",":ml","Feature:Anomaly
Detection","v9.0.0","Team:ML","backport:prev-minor","v8.16.0"],"title":"[ML]
Single Metric Viewer: Enable cross-filtering for 'by', 'over' and
'partition' field
values","number":193255,"url":"https://github.com/elastic/kibana/pull/193255","mergeCommit":{"message":"[ML]
Single Metric Viewer: Enable cross-filtering for 'by', 'over' and
'partition' field values (#193255)\n\n## Summary\r\n\r\nEnables
cross-filtering for 'by', 'over' and 'partition' field values in\r\nthe
Single Metric Viewer.\r\n\r\nFixes
[#171932](https://github.com/elastic/kibana/issues/171932)\r\n\r\nBefore:\r\n\r\n\r\nhttps://github.com/user-attachments/assets/9a279375-7d0b-4422-b9eb-644ae3c0d291\r\n\r\nAfter:\r\n\r\n\r\nhttps://github.com/user-attachments/assets/d86d0688-dc69-43f0-aa24-130ff38935e6","sha":"07290bfac955c7d62ba93b52d888499dd6006cf3"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/193255","number":193255,"mergeCommit":{"message":"[ML]
Single Metric Viewer: Enable cross-filtering for 'by', 'over' and
'partition' field values (#193255)\n\n## Summary\r\n\r\nEnables
cross-filtering for 'by', 'over' and 'partition' field values in\r\nthe
Single Metric Viewer.\r\n\r\nFixes
[#171932](https://github.com/elastic/kibana/issues/171932)\r\n\r\nBefore:\r\n\r\n\r\nhttps://github.com/user-attachments/assets/9a279375-7d0b-4422-b9eb-644ae3c0d291\r\n\r\nAfter:\r\n\r\n\r\nhttps://github.com/user-attachments/assets/d86d0688-dc69-43f0-aa24-130ff38935e6","sha":"07290bfac955c7d62ba93b52d888499dd6006cf3"}},{"branch":"8.x","label":"v8.16.0","branchLabelMappingKey":"^v8.16.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Robert Jaszczurek <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:prev-minor Backport to (8.x) the previous minor version (i.e. one version back from main) Feature:Anomaly Detection ML anomaly detection :ml release_note:enhancement Team:ML Team label for ML (also use :ml) v8.16.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ML] Single Metric Viewer: Only show anomalous 'by' field values for selected 'partition' field value
7 participants