From fcd88a5066d0debdc0c898d70f3c259c075f48c4 Mon Sep 17 00:00:00 2001 From: kotharironak <53209990+kotharironak@users.noreply.github.com> Date: Thu, 25 Nov 2021 15:28:56 +0530 Subject: [PATCH] fix: adds support for default max spans limit helm config (#291) * fix: adds support for default max spans limit helm config * there is no limit as default --- .../helm/templates/raw-spans-grouper-config.yaml | 4 ++++ .../core/rawspansgrouper/RawSpansProcessor.java | 8 +++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/raw-spans-grouper/helm/templates/raw-spans-grouper-config.yaml b/raw-spans-grouper/helm/templates/raw-spans-grouper-config.yaml index 9cac53297..fcb9d8765 100644 --- a/raw-spans-grouper/helm/templates/raw-spans-grouper-config.yaml +++ b/raw-spans-grouper/helm/templates/raw-spans-grouper-config.yaml @@ -56,6 +56,10 @@ data: span.groupby.session.window.interval = {{ .Values.rawSpansGrouperConfig.span.groupby.internal }} + {{- if hasKey .Values.rawSpansGrouperConfig "defaultMaxSpanCount" }} + default.max.span.count = {{ .Values.rawSpansGrouperConfig.defaultMaxSpanCount }} + {{- end }} + {{- if hasKey .Values.rawSpansGrouperConfig "maxSpanCount" }} max.span.count = { {{- range $k, $v := .Values.rawSpansGrouperConfig.maxSpanCount }} diff --git a/raw-spans-grouper/raw-spans-grouper/src/main/java/org/hypertrace/core/rawspansgrouper/RawSpansProcessor.java b/raw-spans-grouper/raw-spans-grouper/src/main/java/org/hypertrace/core/rawspansgrouper/RawSpansProcessor.java index b165870ba..c0a944c5b 100644 --- a/raw-spans-grouper/raw-spans-grouper/src/main/java/org/hypertrace/core/rawspansgrouper/RawSpansProcessor.java +++ b/raw-spans-grouper/raw-spans-grouper/src/main/java/org/hypertrace/core/rawspansgrouper/RawSpansProcessor.java @@ -175,10 +175,9 @@ private boolean shouldDropSpan(TraceIdentity key, TraceState traceState) { long maxSpanCountTenantLimit = maxSpanCountMap.containsKey(key.getTenantId()) ? maxSpanCountMap.get(key.getTenantId()) - : Long.MAX_VALUE; + : defaultMaxSpanCountLimit; - if (inFlightSpansPerTrace >= defaultMaxSpanCountLimit - || inFlightSpansPerTrace >= maxSpanCountTenantLimit) { + if (inFlightSpansPerTrace >= maxSpanCountTenantLimit) { if (logger.isDebugEnabled()) { logger.debug( @@ -199,8 +198,7 @@ private boolean shouldDropSpan(TraceIdentity key, TraceState traceState) { .increment(); // increment the counter when the number of spans reaches the max.span.count limit. - if (inFlightSpansPerTrace == defaultMaxSpanCountLimit - || inFlightSpansPerTrace == maxSpanCountTenantLimit) { + if (inFlightSpansPerTrace == maxSpanCountTenantLimit) { truncatedTracesCounter .computeIfAbsent( key.getTenantId(),