[Security solution] Value report data view filtering fix #241682
Merged
+570
−30
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
I incorrectly believed that adding the
scopeId={SourcererScopeName.detections}property to theVisualizationEmbeddablecomponent would filter the queries on the value report page to search only the alerts index. However,useDataView(SourcererScopeName.detections)actually returns the full security solution data view. In order to only search the signals index, I added signal index filtering to all the AI value report lens visualizations. I also introduce a hook to provide a default signal index name, asuseSignalIndex()can return{ signalIndexName: null }.Steps to reproduce
adminorsoc_managerrole. Have alerts data and attack discoveries. Have additional non-alert events (I usedyarn start generate-logswithsecurity-documents-generator).Before fix:

The cost savings metric did not match the cost savings in the description. Additionally, time saved, alert filtering rate, and cost savings trend were incorrect.
After fix:

The cost savings metric matches the cost savings in the description. Time saved, alert filtering rate, and cost savings trend are now accurate.
Changes
helpers.ts):getAlertIndexFiltercreates index filters for lens attributessignalIndexNameparameter and integratedgetAlertIndexFilterin:alert_filtering_metric.tscost_savings_metric.tstime_saved_metric.tscost_savings_trend_area.tsuse_signal_index_with_default.tsx): Returns signal index name with fallback to.alerts-security.alerts-{spaceId}useSignalIndexWithDefaultto get alerts index namestatTypevalue to be correct