Skip to content

[API DOCS] Usage Collection#98656

Merged
afharo merged 5 commits intoelastic:masterfrom
afharo:api_docs/usageCollection
May 4, 2021
Merged

[API DOCS] Usage Collection#98656
afharo merged 5 commits intoelastic:masterfrom
afharo:api_docs/usageCollection

Conversation

@afharo
Copy link
Copy Markdown
Member

@afharo afharo commented Apr 28, 2021

Summary

This PR cleans up all the unused APIs exposed by the usageCollection plugin and documents the exposed ones.

When running node scripts/build_api_docs --plugin usageCollection --stats any --stats comments --stats exports we still get the following warnings.

 info --- Plugin 'usageCollection' ----`
 info 0 API items with ANY
┌─────────┐
│ (index) │
├─────────┤
└─────────┘
 info 1 API items missing comments
┌─────────┬──────────────────────────────────────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ (index) │                  id                  │                                                                         link                                                                         │
├─────────┼──────────────────────────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│    0    │ 'def-public.TrackApplicationView.$1' │ 'https://github.com/elastic/kibana/tree/master/src/plugins/usage_collection/public/components/track_application_view/track_application_view.tsx#L23' │
└─────────┴──────────────────────────────────────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

This is because the current tool is not able to link the JSDocs and the methods declared as const myFn = (prop) => arrowFnResult. (#98744)

Also, re SerializeCounterParams, it is exposed. I may need some help from @stacey-gammon to find out what is it that I'm missing 🥺 Nevermind, I found out it's because I was adding @internal to that interface's docs.

Checklist

  • Documentation was added for features that require explanation or tutorials

For maintainers

@afharo afharo added Team:Core Platform Core services: plugins, logging, config, saved objects, http, ES client, i18n, etc t// Feature:Telemetry release_note:skip Skip the PR/issue when compiling release notes Team:KibanaTelemetry v7.14.0 APIDocs labels Apr 28, 2021
Copy link
Copy Markdown
Member Author

@afharo afharo Apr 28, 2021

Choose a reason for hiding this comment

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

Removed as we're using import { METRIC_TYPE } from '@kbn/analytics' everywhere except in lens and the data plugins (which I changed in this PR).

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'm normalizing this import to how it's done everywhere else. This way we can avoid re-exporting it from the usageCollection plugin 😇

@afharo afharo force-pushed the api_docs/usageCollection branch 2 times, most recently from f4b4285 to e5227cc Compare April 28, 2021 17:40
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.

Normalizing this import so we don't need to re-export it from the usageCollection plugin

@afharo afharo force-pushed the api_docs/usageCollection branch from e5227cc to aa2bcad Compare April 28, 2021 17:50
@afharo afharo force-pushed the api_docs/usageCollection branch from aa2bcad to df43089 Compare April 29, 2021 09:06

export class NestedInside {
collector?: UsageCollector<Usage>;
collector?: Collector<Usage>;
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.

Using Collector as a general interface. Not exporting UsageCollector anymore. This will help in the future when/if we want to merge both entities back into one.

@afharo afharo marked this pull request as ready for review April 29, 2021 11:04
@afharo afharo requested a review from a team April 29, 2021 11:04
@afharo afharo requested review from a team as code owners April 29, 2021 11:04
@elasticmachine
Copy link
Copy Markdown
Contributor

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

@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/kibana-telemetry (Team:KibanaTelemetry)

@afharo afharo force-pushed the api_docs/usageCollection branch from e846e3d to fedf20b Compare April 29, 2021 11:23
Copy link
Copy Markdown
Contributor

@flash1293 flash1293 left a comment

Choose a reason for hiding this comment

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

Lens changes LGTM - great simplification!

Copy link
Copy Markdown
Contributor

@Dosant Dosant left a comment

Choose a reason for hiding this comment

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

app services code changes lgtm

@afharo afharo added the auto-backport Deprecated - use backport:version if exact versions are needed label Apr 30, 2021
@afharo afharo linked an issue Apr 30, 2021 that may be closed by this pull request
Copy link
Copy Markdown
Contributor

@pgayvallet pgayvallet left a comment

Choose a reason for hiding this comment

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

LGTM

export interface ICollectorOptionsFetchExtendedContext<WithKibanaRequest extends boolean> {
/**
* Set to `true` if your `fetch` method requires the `KibanaRequest` object to be added in its context {@link CollectorFetchContextWithRequest}.
* @remark You should fully understand acknowledge that by using the `KibanaRequest` in your collector, you need to ensure it should specially work without it because it won't be provided when building the telemetry payload actually sent to the remote telemetry service.
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.

NIT: You should fully understand acknowledge

* Unique string identifier for the collector
*/
type: string;
init?: Function;
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.

Any way to be more specific than Function?

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'm actually wondering if we could remove it (I believe this API is not used at all since it was never documented). I'll see if that statement is true :)

@kibanamachine
Copy link
Copy Markdown
Contributor

💚 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
usageCollection 46 1 -45

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
data 176.9KB 176.9KB -2.0B
lens 970.5KB 970.5KB +26.0B
total +24.0B

Public APIs missing exports

Total count of every type that is part of your API that should be exported but is not. This will cause broken links in the API documentation system. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats exports for more detailed information.

id before after diff
usageCollection 7 0 -7

Page load bundle

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

id before after diff
data 803.0KB 803.1KB +98.0B
lens 35.3KB 35.1KB -170.0B
usageCollection 8.4KB 8.3KB -127.0B
total -199.0B
Unknown metric groups

API count

id before after diff
usageCollection 53 42 -11

History

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

@afharo afharo merged commit 6d22f6f into elastic:master May 4, 2021
@afharo afharo deleted the api_docs/usageCollection branch May 4, 2021 11:32
@kibanamachine
Copy link
Copy Markdown
Contributor

💔 Backport failed

Status Branch Result
7.x Commit could not be cherrypicked due to conflicts

To backport manually run:
node scripts/backport --pr 98656

afharo added a commit to afharo/kibana that referenced this pull request May 4, 2021
# Conflicts:
#	api_docs/usage_collection.json
#	api_docs/usage_collection.mdx
@afharo
Copy link
Copy Markdown
Member Author

afharo commented May 4, 2021

Backport to 7.x: #99186

afharo added a commit that referenced this pull request May 4, 2021
# Conflicts:
#	api_docs/usage_collection.json
#	api_docs/usage_collection.mdx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

APIDocs auto-backport Deprecated - use backport:version if exact versions are needed Feature:Telemetry 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// v7.14.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Usage collection server setup/start types in API docs

7 participants