-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
SavedObjectsRepository.incrementCounter supports array of fields #84326
Conversation
Pinging @elastic/kibana-core (Team:Core) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
KibanaApp changes LGTM, didn't test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Telemetry changes LGTM!
* When using incrementCounter for collecting usage data, you need to ensure | ||
* that usage collection happens on a best-effort basis and doesn't | ||
* negatively affect your plugin or users (see the example): | ||
* - Swallow any exceptions thrown from the incrementCounter method and log | ||
* a message in development. | ||
* - Don't block your application on the incrementCounter method (e.g. | ||
* don't use `await`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I love this remark 🧡
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't that a bit misplaced though? I would expect that kind of comment/guidelines to be in the usage collection plugin's README instead of being documented in a core API?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah I agree, this doesn't really belong in the SavedObjectsRepository's documentation. But I everywhere where this method was called teams awaited this promise and I'm afraid they won't read the docs in the plugin's readme.
We could maybe move this to the usage data plugin's docs and add a link to the docs. Because the link will be from tsdocs -> markdown it might be best to link to the github url for that file. WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea, I would go with something like
When using incrementCounter for collecting usage data, you need to ensure
that usage collection happens on a best-effort basis and doesn't negatively
affect your plugin or users. Please refer to the [usage collection documentation](link) for more details.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Upgrade Assistant changes look good to me!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AppArch changes LGTM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM from Enterprise Search
* When using incrementCounter for collecting usage data, you need to ensure | ||
* that usage collection happens on a best-effort basis and doesn't | ||
* negatively affect your plugin or users (see the example): | ||
* - Swallow any exceptions thrown from the incrementCounter method and log | ||
* a message in development. | ||
* - Don't block your application on the incrementCounter method (e.g. | ||
* don't use `await`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't that a bit misplaced though? I would expect that kind of comment/guidelines to be in the usage collection plugin's README instead of being documented in a core API?
💚 Build SucceededMetrics [docs]
History
To update your PR or re-run it, just comment with: |
@rudolf We spoke offline about adding a flag to initialize specified fields to In addition to that: while implementing #80945, I've found another improvement we could make to the incrementCounter method. When a "legacy URL alias" is resolved, we want to increment a counter and update a timestamp. I thought I would mention it here in case you think it makes sense to add support for updating a timestamp field in this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
initialize
option changes LGTM
We could certainly add a parameter like For "legacy URL alias" do we require a generic public method on the repository (like incrementCounter/scriptedUpdate), or could we put this scripting inside the |
) (#84613) * SavedObjectsRepository.incrementCounter supports array of fields * Fix TS errors * Fix failing test * Ensure all the remarks make it into our documentation * SavedObjectsRepository.incrementCounter initialize option * Move usage collection-specific docs out of repository into usage collection plugins readme * Update api docs * Polish generated docs
Good point, we don't really need a generic public method for this! |
@rudolf how do I test this please? Thanks! |
@bhavyarm this changes the shape and functionality of an API that I think is exclusively used for telemetry so there's no user-facing changes that can be tested. |
Plugin API changes
The SavedObjectsRepository.incrementCounter method no longer accepts a string field name, an array of field names to increment must be provided.
For maintainers