Skip to content

Commit 3f5b7d8

Browse files
committed
Add back in merged-over changes
1 parent ca7afe2 commit 3f5b7d8

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

newrelic-agent/src/main/java/com/newrelic/agent/tracing/samplers/ProbabilityBasedSampler.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
package com.newrelic.agent.tracing.samplers;
88

99
import com.newrelic.agent.Transaction;
10-
import com.newrelic.agent.config.SamplerConfig;
10+
import com.newrelic.agent.config.coretracing.SamplerConfig;
1111
import com.newrelic.agent.tracing.DistributedTraceServiceImpl;
1212
import com.newrelic.api.agent.NewRelic;
1313

@@ -70,6 +70,11 @@ public String getType() {
7070
return SamplerFactory.PROBABILITY;
7171
}
7272

73+
@Override
74+
public String getDescription() {
75+
return "Probability Based Sampler, rejection threshold=" + rejectionThreshold;
76+
}
77+
7378
/**
7479
* Retrieve the current rejection threshold value
7580
*

newrelic-agent/src/main/java/com/newrelic/agent/tracing/samplers/TraceRatioBasedSampler.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
package com.newrelic.agent.tracing.samplers;
88

99
import com.newrelic.agent.Transaction;
10-
import com.newrelic.agent.config.SamplerConfig;
10+
import com.newrelic.agent.config.coretracing.SamplerConfig;
1111
import com.newrelic.agent.tracing.DistributedTraceServiceImpl;
1212
import com.newrelic.api.agent.NewRelic;
1313

@@ -31,6 +31,8 @@
3131
*/
3232
public class TraceRatioBasedSampler implements Sampler {
3333
private final long threshold;
34+
private final float ratio;
35+
private final String description;
3436

3537
/**
3638
* Construct a new TraceRatioBasedSampler with the desired ratio
@@ -48,6 +50,8 @@ public TraceRatioBasedSampler(SamplerConfig samplerConfig) {
4850
NewRelic.getAgent().getLogger().log(Level.WARNING, "TraceRatioBasedSampler: Invalid sampling ratio supplied; setting " +
4951
"threshold to {0}", threshold);
5052
}
53+
this.ratio = traceRatio;
54+
this.description = String.format("Trace Id Ratio Based Sampler, ratio=%.4f", traceRatio);
5155
}
5256

5357
@Override
@@ -71,6 +75,11 @@ public String getType() {
7175
return SamplerFactory.TRACE_RATIO_ID_BASED;
7276
}
7377

78+
@Override
79+
public String getDescription(){
80+
return description;
81+
}
82+
7483
/**
7584
* Retrieve the current rejection threshold value
7685
*
@@ -79,4 +88,8 @@ public String getType() {
7988
public long getThreshold() {
8089
return threshold;
8190
}
91+
92+
public float getRatio() {
93+
return ratio;
94+
}
8295
}

0 commit comments

Comments
 (0)