-
Notifications
You must be signed in to change notification settings - Fork 8.5k
[Monitoring] Ensure the settings api always return the xpack/default_admin_email #22220
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
[Monitoring] Ensure the settings api always return the xpack/default_admin_email #22220
Conversation
…ill returns a null value for default_admin_email
💚 Build Succeeded |
|
@chrisronline Conflicts! |
|
The functionality of the API as described in the test steps is good. However, with this change, the API will return a slightly different response than what the internal monitoring code in Kibana would ship to Monitoring. I believe the latter would never ship a document to Monitoring if the value of the email address is I wonder if we can get rid of the |
💚 Build Succeeded |
| default_admin_email: email | ||
| } | ||
| }; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the collector constructor spreads in any property given to it, we can make this function a part of the settings collector instance.
something like:
collectorSet.makeStatsCollector({
type: ...,
async fetch: ...,
getEmailValueStructure: email => ({
xpack: { default_admin_email: email }
})
})
In the line below where getEmailValueStructure is used in the fetch, it can use this.getEmailValueStructure(defaultAdminEmail)
| import { wrap as wrapError } from 'boom'; | ||
| import { KIBANA_SETTINGS_TYPE } from '../../../../../monitoring/common/constants'; | ||
| import { getKibanaInfoForStats } from '../../../../../monitoring/server/kibana_monitoring/lib'; | ||
| import { getEmailValueStructure } from '../../../../../monitoring/server/kibana_monitoring/collectors/get_settings_collector'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should be able to not have this import when getEmailValueStructure is a method of settingsCollector
tsullivan
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A suggestion to make the new function more handy, and not need the new import
|
@tsullivan Great suggestions! Updated now! |
💔 Build Failed |
|
Jenkins, test this |
💚 Build Succeeded |
tsullivan
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
I pulled down the branch and tested the API; refreshing a few times to ensure the same object is returned each time
…admin_email (elastic#22220) * If the settings collector returns nothing, ensure the settings api still returns a null value for default_admin_email * Update test * Feedback from PR
|
Backport: 6.x: 4fe840e |
Fixes #22107
This PR ensures that even if the kibana settings collector returns nothing, we still return an identical structure in the api response as if the kibana settings collector did return something.
To test:
/api/settingsendpointxpack: { default_admin_email: null }section./api/settingsendpoint