Skip to content

[Part of #176153] Analytics client#179472

Merged
afharo merged 5 commits intoelastic:mainfrom
afharo:kbn-176153-analytics-client
Apr 1, 2024
Merged

[Part of #176153] Analytics client#179472
afharo merged 5 commits intoelastic:mainfrom
afharo:kbn-176153-analytics-client

Conversation

@afharo
Copy link
Copy Markdown
Member

@afharo afharo commented Mar 26, 2024

Summary

Part of #176153. Fixing the analytics client files.

For maintainers

@afharo afharo added chore Team:Core Platform Core services: plugins, logging, config, saved objects, http, ES client, i18n, etc t// release_note:skip Skip the PR/issue when compiling release notes backport:skip This PR does not require backporting labels Mar 26, 2024
@afharo afharo self-assigned this Mar 26, 2024
@afharo
Copy link
Copy Markdown
Member Author

afharo commented Mar 26, 2024

/ci

@afharo
Copy link
Copy Markdown
Member Author

afharo commented Mar 27, 2024

/ci

@afharo
Copy link
Copy Markdown
Member Author

afharo commented Mar 27, 2024

/ci

@afharo afharo marked this pull request as ready for review March 27, 2024 17:03
@afharo afharo requested a review from a team as a code owner March 27, 2024 17:03
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/kibana-core (Team:Core)

Copy link
Copy Markdown
Contributor

@jloleysens jloleysens left a comment

Choose a reason for hiding this comment

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

Approving to unblock progress, overall looks good to me. I'll leave the decision about the test up to you!

Comment on lines +111 to +113
function isObject(value: unknown): value is Record<string, unknown> {
return typeof value === 'object' && value !== null;
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not sure it's worth the trouble, but what do you think about moving this to shared lib like @kbn/std?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I thought about it. But we're thinking about porting this package to an independent NPM module. So I thought it might be better not to import other packages at this stage.

private removeEmptyValues(context?: Partial<EventContext>) {
if (!context) {
private removeEmptyValues(context: unknown) {
if (!isObject(context)) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do we need a test for this new behaviour?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It is tested (it tests if undefined is handled correctly). This was about fixing the types (and that forced me to add the type guard)

@afharo afharo enabled auto-merge (squash) April 1, 2024 13:00
@kibana-ci
Copy link
Copy Markdown

💛 Build succeeded, but was flaky

Failed CI Steps

Metrics [docs]

Page load bundle

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

id before after diff
core 405.4KB 405.4KB +35.0B

History

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

cc @afharo

@afharo afharo merged commit 6676348 into elastic:main Apr 1, 2024
@afharo afharo deleted the kbn-176153-analytics-client branch April 1, 2024 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting chore release_note:skip Skip the PR/issue when compiling release notes Team:Core Platform Core services: plugins, logging, config, saved objects, http, ES client, i18n, etc t// v8.14.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants