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

Converts usage collection README to .mdx #92982

Merged

Conversation

TinaHeiligers
Copy link
Contributor

Partially addresses #92193
Converts usage_collection/README to .mdx.

@TinaHeiligers TinaHeiligers added Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc enhancement New value added to drive a business result Feature:Telemetry v8.0.0 release_note:skip Skip the PR/issue when compiling release notes docs v7.13.0 labels Feb 27, 2021
@TinaHeiligers TinaHeiligers requested a review from a team as a code owner February 27, 2021 00:02
@elasticmachine
Copy link
Contributor

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

@TinaHeiligers
Copy link
Contributor Author

@elasticmachine merge upstream

@TinaHeiligers TinaHeiligers marked this pull request as draft February 27, 2021 20:26
@TinaHeiligers
Copy link
Contributor Author

@elasticmachine merge upstream

@TinaHeiligers TinaHeiligers force-pushed the usage-collection/mdx-docs branch from 5dcb71a to 1b2f3f4 Compare February 27, 2021 23:12
@TinaHeiligers TinaHeiligers marked this pull request as ready for review February 28, 2021 02:36
@TinaHeiligers TinaHeiligers requested a review from a team as a code owner March 1, 2021 16:11
@botelastic botelastic bot added the Team:APM All issues that need APM UI Team support label Mar 1, 2021
@elasticmachine
Copy link
Contributor

Pinging @elastic/apm-ui (Team:apm)

@@ -285,7 +285,7 @@ export class Plugin {

#### Usage Collection

For creating and registering a Usage Collector. Collectors should be defined in a separate directory `server/collectors/`. You can read more about usage collectors on `src/plugins/usage_collection/README.md`.
For creating and registering a Usage Collector. Collectors should be defined in a separate directory `server/collectors/`. You can read more about usage collectors on `src/plugins/usage_collection/README.mdx`.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated the links to the README

@TinaHeiligers TinaHeiligers enabled auto-merge (squash) March 1, 2021 16:20
Copy link
Contributor

@ogupte ogupte left a comment

Choose a reason for hiding this comment

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

Looks good!

@TinaHeiligers TinaHeiligers added the auto-backport Deprecated - use backport:version if exact versions are needed label Mar 1, 2021
Copy link
Member

@afharo afharo left a comment

Choose a reason for hiding this comment

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

2 small comments regarding the use of the double-space at the end of a line to break the line.

@@ -370,9 +379,9 @@ There are a few ways you can test that your usage collector is working properly.

## FAQ

1. **How should I design my data model?**
1. **How should I design my data model?**
Copy link
Member

Choose a reason for hiding this comment

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

The 2 spaces at the end of this line were intentional (same for point 2.):
image
Left: current master - Right: this PR

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My linter keeps removing the whitespace, so I had to put these changes back directly in Github.


- `MY_USAGE_TYPE` can be any string. It usually matches the plugin name. As a safety mechanism, we double check there are no duplicates at the moment of registering the collector.

- `isReady` (added in v7.2.0 and v6.8.4) is a way for a usage collector to announce that some async process must finish first before it can return data in the `fetch` method (e.g. a client needs to ne initialized, or the task manager needs to run a task first). If any collector reports that it is not ready when we call its `fetch` method, we reset a flag to try again and, after a set amount of time, collect data from those collectors that are ready and skip any that are not. This means that if a collector returns `true` for `isReady` and it actually isn't ready to return data, there won't be telemetry data from that collector in that telemetry report (usually once per day). You should consider what it means if your collector doesn't return data in the first few documents when Kibana starts or, if we should wait for any other reason (e.g. the task manager needs to run your task first). If you need to tell telemetry collection to wait, you should implement this function with custom logic. If your `fetch` method can run without the need of any previous dependencies, then you can return true for `isReady` as shown in the example below.

- The `fetch` method needs to support multiple contexts in which it is called. For example, when a user requests the example of what we collect in the **Kibana>Advanced Settings>Usage data** section, the clients provided in the context of the function (`CollectorFetchContext`) are scoped to that user's privileges. The reason is to avoid exposing via telemetry any data that user should not have access to (i.e.: if the user does not have access to certain indices, they shouldn't be allowed to see the number of documents that exists in it). In this case, the `fetch` method receives the clients `esClient` and `soClient` scoped to the user who performed the HTTP API request. Alternatively, when requesting the usage data to be reported to the Remote Telemetry Service, the clients are scoped to the internal Kibana user (`kibana_system`). Please, mind it might have lower-level access than the default super-admin `elastic` test user.
- The `fetch` method needs to support multiple contexts in which it is called. For example, when a user requests the example of what we collect in the **Kibana>Advanced Settings>Usage data** section, the clients provided in the context of the function (`CollectorFetchContext`) are scoped to that user's privileges. The reason is to avoid exposing via telemetry any data that user should not have access to (i.e.: if the user does not have access to certain indices, they shouldn't be allowed to see the number of documents that exists in it). In this case, the `fetch` method receives the clients `esClient` and `soClient` scoped to the user who performed the HTTP API request. Alternatively, when requesting the usage data to be reported to the Remote Telemetry Service, the clients are scoped to the internal Kibana user (`kibana_system`). Please, mind it might have lower-level access than the default super-admin `elastic` test user.
Copy link
Member

