-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
Rest api to reset deprecation indexing cache #78392
Conversation
Deprecation indexing is using RateLimitingFilter to throttle duplicated deprecations. This commit allows to reset the LRU cache in this filter. This will not affect the log4j filter used for thottling file appenders. closes elastic#78134
Pinging @elastic/es-core-infra (Team:Core/Infra) |
/** | ||
Resets deprecation indexing rate limiting cache on each node. | ||
*/ | ||
public class DeprecationCacheResetAction extends ActionType<ActionResponse.Empty> { |
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 wasn't sure I extended the right classes in DeprecationCacheResetAction and TransportDeprecationCacheResetAction
My goal was to keep it as simple as possible.
Is there a generic "empty request" somewhere in our codebase already?
Also do we have a way to make sure that a response (even empty) is returned to a rest client only when operations on every node succeeded?
import org.elasticsearch.transport.TransportService; | ||
|
||
public class TransportDeprecationCacheResetAction | ||
extends HandledTransportAction<DeprecationCacheResetAction.Request, ActionResponse.Empty> { |
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 think this needs to be a TransportNodesAction. HandledTransportAction would only be handled by a single node, but TransportNodesAction fans out to all nodes (you'll need to create an appropriate single node request/response as well).
...n/java/org/elasticsearch/xpack/deprecation/logging/TransportDeprecationCacheResetAction.java
Outdated
Show resolved
Hide resolved
Since resetting the cache is not deprecated, I don’t think it should be logged as such. You could log as debug? |
we can log as debug. But this would mean that the log line will be in server log files only. It would not appear in deprecation data stream. @cjcenizal do you know how the Upgrade Assitant UI is planning to use this API and then present fresh deprecations? Is the "marker" indicating a reset being performed needed at all? |
@pgomulka We expect the following workflow:
Does this make sense? |
BTW you can test this out yourself by spinning up a fresh 7.16 deployment on Cloud. |
@pgomulka Oh sorry I missed your question.
I expect that when the user resets the counter (step 5), we'll send a request to this API to also reset the cache. |
The word "counter" makes me worry here - we use a rate limiting mechanism so that we don't keep logging the same message over and over, which means counting the occurrences of each message could be wildly inaccurate. |
@pugnascotia I think it all depends on how we present it to the user. For example, we could present it as "a count of unique logs". But I think you and anyone else should try out the UX and see how it feels. |
so there is a counter. I suspect it counts how many documents are there in deprecation log data stream
I feel that by reseting the counter you mean removing the documents from deprecation log index? Data streams are append only, so I think it is not possible. The count on the UI would not go down, unless you remember what was the previous count. With a marker we could query for the last |
This is the deprecation log counter. It's just below the UI in your screenshot.
No. The way we've implemented this counter is we store a timestamp when the user clicks "Reset counter" and count all new docs that have been indexed since that timestamp. |
so that solves it all :) I will remove the redundant log indicating a reset |
Thanks @pgomulka! |
...ion/qa/rest/src/javaRestTest/java/org/elasticsearch/xpack/deprecation/DeprecationHttpIT.java
Show resolved
Hide resolved
...ion/qa/rest/src/javaRestTest/java/org/elasticsearch/xpack/deprecation/DeprecationHttpIT.java
Outdated
Show resolved
Hide resolved
Deprecation indexing is using RateLimitingFilter to throttle duplicated deprecations. This commit adds REST API and transport actions to reset the LRU cache in this filter. This will not affect the log4j filter used for thottling file appenders. closes elastic#78134
Deprecation indexing is using RateLimitingFilter to throttle duplicated deprecations. This commit adds REST API and transport actions to reset the LRU cache in this filter. This will not affect the log4j filter used for thottling file appenders. closes #78134
@pgomulka I'd like to open an issue in the Kibana repo and link to some docs. Do we have docs for this API? Or could you add a couple examples to the PR description and I'll just cross-link here? |
@cjcenizal good question. I am not sure if this should be treated more like internal API or we should publicly document this. I don't mind either approach. |
Deprecation indexing is using RateLimitingFilter to throttle duplicated
deprecations.
This commit adds REST API and transport actions to reset the LRU cache in this filter.
This will not affect the log4j filter used for throttling file appenders.
usage is very simple. Just call
DELETE
on_logging/deprecation_cache
closes #78134