Skip to content

Commit f08be76

Browse files
committed
Address comments in PR to contrib
1 parent 28939db commit f08be76

File tree

1 file changed

+24
-28
lines changed

1 file changed

+24
-28
lines changed

.github/patches/opentelemetry-java-contrib.patch

Lines changed: 24 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -892,7 +892,7 @@ index 1ef8abf5..328e63dd 100644
892892
}
893893
}
894894
diff --git a/aws-xray/src/main/java/io/opentelemetry/contrib/awsxray/XrayRulesSampler.java b/aws-xray/src/main/java/io/opentelemetry/contrib/awsxray/XrayRulesSampler.java
895-
index 75977dc0..79c344bc 100644
895+
index 75977dc0..d24148d2 100644
896896
--- a/aws-xray/src/main/java/io/opentelemetry/contrib/awsxray/XrayRulesSampler.java
897897
+++ b/aws-xray/src/main/java/io/opentelemetry/contrib/awsxray/XrayRulesSampler.java
898898
@@ -5,15 +5,24 @@
@@ -1016,7 +1016,7 @@ index 75977dc0..79c344bc 100644
10161016
}
10171017

10181018
@Override
1019-
@@ -74,10 +126,30 @@ final class XrayRulesSampler implements Sampler {
1019+
@@ -74,10 +126,32 @@ final class XrayRulesSampler implements Sampler {
10201020
SpanKind spanKind,
10211021
Attributes attributes,
10221022
List<LinkData> parentLinks) {
@@ -1032,6 +1032,8 @@ index 75977dc0..79c344bc 100644
10321032
+ SamplingResult result =
10331033
+ applier.shouldSample(parentContext, traceId, name, spanKind, attributes, parentLinks);
10341034
+
1035+
+ // If the trace state has a sampling rule reference, propagate it
1036+
+ // Otherwise, propagate the matched sampling rule using AwsSamplingResult
10351037
+ String ruleToPropagate =
10361038
+ upstreamMatchedRule == null ? applier.getRuleName() : upstreamMatchedRule;
10371039
+ if (this.adaptiveSamplingConfig != null
@@ -1049,7 +1051,7 @@ index 75977dc0..79c344bc 100644
10491051
}
10501052
}
10511053

1052-
@@ -96,7 +168,144 @@ final class XrayRulesSampler implements Sampler {
1054+
@@ -96,7 +170,153 @@ final class XrayRulesSampler implements Sampler {
10531055
return "XrayRulesSampler{" + Arrays.toString(ruleAppliers) + "}";
10541056
}
10551057

@@ -1087,6 +1089,15 @@ index 75977dc0..79c344bc 100644
10871089
+ operation = generateIngressOperation(spanData);
10881090
+ }
10891091
+ for (AwsXrayAdaptiveSamplingConfig.AnomalyConditions condition : anomalyConditions) {
1092+
+ // Skip condition if it would only re-apply action already being taken
1093+
+ if ((shouldBoostSampling
1094+
+ && AwsXrayAdaptiveSamplingConfig.UsageType.SAMPLING_BOOST.equals(
1095+
+ condition.getUsage()))
1096+
+ || (shouldCaptureAnomalySpan
1097+
+ && AwsXrayAdaptiveSamplingConfig.UsageType.ERROR_SPAN_CAPTURE.equals(
1098+
+ condition.getUsage()))) {
1099+
+ continue;
1100+
+ }
10901101
+ // Check if the operation matches any in the list or if operations list is null (match all)
10911102
+ List<String> operations = condition.getOperations();
10921103
+ if (!(operations == null || operations.isEmpty() || operations.contains(operation))) {
@@ -1141,15 +1152,15 @@ index 75977dc0..79c344bc 100644
11411152
+ boolean isLocalRootSpan =
11421153
+ parentContext == null || !parentContext.isValid() || parentContext.isRemote();
11431154
+
1144-
+ if (shouldBoostSampling || shouldCaptureAnomalySpan || isLocalRootSpan) {
1145-
+ // Anomaly Capture
1146-
+ if (shouldCaptureAnomalySpan
1147-
+ && anomalyCaptureRateLimiter != null
1148-
+ && anomalyCaptureRateLimiter.trySpend(1)) {
1149-
+ spanBatcher.accept(span);
1150-
+ }
1155+
+ // Anomaly Capture
1156+
+ if (shouldCaptureAnomalySpan
1157+
+ && anomalyCaptureRateLimiter != null
1158+
+ && anomalyCaptureRateLimiter.trySpend(1)) {
1159+
+ spanBatcher.accept(span);
1160+
+ }
11511161
+
1152-
+ // Sampling Boost
1162+
+ // Sampling Boost
1163+
+ if (shouldBoostSampling || isLocalRootSpan) {
11531164
+ String ruleNameForBoostStats =
11541165
+ span.getSpanContext()
11551166
+ .getTraceState()
@@ -1195,7 +1206,7 @@ index 75977dc0..79c344bc 100644
11951206
return Arrays.stream(ruleAppliers)
11961207
.map(rule -> rule.snapshot(now))
11971208
.filter(Objects::nonNull)
1198-
@@ -115,15 +324,16 @@ final class XrayRulesSampler implements Sampler {
1209+
@@ -115,15 +335,16 @@ final class XrayRulesSampler implements Sampler {
11991210
Map<String, SamplingTargetDocument> ruleTargets,
12001211
Set<String> requestedTargetRuleNames,
12011212
Date now) {
@@ -1214,7 +1225,7 @@ index 75977dc0..79c344bc 100644
12141225
}
12151226
if (requestedTargetRuleNames.contains(rule.getRuleName())) {
12161227
// In practice X-Ray should return a target for any rule we requested but
1217-
@@ -135,6 +345,59 @@ final class XrayRulesSampler implements Sampler {
1228+
@@ -135,6 +356,59 @@ final class XrayRulesSampler implements Sampler {
12181229
return rule;
12191230
})
12201231
.toArray(SamplingRuleApplier[]::new);
@@ -2882,21 +2893,6 @@ index 00000000..32752d5e
28822893
+ "speed": "0"
28832894
+ }
28842895
+}
2885-
diff --git a/disk-buffering/build.gradle.kts b/disk-buffering/build.gradle.kts
2886-
index 041d2e91..e3d60f46 100644
2887-
--- a/disk-buffering/build.gradle.kts
2888-
+++ b/disk-buffering/build.gradle.kts
2889-
@@ -70,6 +70,10 @@ tasks.named<ShadowJar>("shadowJar") {
2890-
mustRunAfter("jar")
2891-
}
2892-
2893-
+tasks.withType<Test>().configureEach {
2894-
+ dependsOn("shadowJar")
2895-
+}
2896-
+
2897-
// The javadoc from wire's generated classes has errors that make the task that generates the "javadoc" artifact to fail. This
2898-
// makes the javadoc task to ignore those generated classes.
2899-
tasks.withType(Javadoc::class.java) {
29002896
diff --git a/version.gradle.kts b/version.gradle.kts
29012897
index acefcee9..329b524f 100644
29022898
--- a/version.gradle.kts

0 commit comments

Comments
 (0)