Choose a reason for hiding this comment

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

The 2 spaces at the end were intentional:
image
Left: master - Right: this PR

Copy link
Contributor Author

@TinaHeiligers TinaHeiligers Mar 1, 2021

Choose a reason for hiding this comment

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

My linter keeps removing the whitespace, so I had to put these changes back directly in Github. I'm using our standard linting config. @afharo do you have a recommendation on how to tell the linter to ignore these types of whitespace in VS Code?

Adds whites space back
@TinaHeiligers TinaHeiligers requested a review from afharo March 1, 2021 22:08
@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

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

Copy link
Member

@afharo afharo left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you for doing this! 🧡

@TinaHeiligers TinaHeiligers merged commit d7cac22 into elastic:master Mar 2, 2021
kibanamachine added a commit to kibanamachine/kibana that referenced this pull request Mar 2, 2021
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
@kibanamachine
Copy link
Contributor

💚 Backport successful

7.x / #93186

Successful backport PRs will be merged automatically after passing CI.

gmmorris added a commit to gmmorris/kibana that referenced this pull request Mar 2, 2021
* master: (42 commits)
  [Lens] Introduces new chart switcher (elastic#91844)
  [Lens] fix selection when dragging (elastic#93034)
  Converts usage collection README to .mdx (elastic#92982)
  Fix expanding document when using saved search data grid (elastic#92999)
  [SECURITY SOLUTIONS] Bug case connector (elastic#93104)
  [Security Solution] [Timeline] Bugfix to include unmapped fields in the timeline event details JSON (elastic#92025)
  [Alerting][Docs] Changed alerting documentation to point to a single source of explaining the configurations. (elastic#92942)
  [APM] Fix hidden search bar in error pages while loading (elastic#84476) (elastic#93139)
  [DOCS] Fixes links for machine learning alerts (elastic#92744)
  [Security Solution][Detections] -Fixes rule edit flow bug with max_signals (elastic#92748)
  [SecuritySolution][Case] Disable cases on detections in read-only mode (elastic#93010)
  [Security Solution][Case][Bug] Prevent closing collection when pushing (elastic#93095)
  [Security Solution][Detections][7.12] Critical Threshold Rule Fixes (elastic#92667)
  Bump ems landing page to 7.12 (elastic#93065)
  [App Search] Implement various Relevance Tuning states and form actions (elastic#92644)
  [actions] for simplistic email servers, set rejectUnauthorized to false (elastic#91760)
  [Security Solution][Case] Migrate category & subcategory fields of ServiceNow ITSM connector (elastic#93092)
  Hide instances latency distribution chart (elastic#92869)
  [Maps] fix MapboxDraw import from pointing to dist just pointing to folder (elastic#93087)
  [Maps] fix results trimmed tooltip message doubles feature count for line and polygon features (elastic#92932)
  ...
kibanamachine added a commit that referenced this pull request Mar 2, 2021
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Christiane (Tina) Heiligers <christiane.heiligers@elastic.co>
v1v added a commit to shahzad31/kibana that referenced this pull request Mar 2, 2021
… playwright-ftr-e2e

* 'playwright-ftr-e2e' of github.com:shahzad31/kibana: (38 commits)
  [chore] Enable core's eslint rule: `@ts-expect-error` (elastic#93086)
  [Lens] Introduces new chart switcher (elastic#91844)
  [Lens] fix selection when dragging (elastic#93034)
  Converts usage collection README to .mdx (elastic#92982)
  Fix expanding document when using saved search data grid (elastic#92999)
  [SECURITY SOLUTIONS] Bug case connector (elastic#93104)
  [Security Solution] [Timeline] Bugfix to include unmapped fields in the timeline event details JSON (elastic#92025)
  [Alerting][Docs] Changed alerting documentation to point to a single source of explaining the configurations. (elastic#92942)
  [APM] Fix hidden search bar in error pages while loading (elastic#84476) (elastic#93139)
  [DOCS] Fixes links for machine learning alerts (elastic#92744)
  [Security Solution][Detections] -Fixes rule edit flow bug with max_signals (elastic#92748)
  [SecuritySolution][Case] Disable cases on detections in read-only mode (elastic#93010)
  [Security Solution][Case][Bug] Prevent closing collection when pushing (elastic#93095)
  [Security Solution][Detections][7.12] Critical Threshold Rule Fixes (elastic#92667)
  Bump ems landing page to 7.12 (elastic#93065)
  [App Search] Implement various Relevance Tuning states and form actions (elastic#92644)
  [actions] for simplistic email servers, set rejectUnauthorized to false (elastic#91760)
  [Security Solution][Case] Migrate category & subcategory fields of ServiceNow ITSM connector (elastic#93092)
  Hide instances latency distribution chart (elastic#92869)
  [Maps] fix MapboxDraw import from pointing to dist just pointing to folder (elastic#93087)
  ...
@TinaHeiligers TinaHeiligers deleted the usage-collection/mdx-docs branch March 23, 2021 17:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Deprecated - use backport:version if exact versions are needed enhancement New value added to drive a business result Feature:Telemetry release_note:skip Skip the PR/issue when compiling release notes Team:APM All issues that need APM UI Team support Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc v7.13.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants