Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,6 @@ final class ConcurrencyLimitedChannel implements LimitedChannel {
.build();
this.limiter = limiter;

weakGauge(
taggedMetrics,
MetricName.builder()
.safeName("dialogue.concurrencylimiter.utilization")
.putSafeTags("channel-name", channelName)
.putSafeTags("hostIndex", Integer.toString(uriIndex))
.build(),
this,
ConcurrencyLimitedChannel::getUtilization);
weakGauge(
taggedMetrics,
MetricName.builder()
Expand Down Expand Up @@ -101,12 +92,6 @@ public String toString() {
return "ConcurrencyLimitedChannel{" + delegate + '}';
}

private double getUtilization() {
double inflight = limiter.getInflight();
double limit = limiter.getLimit();
return inflight / limit; // minLimit is 1 so we should never get NaN from this
}

private int getMax() {
return limiter.getLimit();
}
Expand Down
4 changes: 0 additions & 4 deletions dialogue-core/src/main/metrics/dialogue-core-metrics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@ namespaces:
dialogue.concurrencylimiter:
docs: Instrumentation for the ConcurrencyLimitedChannel
metrics:
utilization:
type: gauge
tags: [channel-name, hostIndex]
docs: The proportion of the available concurrency which is currently being used, i.e. if there are 20 permits and only one inflight call, this will be 0.05.
max:
type: gauge
tags: [channel-name, hostIndex]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,9 @@ public void testWithDefaultLimiter() {

@Test
void testGauges() {
when(mockLimiter.getInflight()).thenReturn(5);
when(mockLimiter.getLimit()).thenReturn(20);
when(mockLimiter.getLimit()).thenReturn(21);

assertThat(getMax()).isEqualTo(20);
assertThat(getUtilization()).isEqualTo(0.25d);
assertThat(getMax()).isEqualTo(21);
}

private void mockResponseCode(int code) {
Expand All @@ -153,16 +151,6 @@ private void mockLimitUnavailable() {
when(mockLimiter.acquire()).thenReturn(Optional.empty());
}

private Number getUtilization() {
Gauge<Object> gauge = metrics.gauge(MetricName.builder()
.safeName("dialogue.concurrencylimiter.utilization")
.putSafeTags("channel-name", "channel")
.putSafeTags("hostIndex", "0")
.build())
.get();
return (Number) gauge.getValue();
}

private Number getMax() {
MetricName metricName = MetricName.builder()
.safeName("dialogue.concurrencylimiter.max")
Expand Down