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

[Fleet] Include hidden data streams in package upgrade #158654

Merged
merged 3 commits into from
May 31, 2023

Conversation

juliaElastic
Copy link
Contributor

@juliaElastic juliaElastic commented May 30, 2023

Summary

APM team reported an issue in 8.8 where some of their newer data streams were not rolled over as expected.
It turned out these are hidden data streams and those were not updated in Fleet when a new version of a package is installed.

To test:

url -XPOST -H 'content-type: application/zip' -H 'kbn-xsrf: true' http://localhost:5601/julia/api/fleet/epm/packages -u elastic:changeme --data-binary @apm-8.7.0.zip
  • Index a doc to apm datastream
POST metrics-apm.service_summary.10m-default/_doc
        {
          "@timestamp": "2023-05-30T07:50:00.000Z",
          "agent": {
            "name": "go"
          },
          "data_stream": {
            "dataset": "apm.service_summary.10m",
            "namespace": "default",
            "type": "metrics"
          },
          "ecs": {
            "version": "8.6.0-dev"
          },
          "event": {
            "agent_id_status": "missing",
            "ingested": "2023-05-30T07:57:12Z"
          },
          "metricset": {
            "interval": "10m",
            "name": "service_summary"
          },
          "observer": {
            "hostname": "047e282994fb",
            "type": "apm-server",
            "version": "8.7.0"
          },
          "processor": {
            "event": "metric",
            "name": "metric"
          },
             "service": {
            "language": {
              "name": "go"
            },
            "name": "___main_elastic_cloud_87_ilm_fix"
          }
        }
url -XPOST -H 'content-type: application/zip' -H 'kbn-xsrf: true' http://localhost:5601/julia/api/fleet/epm/packages -u elastic:changeme --data-binary @apm-8.8.0.zip
  • Expect that the hidden datastream is updated and rolls over on failures.
[2023-05-30T15:23:21.666+02:00][DEBUG][plugins.fleet] Updating mappings for metrics-apm.service_summary.10m-default
[2023-05-30T15:23:21.670+02:00][ERROR][plugins.fleet] Mappings update for metrics-apm.service_summary.10m-default failed
[2023-05-30T15:23:21.671+02:00][ERROR][plugins.fleet] ResponseError: illegal_argument_exception
        Root causes:
                illegal_argument_exception: Mapper for [processor.name] conflicts with existing mapper:
        Cannot update parameter [value] from [metric] to [null]
image image

Added integration test.

Checklist

@juliaElastic juliaElastic self-assigned this May 30, 2023
@juliaElastic juliaElastic requested a review from a team as a code owner May 30, 2023 12:44
@botelastic botelastic bot added the Team:Fleet Team label for Observability Data Collection Fleet team label May 30, 2023
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

@apmmachine
Copy link
Contributor

🤖 GitHub comments

Expand to view the GitHub comments

Just comment with:

  • /oblt-deploy : Deploy a Kibana instance using the Observability test environments.
  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

Copy link
Member

@carsonip carsonip left a comment

Choose a reason for hiding this comment

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

fix lgtm. Should be good with tests, as mentioned in your TODO.

