Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improved subscription health problem indicators (#972)
- Loading branch information
1 parent
73d0013
commit 0533fbe
Showing
25 changed files
with
486 additions
and
338 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 54 additions & 11 deletions
65
.../allegro/tech/hermes/management/domain/subscription/health/SubscriptionHealthContext.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,70 @@ | ||
package pl.allegro.tech.hermes.management.domain.subscription.health; | ||
|
||
import pl.allegro.tech.hermes.api.Subscription; | ||
import pl.allegro.tech.hermes.api.SubscriptionMetrics; | ||
import pl.allegro.tech.hermes.api.TopicMetrics; | ||
|
||
import static java.lang.Double.parseDouble; | ||
|
||
public final class SubscriptionHealthContext { | ||
private final Subscription subscription; | ||
private final TopicMetrics topicMetrics; | ||
private final SubscriptionMetrics subscriptionMetrics; | ||
private final double topicRate; | ||
private final double subscriptionRate; | ||
private final double timeoutsRate; | ||
private final double otherErrorsRate; | ||
private final double code4xxErrorsRate; | ||
private final double code5xxErrorsRate; | ||
private final double batchRate; | ||
private final long lag; | ||
|
||
public SubscriptionHealthContext(Subscription subscription, TopicMetrics topicMetrics, SubscriptionMetrics subscriptionMetrics) { | ||
SubscriptionHealthContext(Subscription subscription, TopicMetrics topicMetrics, SubscriptionMetrics subscriptionMetrics) { | ||
this.subscription = subscription; | ||
this.topicMetrics = topicMetrics; | ||
this.subscriptionMetrics = subscriptionMetrics; | ||
this.topicRate = parseDouble(topicMetrics.getRate()); | ||
this.subscriptionRate = parseDouble(subscriptionMetrics.getRate()); | ||
this.timeoutsRate = parseDouble(subscriptionMetrics.getTimeouts()); | ||
this.otherErrorsRate = parseDouble(subscriptionMetrics.getOtherErrors()); | ||
this.code4xxErrorsRate = parseDouble(subscriptionMetrics.getCodes4xx()); | ||
this.code5xxErrorsRate = parseDouble(subscriptionMetrics.getCodes5xx()); | ||
this.batchRate = parseDouble(subscriptionMetrics.getBatchRate()); | ||
this.lag = subscriptionMetrics.getLag(); | ||
} | ||
|
||
public boolean subscriptionHasRetryOnError() { | ||
if (subscription.isBatchSubscription()) { | ||
return subscription.getBatchSubscriptionPolicy().isRetryClientErrors(); | ||
} else { | ||
return subscription.getSerialSubscriptionPolicy().isRetryClientErrors(); | ||
} | ||
} | ||
|
||
public double getSubscriptionRateRespectingDeliveryType() { | ||
if (subscription.isBatchSubscription()) { | ||
return batchRate; | ||
} | ||
return subscriptionRate; | ||
} | ||
|
||
public double getOtherErrorsRate() { | ||
return otherErrorsRate; | ||
} | ||
|
||
public double getTimeoutsRate() { | ||
return timeoutsRate; | ||
} | ||
|
||
public double getCode4xxErrorsRate() { | ||
return code4xxErrorsRate; | ||
} | ||
|
||
public Subscription getSubscription() { | ||
return subscription; | ||
public double getCode5xxErrorsRate() { | ||
return code5xxErrorsRate; | ||
} | ||
|
||
public TopicMetrics getTopicMetrics() { | ||
return topicMetrics; | ||
public long getLag() { | ||
return lag; | ||
} | ||
|
||
public SubscriptionMetrics getSubscriptionMetrics() { | ||
return subscriptionMetrics; | ||
public double getTopicRate() { | ||
return topicRate; | ||
} | ||
} |
31 changes: 0 additions & 31 deletions
31
...o/tech/hermes/management/domain/subscription/health/SubscriptionHealthContextCreator.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.