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

Return referenced by count with each action on the find API #49104

Merged
merged 9 commits into from Nov 1, 2019

Conversation

mikecote
Copy link
Contributor

@mikecote mikecote commented Oct 23, 2019

In this PR, I'm changing the action find APIs to always return the number of saved objects referencing an action. A new attribute of referencedByCount is returned for every action returned by the find API.

Assumptions:

  • Only the find API is returning this (only used by actions list so far)
  • Find API will always return this value (no flag necessary)
  • It uses the cluster client directly and returns the number of other objects referencing an action (including the ones you don't have access to, count only)

@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-stack-services (Team:Stack Services)

@elasticmachine

This comment has been minimized.

@mikecote mikecote changed the title Return referenced count with each action Return referenced by count with each action on the find API Oct 25, 2019
@@ -101,6 +106,9 @@ export function shim(
const initializerContext: ActionsPluginInitializerContext = {
logger: newPlatform.coreContext.logger,
config: {
kibana$: Rx.of({
index: server.config().get('kibana.index'),
}),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rudolf is this the proper assumption based on #46240 (comment)? I recall reading and mention it will eventually move to saved objects.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes that's our latest design. We initially thought kibana.index belongs to the Saved Objects domain and so should be exposed from there, but the way actions and spaces (and maybe others) use kibana.index it's become more like a tenant ID for having multiple kibana clusters share the same ES cluster. So it feels more like a global config than something limited to saved objects.

Copy link
Member

Choose a reason for hiding this comment

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

Ya, I'll be needing it for the event log, which is independent of actions and alerts (but those USE event log), and it generates ES resources that should match config.get('kibana.index'). So, having it in SO would be a little weird, since the event log doesn't use SO, and would only pre-req it to get the name of the kibana index.

@mikecote mikecote added release_note:skip Skip the PR/issue when compiling release notes v7.6.0 v8.0.0 labels Oct 25, 2019
@mikecote mikecote marked this pull request as ready for review October 25, 2019 12:39
@mikecote mikecote requested review from a team, bmcconaghy and pmuellr October 25, 2019 12:39
@elasticmachine

This comment has been minimized.

Copy link
Member

@pmuellr pmuellr left a comment

Choose a reason for hiding this comment

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

LGTM

@mikecote

This comment has been minimized.

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Copy link
Contributor

@bmcconaghy bmcconaghy left a comment

Choose a reason for hiding this comment

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

Code LGTM

@mikecote
Copy link
Contributor Author

mikecote commented Nov 1, 2019

@elasticmachine merge upstream

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@mikecote mikecote merged commit 2b6bd2f into elastic:master Nov 1, 2019
mikecote added a commit to mikecote/kibana that referenced this pull request Nov 1, 2019
…49104)

* Initial work

* .kibana index configurable, NP ready implementation

* Fix broken jest tests

* Fix broken functional tests

* Add functional test

* Cleanup actions_client.test.ts
mikecote added a commit that referenced this pull request Nov 1, 2019
…49970)

* Initial work

* .kibana index configurable, NP ready implementation

* Fix broken jest tests

* Fix broken functional tests

* Add functional test

* Cleanup actions_client.test.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Alerting release_note:skip Skip the PR/issue when compiling release notes review v7.6.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants