Skip to content

Commit 94efc2a

Browse files
authored
add a queue length metric for http post sinks (#168)
* add a queue length metric for http post sinks
1 parent 479f6bf commit 94efc2a

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/main/docker/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
FROM openjdk:8u212-jre-alpine
15+
FROM openjdk:8u212-jre-slim-buster
1616

1717
MAINTAINER arpnetworking
1818

@@ -31,7 +31,7 @@ ENV CAGG_CONFIG="/opt/cluster-aggregator/config/config.conf"
3131
ENV JAVA_OPTS=""
3232

3333
# Build
34-
RUN apk add --no-cache libstdc++ su-exec && \
34+
RUN apt update && apt install -y gosu && rm -rf /var/lib/apt/lists/* && \
3535
mkdir -p /opt/cluster-aggregator/lib/ext && \
3636
mkdir -p /opt/cluster-aggregator/logs && \
3737
mkdir -p /opt/cluster-aggregator/config

src/main/java/com/arpnetworking/tsdcore/sinks/HttpSinkActor.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ public HttpSinkActor(
110110
_evictedRequestsName = "sinks/http_post/" + _sink.getMetricSafeName() + "/evicted_requests";
111111
_requestLatencyName = "sinks/http_post/" + _sink.getMetricSafeName() + "/request_latency";
112112
_inQueueLatencyName = "sinks/http_post/" + _sink.getMetricSafeName() + "/queue_time";
113+
_pendingRequestsQueueSizeName = "sinks/http_post/" + _sink.getMetricSafeName() + "/queue_size";
114+
_inflightRequestsCountName = "sinks/http_post/" + _sink.getMetricSafeName() + "/inflight_count";
113115
_requestSuccessName = "sinks/http_post/" + _sink.getMetricSafeName() + "/success";
114116
_responseStatusName = "sinks/http_post/" + _sink.getMetricSafeName() + "/status";
115117
_httpSinkAttemptsName = "sinks/http_post/" + _sink.getMetricSafeName() + "/attempts";
@@ -309,6 +311,7 @@ private void processEmitAggregation(final EmitAggregation emitMessage) {
309311
.addData("conditionsSize", periodicData.getConditions().size())
310312
.addContext("actor", self())
311313
.log();
314+
_periodicMetrics.recordGauge(_inflightRequestsCountName, _inflightRequestsCount);
312315

313316
if (!periodicData.getData().isEmpty() || !periodicData.getConditions().isEmpty()) {
314317
final Collection<RequestEntry.Builder> requestEntryBuilders = _sink.createRequests(_client, periodicData);
@@ -331,6 +334,8 @@ private void processEmitAggregation(final EmitAggregation emitMessage) {
331334
.log();
332335
}
333336

337+
_periodicMetrics.recordGauge(_pendingRequestsQueueSizeName, _pendingRequests.size());
338+
334339
if (_spreadingDelayMillis > 0) {
335340
// If we don't currently have anything in-flight, we'll need to wait the spreading duration.
336341
if (!_waiting && pendingWasEmpty) {
@@ -442,6 +447,8 @@ private void scheduleRetry(final RequestEntry requestEntry, final int attempt) {
442447
private final String _evictedRequestsName;
443448
private final String _requestLatencyName;
444449
private final String _inQueueLatencyName;
450+
private final String _pendingRequestsQueueSizeName;
451+
private final String _inflightRequestsCountName;
445452
private final String _requestSuccessName;
446453
private final String _responseStatusName;
447454
private final String _httpSinkAttemptsName;

0 commit comments

Comments
 (0)