@@ -605,6 +605,7 @@ const getDataStreams = async (

const body = await esClient.indices.getDataStream({
name: indexTemplate.index_patterns.join(','),
expand_wildcards: ['open', 'hidden'],
Copy link
Member

Choose a reason for hiding this comment

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

Actually I'm thinking should it be a comma separated string instead? Not too sure about js esclient interface.

Suggested change
expand_wildcards: ['open', 'hidden'],
expand_wildcards: 'open,hidden',

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried that but it has to be an array in ts:

export declare type ExpandWildcard = 'all' | 'open' | 'closed' | 'hidden' | 'none';
export declare type ExpandWildcards = ExpandWildcard | ExpandWildcard[];

@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] Fleet Cypress Tests / View agents list Agent status filter should filter on healthy (16 result)
  • [job] [logs] Fleet Cypress Tests / View agents list Agent status filter should filter on healthy and unhealthy
  • [job] [logs] Fleet Cypress Tests / View agents list Agent status filter should filter on unhealthy (1 result)
  • [job] [logs] Fleet Cypress Tests / View agents list Bulk actions should allow to bulk upgrade agents and cancel that upgrade

Metrics [docs]

Unknown metric groups

ESLint disabled line counts

id before after diff
enterpriseSearch 19 21 +2
securitySolution 401 405 +4
total +6

Total ESLint disabled count

id before after diff
enterpriseSearch 20 22 +2
securitySolution 481 485 +4
total +6

History

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

cc @juliaElastic

@juliaElastic juliaElastic merged commit 58e0fdf into elastic:main May 31, 2023
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request May 31, 2023
## Summary

APM team reported an issue in 8.8 where some of their newer data streams
were not rolled over as expected.
It turned out these are hidden data streams and those were not updated
in Fleet when a new version of a package is installed.

To test:
- Start up a kibana
- Install apm 8.7.0 package
[apm-8.7.0.zip](https://github.com/elastic/kibana/files/11600335/apm-8.7.0.zip)
```
url -XPOST -H 'content-type: application/zip' -H 'kbn-xsrf: true' http://localhost:5601/julia/api/fleet/epm/packages -u elastic:changeme --data-binary @apm-8.7.0.zip
```
- Index a doc to apm datastream
```
POST metrics-apm.service_summary.10m-default/_doc
        {
          "@timestamp": "2023-05-30T07:50:00.000Z",
          "agent": {
            "name": "go"
          },
          "data_stream": {
            "dataset": "apm.service_summary.10m",
            "namespace": "default",
            "type": "metrics"
          },
          "ecs": {
            "version": "8.6.0-dev"
          },
          "event": {
            "agent_id_status": "missing",
            "ingested": "2023-05-30T07:57:12Z"
          },
          "metricset": {
            "interval": "10m",
            "name": "service_summary"
          },
          "observer": {
            "hostname": "047e282994fb",
            "type": "apm-server",
            "version": "8.7.0"
          },
          "processor": {
            "event": "metric",
            "name": "metric"
          },
             "service": {
            "language": {
              "name": "go"
            },
            "name": "___main_elastic_cloud_87_ilm_fix"
          }
        }
```
- Install apm 8.8.0 package
[apm-8.8.0.zip](https://github.com/elastic/kibana/files/11599946/apm-8.8.0.zip)
```
url -XPOST -H 'content-type: application/zip' -H 'kbn-xsrf: true' http://localhost:5601/julia/api/fleet/epm/packages -u elastic:changeme --data-binary @apm-8.8.0.zip
```
- Expect that the hidden datastream is updated and rolls over on
failures.

```
[2023-05-30T15:23:21.666+02:00][DEBUG][plugins.fleet] Updating mappings for metrics-apm.service_summary.10m-default
[2023-05-30T15:23:21.670+02:00][ERROR][plugins.fleet] Mappings update for metrics-apm.service_summary.10m-default failed
[2023-05-30T15:23:21.671+02:00][ERROR][plugins.fleet] ResponseError: illegal_argument_exception
        Root causes:
                illegal_argument_exception: Mapper for [processor.name] conflicts with existing mapper:
        Cannot update parameter [value] from [metric] to [null]
```

<img width="995" alt="image"
src="https://github.com/elastic/kibana/assets/90178898/6a5a1abc-30f2-4b2f-a949-5b727cc91f57">
<img width="1175" alt="image"
src="https://github.com/elastic/kibana/assets/90178898/8e18c40f-6b7f-4810-a9e4-9685a7fa5d0c">

Added integration test.

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

(cherry picked from commit 58e0fdf)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.8

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 May 31, 2023
#158698)

# Backport

This will backport the following commits from `main` to `8.8`:
- [[Fleet] Include hidden data streams in package upgrade
(#158654)](#158654)

<!--- Backport version: 8.9.7 -->

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

<!--BACKPORT [{"author":{"name":"Julia
Bardi","email":"90178898+juliaElastic@users.noreply.github.com"},"sourceCommit":{"committedDate":"2023-05-31T07:50:42Z","message":"[Fleet]
Include hidden data streams in package upgrade (#158654)\n\n##
Summary\r\n\r\nAPM team reported an issue in 8.8 where some of their
newer data streams\r\nwere not rolled over as expected.\r\nIt turned out
these are hidden data streams and those were not updated\r\nin Fleet
when a new version of a package is installed.\r\n\r\nTo test:\r\n- Start
up a kibana\r\n- Install apm 8.7.0
package\r\n[apm-8.7.0.zip](https://github.com/elastic/kibana/files/11600335/apm-8.7.0.zip)\r\n```\r\nurl
-XPOST -H 'content-type: application/zip' -H 'kbn-xsrf: true'
http://localhost:5601/julia/api/fleet/epm/packages -u elastic:changeme
--data-binary @apm-8.7.0.zip\r\n```\r\n- Index a doc to apm
datastream\r\n```\r\nPOST
metrics-apm.service_summary.10m-default/_doc\r\n {\r\n \"@timestamp\":
\"2023-05-30T07:50:00.000Z\",\r\n \"agent\": {\r\n \"name\": \"go\"\r\n
},\r\n \"data_stream\": {\r\n \"dataset\":
\"apm.service_summary.10m\",\r\n \"namespace\": \"default\",\r\n
\"type\": \"metrics\"\r\n },\r\n \"ecs\": {\r\n \"version\":
\"8.6.0-dev\"\r\n },\r\n \"event\": {\r\n \"agent_id_status\":
\"missing\",\r\n \"ingested\": \"2023-05-30T07:57:12Z\"\r\n },\r\n
\"metricset\": {\r\n \"interval\": \"10m\",\r\n \"name\":
\"service_summary\"\r\n },\r\n \"observer\": {\r\n \"hostname\":
\"047e282994fb\",\r\n \"type\": \"apm-server\",\r\n \"version\":
\"8.7.0\"\r\n },\r\n \"processor\": {\r\n \"event\": \"metric\",\r\n
\"name\": \"metric\"\r\n },\r\n \"service\": {\r\n \"language\": {\r\n
\"name\": \"go\"\r\n },\r\n \"name\":
\"___main_elastic_cloud_87_ilm_fix\"\r\n }\r\n }\r\n```\r\n- Install apm
8.8.0
package\r\n[apm-8.8.0.zip](https://github.com/elastic/kibana/files/11599946/apm-8.8.0.zip)\r\n```\r\nurl
-XPOST -H 'content-type: application/zip' -H 'kbn-xsrf: true'
http://localhost:5601/julia/api/fleet/epm/packages -u elastic:changeme
--data-binary @apm-8.8.0.zip\r\n```\r\n- Expect that the hidden
datastream is updated and rolls over
on\r\nfailures.\r\n\r\n```\r\n[2023-05-30T15:23:21.666+02:00][DEBUG][plugins.fleet]
Updating mappings for
metrics-apm.service_summary.10m-default\r\n[2023-05-30T15:23:21.670+02:00][ERROR][plugins.fleet]
Mappings update for metrics-apm.service_summary.10m-default
failed\r\n[2023-05-30T15:23:21.671+02:00][ERROR][plugins.fleet]
ResponseError: illegal_argument_exception\r\n Root causes:\r\n
illegal_argument_exception: Mapper for [processor.name] conflicts with
existing mapper:\r\n Cannot update parameter [value] from [metric] to
[null]\r\n```\r\n\r\n<img width=\"995\"
alt=\"image\"\r\nsrc=\"https://github.com/elastic/kibana/assets/90178898/6a5a1abc-30f2-4b2f-a949-5b727cc91f57\">\r\n<img
width=\"1175\"
alt=\"image\"\r\nsrc=\"https://github.com/elastic/kibana/assets/90178898/8e18c40f-6b7f-4810-a9e4-9685a7fa5d0c\">\r\n\r\nAdded
integration test.\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios","sha":"58e0fdf096df0af53e5902ee9da9cc5c63d77847","branchLabelMapping":{"^v8.9.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:Fleet","v8.9.0","v8.8.1"],"number":158654,"url":"https://github.com/elastic/kibana/pull/158654","mergeCommit":{"message":"[Fleet]
Include hidden data streams in package upgrade (#158654)\n\n##
Summary\r\n\r\nAPM team reported an issue in 8.8 where some of their
newer data streams\r\nwere not rolled over as expected.\r\nIt turned out
these are hidden data streams and those were not updated\r\nin Fleet
when a new version of a package is installed.\r\n\r\nTo test:\r\n- Start
up a kibana\r\n- Install apm 8.7.0
package\r\n[apm-8.7.0.zip](https://github.com/elastic/kibana/files/11600335/apm-8.7.0.zip)\r\n```\r\nurl
-XPOST -H 'content-type: application/zip' -H 'kbn-xsrf: true'
http://localhost:5601/julia/api/fleet/epm/packages -u elastic:changeme
--data-binary @apm-8.7.0.zip\r\n```\r\n- Index a doc to apm
datastream\r\n```\r\nPOST
metrics-apm.service_summary.10m-default/_doc\r\n {\r\n \"@timestamp\":
\"2023-05-30T07:50:00.000Z\",\r\n \"agent\": {\r\n \"name\": \"go\"\r\n
},\r\n \"data_stream\": {\r\n \"dataset\":
\"apm.service_summary.10m\",\r\n \"namespace\": \"default\",\r\n
\"type\": \"metrics\"\r\n },\r\n \"ecs\": {\r\n \"version\":
\"8.6.0-dev\"\r\n },\r\n \"event\": {\r\n \"agent_id_status\":
\"missing\",\r\n \"ingested\": \"2023-05-30T07:57:12Z\"\r\n },\r\n
\"metricset\": {\r\n \"interval\": \"10m\",\r\n \"name\":
\"service_summary\"\r\n },\r\n \"observer\": {\r\n \"hostname\":
\"047e282994fb\",\r\n \"type\": \"apm-server\",\r\n \"version\":
\"8.7.0\"\r\n },\r\n \"processor\": {\r\n \"event\": \"metric\",\r\n
\"name\": \"metric\"\r\n },\r\n \"service\": {\r\n \"language\": {\r\n
\"name\": \"go\"\r\n },\r\n \"name\":
\"___main_elastic_cloud_87_ilm_fix\"\r\n }\r\n }\r\n```\r\n- Install apm
8.8.0
package\r\n[apm-8.8.0.zip](https://github.com/elastic/kibana/files/11599946/apm-8.8.0.zip)\r\n```\r\nurl
-XPOST -H 'content-type: application/zip' -H 'kbn-xsrf: true'
http://localhost:5601/julia/api/fleet/epm/packages -u elastic:changeme
--data-binary @apm-8.8.0.zip\r\n```\r\n- Expect that the hidden
datastream is updated and rolls over
on\r\nfailures.\r\n\r\n```\r\n[2023-05-30T15:23:21.666+02:00][DEBUG][plugins.fleet]
Updating mappings for
metrics-apm.service_summary.10m-default\r\n[2023-05-30T15:23:21.670+02:00][ERROR][plugins.fleet]
Mappings update for metrics-apm.service_summary.10m-default
failed\r\n[2023-05-30T15:23:21.671+02:00][ERROR][plugins.fleet]
ResponseError: illegal_argument_exception\r\n Root causes:\r\n
illegal_argument_exception: Mapper for [processor.name] conflicts with
existing mapper:\r\n Cannot update parameter [value] from [metric] to
[null]\r\n```\r\n\r\n<img width=\"995\"
alt=\"image\"\r\nsrc=\"https://github.com/elastic/kibana/assets/90178898/6a5a1abc-30f2-4b2f-a949-5b727cc91f57\">\r\n<img
width=\"1175\"
alt=\"image\"\r\nsrc=\"https://github.com/elastic/kibana/assets/90178898/8e18c40f-6b7f-4810-a9e4-9685a7fa5d0c\">\r\n\r\nAdded
integration test.\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios","sha":"58e0fdf096df0af53e5902ee9da9cc5c63d77847"}},"sourceBranch":"main","suggestedTargetBranches":["8.8"],"targetPullRequestStates":[{"branch":"main","label":"v8.9.0","labelRegex":"^v8.9.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/158654","number":158654,"mergeCommit":{"message":"[Fleet]
Include hidden data streams in package upgrade (#158654)\n\n##
Summary\r\n\r\nAPM team reported an issue in 8.8 where some of their
newer data streams\r\nwere not rolled over as expected.\r\nIt turned out
these are hidden data streams and those were not updated\r\nin Fleet
when a new version of a package is installed.\r\n\r\nTo test:\r\n- Start
up a kibana\r\n- Install apm 8.7.0
package\r\n[apm-8.7.0.zip](https://github.com/elastic/kibana/files/11600335/apm-8.7.0.zip)\r\n```\r\nurl
-XPOST -H 'content-type: application/zip' -H 'kbn-xsrf: true'
http://localhost:5601/julia/api/fleet/epm/packages -u elastic:changeme
--data-binary @apm-8.7.0.zip\r\n```\r\n- Index a doc to apm
datastream\r\n```\r\nPOST
metrics-apm.service_summary.10m-default/_doc\r\n {\r\n \"@timestamp\":
\"2023-05-30T07:50:00.000Z\",\r\n \"agent\": {\r\n \"name\": \"go\"\r\n
},\r\n \"data_stream\": {\r\n \"dataset\":
\"apm.service_summary.10m\",\r\n \"namespace\": \"default\",\r\n
\"type\": \"metrics\"\r\n },\r\n \"ecs\": {\r\n \"version\":
\"8.6.0-dev\"\r\n },\r\n \"event\": {\r\n \"agent_id_status\":
\"missing\",\r\n \"ingested\": \"2023-05-30T07:57:12Z\"\r\n },\r\n
\"metricset\": {\r\n \"interval\": \"10m\",\r\n \"name\":
\"service_summary\"\r\n },\r\n \"observer\": {\r\n \"hostname\":
\"047e282994fb\",\r\n \"type\": \"apm-server\",\r\n \"version\":
\"8.7.0\"\r\n },\r\n \"processor\": {\r\n \"event\": \"metric\",\r\n
\"name\": \"metric\"\r\n },\r\n \"service\": {\r\n \"language\": {\r\n
\"name\": \"go\"\r\n },\r\n \"name\":
\"___main_elastic_cloud_87_ilm_fix\"\r\n }\r\n }\r\n```\r\n- Install apm
8.8.0
package\r\n[apm-8.8.0.zip](https://github.com/elastic/kibana/files/11599946/apm-8.8.0.zip)\r\n```\r\nurl
-XPOST -H 'content-type: application/zip' -H 'kbn-xsrf: true'
http://localhost:5601/julia/api/fleet/epm/packages -u elastic:changeme
--data-binary @apm-8.8.0.zip\r\n```\r\n- Expect that the hidden
datastream is updated and rolls over
on\r\nfailures.\r\n\r\n```\r\n[2023-05-30T15:23:21.666+02:00][DEBUG][plugins.fleet]
Updating mappings for
metrics-apm.service_summary.10m-default\r\n[2023-05-30T15:23:21.670+02:00][ERROR][plugins.fleet]
Mappings update for metrics-apm.service_summary.10m-default
failed\r\n[2023-05-30T15:23:21.671+02:00][ERROR][plugins.fleet]
ResponseError: illegal_argument_exception\r\n Root causes:\r\n
illegal_argument_exception: Mapper for [processor.name] conflicts with
existing mapper:\r\n Cannot update parameter [value] from [metric] to
[null]\r\n```\r\n\r\n<img width=\"995\"
alt=\"image\"\r\nsrc=\"https://github.com/elastic/kibana/assets/90178898/6a5a1abc-30f2-4b2f-a949-5b727cc91f57\">\r\n<img
width=\"1175\"
alt=\"image\"\r\nsrc=\"https://github.com/elastic/kibana/assets/90178898/8e18c40f-6b7f-4810-a9e4-9685a7fa5d0c\">\r\n\r\nAdded
integration test.\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios","sha":"58e0fdf096df0af53e5902ee9da9cc5c63d77847"}},{"branch":"8.8","label":"v8.8.1","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

---------

Co-authored-by: Julia Bardi <90178898+juliaElastic@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release_note:fix Team:Fleet Team label for Observability Data Collection Fleet team v8.8.1 v8.9.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants