# Backport
This will backport the following commits from `main` to `8.x`:
- [[APM] Use excluded data tiers setting
(#192373)](#192373)
<!--- Backport version: 8.9.8 -->
### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)
<!--BACKPORT [{"author":{"name":"Carlos
Crespo","email":"crespocarlos@users.noreply.github.com"},"sourceCommit":{"committedDate":"2024-09-23T15:59:08Z","message":"[APM]
Use excluded data tiers setting (#192373)\n\ncloses
[#190559](https://github.com/elastic/kibana/issues/190559)\r\n\r\n##
Summary\r\n\r\nThis PR updates the ES clients in APM to respect the
excluded tier\r\nconfiguration. When this config is set, the ES clients
will\r\nautomatically add a filter to exclude the specified tiers from
queries.\r\n\r\n<img width=\"600\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/9b0de76d-242c-4343-bc30-d5c787316f59\">\r\n\r\nAll
queries in APM should have the `_tier` filter
(via\r\n`get_apm_events_client`)\r\n<img width=\"600\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/c525602f-f239-4be8-99c4-65d617962656\">\r\n\r\nThis
change also affects alerting (via `alerting_es_client`)\r\n<img
width=\"600\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/750df4d7-5b49-4de5-9294-7afedf11d7e5\">\r\n\r\nAnd
it impacts the alerts column (via `get_apm_alert_client`)\r\n<img
width=\"600\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/44bd9129-1e72-4a3a-af32-d42a9cd9164d\">\r\n\r\n###
What won't automatically add a filter for `_tier`\r\n\r\n-
Embeddables\r\n- ML queries\r\n\r\n### How to test\r\n- Set the config
in Advanced Settings to exclude `data_frozen` and\r\n`data_cold`
(optional)\r\n- Navigate to APM and check the query `Inspect` to see if
the filter is\r\npresent.\r\n- Click through APM to confirm things still
work.\r\n- Create one of each type of APM alerts\r\n- Without the config
set, queries should not include the `_tier`
filter`\r\n\r\n---------\r\n\r\nCo-authored-by: Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"ee5ef8166b74041f359862f3f22e0eb491f1443c","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","apm","backport:prev-major","ci:project-deploy-observability","Team:obs-ux-infra_services","Team:obs-ux-management","v8.16.0"],"number":192373,"url":"https://github.com/elastic/kibana/pull/192373","mergeCommit":{"message":"[APM]
Use excluded data tiers setting (#192373)\n\ncloses
[#190559](https://github.com/elastic/kibana/issues/190559)\r\n\r\n##
Summary\r\n\r\nThis PR updates the ES clients in APM to respect the
excluded tier\r\nconfiguration. When this config is set, the ES clients
will\r\nautomatically add a filter to exclude the specified tiers from
queries.\r\n\r\n<img width=\"600\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/9b0de76d-242c-4343-bc30-d5c787316f59\">\r\n\r\nAll
queries in APM should have the `_tier` filter
(via\r\n`get_apm_events_client`)\r\n<img width=\"600\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/c525602f-f239-4be8-99c4-65d617962656\">\r\n\r\nThis
change also affects alerting (via `alerting_es_client`)\r\n<img
width=\"600\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/750df4d7-5b49-4de5-9294-7afedf11d7e5\">\r\n\r\nAnd
it impacts the alerts column (via `get_apm_alert_client`)\r\n<img
width=\"600\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/44bd9129-1e72-4a3a-af32-d42a9cd9164d\">\r\n\r\n###
What won't automatically add a filter for `_tier`\r\n\r\n-
Embeddables\r\n- ML queries\r\n\r\n### How to test\r\n- Set the config
in Advanced Settings to exclude `data_frozen` and\r\n`data_cold`
(optional)\r\n- Navigate to APM and check the query `Inspect` to see if
the filter is\r\npresent.\r\n- Click through APM to confirm things still
work.\r\n- Create one of each type of APM alerts\r\n- Without the config
set, queries should not include the `_tier`
filter`\r\n\r\n---------\r\n\r\nCo-authored-by: Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"ee5ef8166b74041f359862f3f22e0eb491f1443c"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","labelRegex":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/192373","number":192373,"mergeCommit":{"message":"[APM]
Use excluded data tiers setting (#192373)\n\ncloses
[#190559](https://github.com/elastic/kibana/issues/190559)\r\n\r\n##
Summary\r\n\r\nThis PR updates the ES clients in APM to respect the
excluded tier\r\nconfiguration. When this config is set, the ES clients
will\r\nautomatically add a filter to exclude the specified tiers from
queries.\r\n\r\n<img width=\"600\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/9b0de76d-242c-4343-bc30-d5c787316f59\">\r\n\r\nAll
queries in APM should have the `_tier` filter
(via\r\n`get_apm_events_client`)\r\n<img width=\"600\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/c525602f-f239-4be8-99c4-65d617962656\">\r\n\r\nThis
change also affects alerting (via `alerting_es_client`)\r\n<img
width=\"600\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/750df4d7-5b49-4de5-9294-7afedf11d7e5\">\r\n\r\nAnd
it impacts the alerts column (via `get_apm_alert_client`)\r\n<img
width=\"600\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/44bd9129-1e72-4a3a-af32-d42a9cd9164d\">\r\n\r\n###
What won't automatically add a filter for `_tier`\r\n\r\n-
Embeddables\r\n- ML queries\r\n\r\n### How to test\r\n- Set the config
in Advanced Settings to exclude `data_frozen` and\r\n`data_cold`
(optional)\r\n- Navigate to APM and check the query `Inspect` to see if
the filter is\r\npresent.\r\n- Click through APM to confirm things still
work.\r\n- Create one of each type of APM alerts\r\n- Without the config
set, queries should not include the `_tier`
filter`\r\n\r\n---------\r\n\r\nCo-authored-by: Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"ee5ef8166b74041f359862f3f22e0eb491f1443c"}},{"branch":"8.x","label":"v8.16.0","labelRegex":"^v8.16.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->
Co-authored-by: Carlos Crespo <crespocarlos@users.noreply.github.com>
closes #190559
Summary
This PR updates the ES clients in APM to respect the excluded tier configuration. When this config is set, the ES clients will automatically add a filter to exclude the specified tiers from queries.
All queries in APM should have the

_tierfilter (viaget_apm_events_client)This change also affects alerting (via

alerting_es_client)And it impacts the alerts column (via

get_apm_alert_client)What won't automatically add a filter for
_tierHow to test
data_frozenanddata_cold(optional)Inspectto see if the filter is present._tierfilter`