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

SKYEDEN-3234 detect unused topics #1922

Merged
merged 45 commits into from
Dec 20, 2024
Merged

Conversation

questras
Copy link
Collaborator

@questras questras commented Nov 12, 2024

  • 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))
Copy link
Collaborator

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?

Copy link
Collaborator Author

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.

moscicky
moscicky previously approved these changes Nov 28, 2024
* SKYEDEN-3271 |hermes management leader

* SKYEDEN-3271 | cr changes
moscicky
moscicky previously approved these changes Dec 17, 2024
szczygiel-m
szczygiel-m previously approved these changes Dec 18, 2024
Copy link
Contributor

@szczygiel-m szczygiel-m left a 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.*;
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: * import

@questras questras dismissed stale reviews from szczygiel-m and moscicky via db8e9c8 December 19, 2024 14:07
@szczygiel-m szczygiel-m merged commit ffc4e39 into master Dec 20, 2024
12 of 13 checks passed
@szczygiel-m szczygiel-m deleted the SKYEDEN-3234-detect-unused-topics branch December 20, 2024 08:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants