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

[Enterprise Search] Added App Search log settings routes #82162

Merged
merged 6 commits into from
Nov 3, 2020

Conversation

JasonStoltz
Copy link
Member

Summary

This PR adds server routes for App Search's log settings

Checklist

Delete any items that are not applicable to this PR.

For maintainers

@JasonStoltz JasonStoltz requested a review from a team October 30, 2020 16:38
Copy link
Contributor

@cee-chen cee-chen left a comment

Choose a reason for hiding this comment

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

I think my main change request is to simplify the file names from log_settings to just settings, all other comments are optional / food for thought

Comment on lines 33 to 37
async (context, request, response) => {
return enterpriseSearchRequestHandler.createRequest({
path: '/as/log_settings',
})(context, request, response);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Not a change request, just me wondering - do we want to simplify this to

Suggested change
async (context, request, response) => {
return enterpriseSearchRequestHandler.createRequest({
path: '/as/log_settings',
})(context, request, response);
}
enterpriseSearchRequestHandler.createRequest({
path: '/as/log_settings',
})

at all? Or do we like the more explicit curried function notation that we end up having to use on some more complex API endpoints?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah think we should. It simplifies the code and tests a bit.

Copy link
Member Author

Choose a reason for hiding this comment

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


import { IRouteDependencies } from '../../plugin';

const logSettingsSchema = schema.object({
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we anticipate multiple POST/PUT endpoints using this schema in the future? In the credentials router file, I pulled a var out to the top primarily because it was super complex & reused between 2 different endpoints - in this case we could just leave this explicitly on line 44.

But also no objections/no strong feelings if we like leaving it at the top of files so it's the first thing people see 🤷

Copy link
Member Author

Choose a reason for hiding this comment

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

@@ -41,6 +41,7 @@ import { appSearchTelemetryType } from './saved_objects/app_search/telemetry';
import { registerTelemetryUsageCollector as registerASTelemetryUsageCollector } from './collectors/app_search/telemetry';
import { registerEnginesRoute } from './routes/app_search/engines';
import { registerCredentialsRoutes } from './routes/app_search/credentials';
import { registerLogSettingsRoutes } from './routes/app_search/log_settings';
Copy link
Contributor

Choose a reason for hiding this comment

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

Just curious - do we need to specifically call this out as log_settings vs. just settings? I think I have a slight preference to simplifying this to just

Suggested change
import { registerLogSettingsRoutes } from './routes/app_search/log_settings';
import { registerSettingsRoutes } from './routes/app_search/settings';

I think that's fine because on the off-chance we add more non-ILM/log settings in the future that call different API endpoints, we can just continue to add more router APIs to the same file, and it's not a huge deal because they conceptually fall under the same "Settings" bucket.

Copy link
Member Author

Choose a reason for hiding this comment

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

@constancecchen Yeah I think that's a good suggestion, I'll change this file to be "settings"

Copy link
Member Author

Choose a reason for hiding this comment

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

import { registerLogSettingsRoutes } from './log_settings';

describe('log settings routes', () => {
describe('PUT /api/app_search/log_settings', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't have super strong feelings and this is not a blocker, but I might suggest generally putting ordering our GET endpoint to follow both user flow and the source code, and the PUT tests after

Copy link
Member Author

Choose a reason for hiding this comment

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

Good suggestion, I'll do that

Copy link
Member Author

Choose a reason for hiding this comment

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

@JasonStoltz JasonStoltz requested a review from cee-chen November 3, 2020 15:29
Copy link
Contributor

@cee-chen cee-chen left a comment

Choose a reason for hiding this comment

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

Looks great!

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

distributable file count

id before after diff
default 42705 42706 +1

History

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

@JasonStoltz JasonStoltz added release_note:skip Skip the PR/issue when compiling release notes v7.11.0 labels Nov 3, 2020
@JasonStoltz JasonStoltz merged commit 9259b1f into elastic:master Nov 3, 2020
@JasonStoltz JasonStoltz deleted the log-retention-routes branch November 3, 2020 17:57
JasonStoltz added a commit to JasonStoltz/kibana that referenced this pull request Nov 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release_note:skip Skip the PR/issue when compiling release notes v7.11.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants