Skip to content

[Ingest Manager] Remove success: true as top-level API response#73223

Merged
jfsiii merged 22 commits intoelastic:masterfrom
jfsiii:73221-remove-success
Sep 2, 2020
Merged

[Ingest Manager] Remove success: true as top-level API response#73223
jfsiii merged 22 commits intoelastic:masterfrom
jfsiii:73221-remove-success

Conversation

@jfsiii
Copy link
Copy Markdown
Contributor

@jfsiii jfsiii commented Jul 25, 2020

Summary

Implementation resulting from proposal/discussion at #73221

Key changes

Deleted top-level success property from all responses except

  1. /check-permissions (spec & handler). I figured we'd leave this as-is and make any changes in separate pass
  2. in array of objects returned by /package_configs/delete (spec & service)

Open issues/questions

There are a few endpoints where the only response was success: true leaving them empty now. I'm not sure how I, or others, feel about this.

  1. agent unenroll spec & handler
  2. agent reassign spec & handler

Some tests only looked for 200 code & success property so deleting them means we only check for 200. e.g. https://github.com/elastic/kibana/pull/73223/files#diff-a1f7d4ab42c35079093986e3068feb23 Perhaps that's ok, or perhaps we could update them to look for item or some other expected property.

update: only server/routes/agent/{acks,actions}_handlers.test.ts tests reference the success property. IMO, removing it from them doesn't affect the tests other than to reflect the correct payload.

Left in check-permissions and in array of objects returned by delete package configs
@jfsiii jfsiii changed the title Big bang commit removing top-level success property in API response [Ingest Manager] Remove success: true as top-level API response Jul 25, 2020
@jfsiii
Copy link
Copy Markdown
Contributor Author

jfsiii commented Jul 28, 2020

@elasticmachine merge upstream

@jfsiii jfsiii marked this pull request as ready for review July 28, 2020 18:09
@jfsiii jfsiii requested a review from a team as a code owner July 28, 2020 18:09
@jfsiii jfsiii requested a review from a team July 28, 2020 18:09
@jfsiii jfsiii requested a review from a team as a code owner July 28, 2020 18:09
@botelastic botelastic bot added the Team:Fleet Team label for Observability Data Collection Fleet team label Jul 28, 2020
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/ingest-management (Team:Ingest Management)

@jfsiii jfsiii added release_note:skip Skip the PR/issue when compiling release notes v7.10.0 v8.0.0 labels Jul 28, 2020
@nchaulet
Copy link
Copy Markdown
Member

@michalpristas @blakerouse Are you using the success field in the agent?

@ph
Copy link
Copy Markdown
Contributor

ph commented Jul 28, 2020

There are a few places that we rely on Success but not much, we could remove it, most of the code already depends on HTTP code

elastic/beats#20288

@jfsiii
Copy link
Copy Markdown
Contributor Author

jfsiii commented Jul 28, 2020

@elasticmachine merge upstream

@jfsiii
Copy link
Copy Markdown
Contributor Author

jfsiii commented Jul 29, 2020

@elasticmachine merge upstream

@jfsiii
Copy link
Copy Markdown
Contributor Author

jfsiii commented Jul 29, 2020

@elasticmachine merge upstream

@jfsiii
Copy link
Copy Markdown
Contributor Author

jfsiii commented Jul 29, 2020

@elasticmachine merge upstream

@jfsiii
Copy link
Copy Markdown
Contributor Author

jfsiii commented Aug 5, 2020

@elasticmachine merge upstream

@jfsiii
Copy link
Copy Markdown
Contributor Author

jfsiii commented Aug 27, 2020

Failing tests are unrelated to this code. Watch #75808 for fix

@jfsiii
Copy link
Copy Markdown
Contributor Author

jfsiii commented Aug 27, 2020

@elasticmachine merge upstream

@jfsiii
Copy link
Copy Markdown
Contributor Author

jfsiii commented Aug 27, 2020

@elasticmachine merge upstream

@jfsiii
Copy link
Copy Markdown
Contributor Author

jfsiii commented Aug 27, 2020

@ph @michalpristas CI is 💚

Copy link
Copy Markdown
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.

🚀

@jfsiii
Copy link
Copy Markdown
Contributor Author

jfsiii commented Aug 27, 2020

@paul-tavares no worries at all. thanks for the 👀 Can you approve or ping the right people when you get a moment?

@jfsiii
Copy link
Copy Markdown
Contributor Author

jfsiii commented Aug 31, 2020

@elasticmachine merge upstream

@jfsiii jfsiii requested review from a user and EricDavisX August 31, 2020 15:11
Copy link
Copy Markdown
Contributor

@paul-tavares paul-tavares left a comment

Choose a reason for hiding this comment

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

LGTM - had one question around the use of node-fetch and whether more code is needed to determine API error response.

Also - given the discussions today around upgrades and the possibility of pre-v7.10 agents communicating with a newer version of Kibana - is this a safe change for them? (I think you said it was not being used by the Agent, so we should be OK)

@jfsiii
Copy link
Copy Markdown
Contributor Author

jfsiii commented Aug 31, 2020

@paul-tavares, Agent did need some changes but "not much", iiuc. @michalpristas did a PR elastic/beats#20449

I'll let @michalpristas or @blakerouse comment re: auto upgrades

const obj: PostAgentEnrollResponse = await res.json();

if (!obj.success) {
if (!res.ok) {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@jfsiii
Copy link
Copy Markdown
Contributor Author

jfsiii commented Sep 2, 2020

@elasticmachine merge upstream

@kibanamachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

Build metrics

async chunks size

id value diff baseline
ingestManager 1.1MB -272.0B 1.1MB

History

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

@jfsiii jfsiii merged commit 71b9ded into elastic:master Sep 2, 2020
jfsiii pushed a commit that referenced this pull request Sep 2, 2020
…) (#76542)

* Big bang commit removing top-level success property in API response

Left in check-permissions and in array of objects returned by delete package configs

* Remove success property from  mocks

* Resolve conflict from upstream changes

* Remove success property (after upstream merge)

* Remove more 'success'es after merging in upstream

* Remove success from some tests

* Remove success from OpenAPI spec

* Revert prior try/catch. Use res.ok

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
@jfsiii
Copy link
Copy Markdown
Contributor Author

jfsiii commented Sep 4, 2020

@ph @ruflin can/should this go to 7.9.2? It's not a big conceptual/functional change, but it does have a pretty large surface area. I was hoping to avoid merge conflicts later with the many places that still have success: true in 7.9.

@ph
Copy link
Copy Markdown
Contributor

ph commented Sep 4, 2020

@jfsiii I would prefer we do not backport that to 7.9.2. This has too many risks, we should keep 7.9.2 stable and really limit our backports to major issues.

mdelapenya added a commit to mdelapenya/e2e-testing that referenced this pull request Sep 9, 2020
mdelapenya added a commit to elastic/e2e-testing that referenced this pull request Sep 9, 2020
* fix: "success" was remove from response

See elastic/kibana#73223

* chore: double max timeout when waiting for agent's events

* chore: enrich error log message

* chore: add a descrciptive comment about dates as strings
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 Team:Fleet Team label for Observability Data Collection Fleet team v7.10.0 v8.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants