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] fix remote output health reporting if remote es output is default #178857

Merged
merged 8 commits into from
Mar 19, 2024

Conversation

juliaElastic
Copy link
Contributor

@juliaElastic juliaElastic commented Mar 18, 2024

Summary

Closes #177927

Replaced "default" with real output id in full agent policy. This fixes the issue that the remote es health reporting was incorrect if the output was set as default.

More explanation on the bug:
#177927 (comment)

To verify:

  • create a remote es output and set as default (both data and monitoring)
  • create an agent policy that uses default output
  • enroll an agent
  • expect that the agent sends system and elastic-agent metrics/logs to remote es
  • verify that the remote es health badge shows up on UI
image image

Checklist

@juliaElastic juliaElastic added the release_note:skip Skip the PR/issue when compiling release notes label Mar 18, 2024
@juliaElastic juliaElastic self-assigned this Mar 18, 2024
@juliaElastic juliaElastic requested a review from a team as a code owner March 18, 2024 12:20
@botelastic botelastic bot added the Team:Fleet Team label for Observability Data Collection Fleet team label Mar 18, 2024
@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.
  • /oblt-deploy-serverless : Deploy a serverless Kibana instance using the Observability test environments.
  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@nchaulet
Copy link
Member

@juliaElastic I am wondering if the proper fix would be to not send the output under the key default but use a the id here? wdyt?

@juliaElastic
Copy link
Contributor Author

juliaElastic commented Mar 18, 2024

I am wondering if the proper fix would be to not send the output under the key default but use a the id here? wdyt?

It would be cleaner to get rid of "default", though I wasn't sure if agent relies on it in any way. That said, we already use default ids when using non-default output ids, so it's probably safe to use output id instead of "default" every time. I'll change it, thanks for the tip.

@juliaElastic juliaElastic changed the title [Fleet] added output id to agent policy sent to fleet-server [Fleet] fix remote output health reporting if remote es output is default Mar 18, 2024
@@ -491,13 +490,8 @@ export function transformOutputToFullPolicyOutput(

/**
* Get id used in full agent policy (sent to the agents)
* we use "default" for the default policy to avoid breaking changes
Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed this logic, it was added in 8.0: #111002

@nchaulet do you remember what was the potential breaking change referred here?

Copy link
Member

Choose a reason for hiding this comment

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

I think in 7.x we required to have one default output elastic/fleet-server#713 it's probably not relevant anymore

@juliaElastic juliaElastic requested a review from a team as a code owner March 18, 2024 15:06
@botelastic botelastic bot added the Team:obs-ux-infra_services Observability Infrastructure & Services User Experience Team label Mar 18, 2024
@elasticmachine
Copy link
Contributor

Pinging @elastic/obs-ux-infra_services-team (Team:obs-ux-infra_services)

Copy link
Contributor

@cauemarcondes cauemarcondes left a comment

Choose a reason for hiding this comment

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

Obs infra services changes LGTM

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

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

cc @juliaElastic

Copy link
Member

@nchaulet nchaulet left a comment

Choose a reason for hiding this comment

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

Tested locally and LGTM 🚀

juliaElastic added a commit that referenced this pull request Mar 22, 2024
…arch type (#179218)

## Summary

Related to #178857 and
#177927

It seems that using output id instead of "default" in full agent policy
had a higher impact than expected. There are a few places where agent
relies on the name "default".
([This](elastic/elastic-agent#4454) and
[this](elastic/elastic-agent#4453) pr)
Because of this, doing a partial revert, to keep using "default" for
elasticsearch output type to avoid breaking change.
However, for other types, using the output id. This will fix the
original issue of remote output health reporting.
I think it is a rarely used feature to use a non-elasticsearch output as
default, so it shouldn't have a big impact to not use "default" output
name for those.

To verify:
- create a remote es output and set as default (both data and
monitoring)
- create an agent policy that uses default output 
- enroll an agent
- expect that the agent sends system and elastic-agent metrics/logs to
remote es
- verify that the remote es health badge shows up on UI
- set elasticsearch output back as default
- verify that the agent policy has it as "default" in outputs section

<img width="704" alt="image"
src="https://github.com/elastic/kibana/assets/90178898/ab46b00d-efc2-49e1-ad7f-9acd44b2a9e5">
<img width="1251" alt="image"
src="https://github.com/elastic/kibana/assets/90178898/a07c0d78-9126-43d9-bd0e-a4df193d7e78">
<img width="1791" alt="image"
src="https://github.com/elastic/kibana/assets/90178898/868a054b-2cae-42f3-8f60-f2bff3b29efd">

<img width="715" alt="image"
src="https://github.com/elastic/kibana/assets/90178898/721cd809-5f97-47e5-bf99-19f542d8ff83">



### 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
juliaElastic added a commit to juliaElastic/kibana that referenced this pull request Mar 26, 2024
juliaElastic added a commit to juliaElastic/kibana that referenced this pull request Mar 26, 2024
…arch type (elastic#179218)

## Summary

Related to elastic#178857 and
elastic#177927

It seems that using output id instead of "default" in full agent policy
had a higher impact than expected. There are a few places where agent
relies on the name "default".
([This](elastic/elastic-agent#4454) and
[this](elastic/elastic-agent#4453) pr)
Because of this, doing a partial revert, to keep using "default" for
elasticsearch output type to avoid breaking change.
However, for other types, using the output id. This will fix the
original issue of remote output health reporting.
I think it is a rarely used feature to use a non-elasticsearch output as
default, so it shouldn't have a big impact to not use "default" output
name for those.

To verify:
- create a remote es output and set as default (both data and
monitoring)
- create an agent policy that uses default output 
- enroll an agent
- expect that the agent sends system and elastic-agent metrics/logs to
remote es
- verify that the remote es health badge shows up on UI
- set elasticsearch output back as default
- verify that the agent policy has it as "default" in outputs section

<img width="704" alt="image"
src="https://github.com/elastic/kibana/assets/90178898/ab46b00d-efc2-49e1-ad7f-9acd44b2a9e5">
<img width="1251" alt="image"
src="https://github.com/elastic/kibana/assets/90178898/a07c0d78-9126-43d9-bd0e-a4df193d7e78">
<img width="1791" alt="image"
src="https://github.com/elastic/kibana/assets/90178898/868a054b-2cae-42f3-8f60-f2bff3b29efd">

<img width="715" alt="image"
src="https://github.com/elastic/kibana/assets/90178898/721cd809-5f97-47e5-bf99-19f542d8ff83">



### 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
juliaElastic added a commit that referenced this pull request Mar 26, 2024
…"default" for non-elasticsearch outputs) (#179406)

## Summary

Backport #178857 and
#179218 to 8.13
Closes #177927
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting release_note:skip Skip the PR/issue when compiling release notes Team:Fleet Team label for Observability Data Collection Fleet team Team:obs-ux-infra_services Observability Infrastructure & Services User Experience Team v8.14.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Fleet]: Status not updated for Remote Elasticsearch cluster when set to default and agent is connected.
7 participants