Skip to content

Commit

Permalink
MONIT-40224: fix error span
Browse files Browse the repository at this point in the history
  • Loading branch information
Yang Zeng committed Nov 8, 2023
1 parent 588983a commit 7313244
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions proxy/src/main/java/com/wavefront/agent/sampler/EbpfSampler.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package com.wavefront.agent.sampler;

import static com.wavefront.common.TraceConstants.PARENT_KEY;
import static com.wavefront.sdk.common.Constants.*;

import com.github.benmanes.caffeine.cache.Caffeine;
import com.github.benmanes.caffeine.cache.LoadingCache;
import com.google.common.annotations.VisibleForTesting;
import com.wavefront.sdk.entities.tracing.sampling.RateSampler;
import wavefront.report.Annotation;
import wavefront.report.Span;

import javax.annotation.Nonnull;
import java.util.List;
import java.util.Map;
import java.util.UUID;
Expand All @@ -15,10 +16,8 @@
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.stream.Collectors;
import javax.annotation.Nonnull;
import org.apache.commons.lang.StringUtils;
import wavefront.report.Annotation;
import wavefront.report.Span;

import static com.wavefront.sdk.common.Constants.*;

/**
* This Sampler is for Ebpf traffic focusing on not losing a single edge due to sampling in
Expand Down Expand Up @@ -139,7 +138,7 @@ public boolean sample(@Nonnull Span span) {
stats.edgeCount.getAndIncrement();
if (!stats.isSignificant()) sampled = true;

if (annotationMap.containsKey(ERROR_TAG_KEY)) {
if (annotationMap.containsKey(ERROR_TAG_KEY) && "true".equalsIgnoreCase(annotationMap.get(ERROR_TAG_KEY))) {
stats.errorCount.getAndIncrement();
if (!sampled && stats.getErrorRatio() < 0.5) sampled = true;
}
Expand Down

0 comments on commit 7313244

Please sign in to comment.