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

Get the assetClient ready for building inventory prototype #167692

Merged
merged 13 commits into from
Oct 4, 2023

Conversation

jasonrhodes
Copy link
Member

@jasonrhodes jasonrhodes commented Sep 29, 2023

Closes #167342

Summary

This PR adds to the asset manager's asset client so that it's ready to demo a new inventory prototype. Current updates include:

  • Refactoring types for clarity
  • Adds getServices method
  • Adds docs and tests for getServices method
  • Fixes "parent" handling for getServices call, it now accepts EAN (host:* or container:* only for now) regardless of backing source
  • Solidify error handling for existing methods, make sure all validation happens in server client for now
  • Remove forking on "lockedSource" (no more choosing between signals and assets, we'll move to a more mixed approach now)
  • Update API tests to remove forking on locked source
  • Add method to allow getting services for a given host, with tests and docs

@jasonrhodes jasonrhodes requested a review from a team as a code owner September 29, 2023 18:19
@apmmachine
Copy link
Contributor

🤖 GitHub comments

Expand to view the GitHub comments

Just comment with:

  • /oblt-deploy : Deploy a Kibana instance using the Observability test environments.
  • /oblt-deploy-serverless : Deploy a serverless Kibana instance using the Observability test environments.
  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@jasonrhodes jasonrhodes added the release_note:skip Skip the PR/issue when compiling release notes label Sep 29, 2023
@jasonrhodes jasonrhodes requested a review from a team as a code owner October 3, 2023 16:42
Copy link
Member

@jbudz jbudz left a comment

Choose a reason for hiding this comment

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

ftr_configs.yml

minimum_should_match: 1,
},
});
const { kind, id } = parseEan(options.parent);
Copy link
Contributor

@klacabane klacabane Oct 4, 2023

Choose a reason for hiding this comment

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

should we validate kind value as part of parseEan (caller can pass the supported types to the function), or here, maybe with a switch ? thinking the api consumer should know if the parameter was ignored

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 point. I think I'll explore this more as I develop the UI built on top of it, and see what makes the most sense.

'asset.ean': string;
'asset.id': string;
'asset.name'?: string;
export function validateGetHostsOptions(options: GetHostsOptions) {
Copy link
Contributor

Choose a reason for hiding this comment

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

function can also verify that from is before to

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 idea

Copy link
Member Author

Choose a reason for hiding this comment

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

I simplified things a bit since there is only one version of each function now, which also simplified validation. 34c6d1a

export class AssetsValidationError extends Error {
public statusCode: number;

constructor(message: string, { statusCode = 500 }: ErrorOptions = {}) {
Copy link
Contributor

Choose a reason for hiding this comment

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

(http semantics intensifies) should this default to 400 ?

Copy link
Member Author

Choose a reason for hiding this comment

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

lol, I was thinking about this like a ResponseError but specifically as a ValidationError, I think you're right.

Copy link
Contributor

@klacabane klacabane 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!

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
metricsDataAccess 14 16 +2

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
assetManager 2.2KB 2.3KB +90.0B
Unknown metric groups

API count

id before after diff
metricsDataAccess 14 16 +2

History

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

@jasonrhodes jasonrhodes merged commit 88b85eb into elastic:main Oct 4, 2023
@kibanamachine kibanamachine added v8.12.0 backport:skip This commit does not require backporting labels Oct 4, 2023
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 Feature:Asset Manager release_note:skip Skip the PR/issue when compiling release notes v8.12.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Asset Manager] Add getServices to public client
7 participants