Skip to content

Commit 9f9fdc5

Browse files
committed
Fix
1 parent f8a8ba0 commit 9f9fdc5

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/keytransaction/KeyTransactionSampler.java

+3
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ public SamplingResult shouldSample(
8484
SamplingResult result =
8585
fallback.shouldSample(parentContext, traceId, name, spanKind, attributes, parentLinks);
8686

87+
if (existingKeyTransactions.isEmpty() && startKeyTransactions.isEmpty()) {
88+
return result;
89+
}
8790
return new TransactionSamplingResult(
8891
existingKeyTransactions, startKeyTransactions, endKeyTransactions, result);
8992
}

agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/sampling/Samplers.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public static Sampler getSampler(
5555
// as
5656
// it will ensure consistent traces, however it does not accurately compute item counts, since
5757
// item counts are not propagated in trace state (yet)
58-
return Sampler.parentBasedBuilder(sampler).build();
58+
sampler = Sampler.parentBasedBuilder(sampler).build();
5959
}
6060

6161
if (KeyTransactionConfigSupplier.KEY_TRANSACTIONS_ENABLED) {

0 commit comments

Comments
 (0)