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

[APM] Extracting serviceGroupApiMethods to avoid duplication of code #149026

Merged
merged 1 commit into from Jan 18, 2023

Conversation

yngrdyn
Copy link
Contributor

@yngrdyn yngrdyn commented Jan 17, 2023

Closes #148280.

Changes

  • Created ApmApiClient type.
  • Extracted service groups api methods to reuse in save_service_groups and service_group_count tests.

@yngrdyn yngrdyn requested a review from a team as a code owner January 17, 2023 12:07
@yngrdyn yngrdyn added the release_note:skip Skip the PR/issue when compiling release notes label Jan 17, 2023
@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

✅ unchanged

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

Comment on lines +24 to +29
apmApiClient: ApmApiClient;
serviceGroupId?: string;
groupName: string;
kuery: string;
description?: string;
color?: string;
Copy link
Member

Choose a reason for hiding this comment

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

What about using the ServiceGroup type that already exist, and use a similar interface to this:

interface Options {
savedObjectsClient: SavedObjectsClientContract;
serviceGroupId?: string;
serviceGroup: ServiceGroup;
}

Suggested change
apmApiClient: ApmApiClient;
serviceGroupId?: string;
groupName: string;
kuery: string;
description?: string;
color?: string;
apmApiClient: ApmApiClient;
serviceGroupId?: string;
serviceGroup: ServiceGroup

Comment on lines +37 to +42
body: {
groupName,
kuery,
description,
color,
},
Copy link
Member

Choose a reason for hiding this comment

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

This would then be:

Suggested change
body: {
groupName,
kuery,
description,
color,
},
body: serviceGroup,

Copy link
Contributor Author

@yngrdyn yngrdyn Jan 18, 2023

Choose a reason for hiding this comment

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

I'm getting this
image

The only way to reuse the type is doing something like this
image

Should we still use it?

Copy link
Member

@sorenlouv sorenlouv left a comment

Choose a reason for hiding this comment

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

lgtm. Just a nit

@yngrdyn yngrdyn merged commit 74ba605 into elastic:main Jan 18, 2023
@kibanamachine kibanamachine added v8.7.0 backport:skip This commit does not require backporting labels Jan 18, 2023
wayneseymour pushed a commit to wayneseymour/kibana that referenced this pull request Jan 19, 2023
…lastic#149026)

Closes elastic#148280.

### Changes
- Created `ApmApiClient` type.
- Extracted service groups api methods to reuse in `save_service_groups`
and `service_group_count` tests.
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 v8.7.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[APM] Alerts count in service groups, leftovers
4 participants