-
Notifications
You must be signed in to change notification settings - Fork 217
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
SKYEDEN-3234 detect unused topics #1922
Conversation
questras
commented
Nov 12, 2024
•
edited
Loading
edited
- Add a cron job to detect inactive topics and notify them
- notification thresholds, cron etc are configured via properties
- Notifier implementation is not provided, but the feature can work without it
- the job runs on one instance of hermes management only, based on provided ZK datacenter for leadership election (in properties)
InactiveTopic limitNotificationsHistory(int limit) { | ||
List<Long> newNotificationTimestampsMs = | ||
notificationTimestampsMs.stream() | ||
.sorted((a, b) -> Long.compare(b, a)) |
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.
nit: do we really need to sort this list? Timestamps should be order first so we can just take last limit
elements?
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 don't want to rely on the current implementation that the timestamps will be sorted. If we ever change anything that changes the order of timestamps then we might get an unexpected behavior and this sorting makes sure we are always safe.
* SKYEDEN-3271 |hermes management leader * SKYEDEN-3271 | cr changes
…-topics"" This reverts commit cf17940.
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.
Great job!
import io.micrometer.core.instrument.Tags; | ||
import java.time.Clock; | ||
import java.time.Instant; | ||
import java.util.*; |
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.
nit: * import