Skip to content

Commit b59af34

Browse files
authored
Merge branch 'main' into dependabot/gradle/org.testcontainers-mysql-1.20.3
2 parents 4dd423a + e9cc142 commit b59af34

File tree

227 files changed

+26688
-3351
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

227 files changed

+26688
-3351
lines changed
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Reusable Action for executing commands and retrying them if it fails
2+
name: Command Retry Logic
3+
4+
inputs:
5+
# (Optional) Command to run before the retry command. To be used for environment setup, etc
6+
pre-command:
7+
required: false
8+
type: string
9+
# (Optional) Number of retries to perform. Default is 3
10+
max_retry:
11+
required: false
12+
type: number
13+
default: 3
14+
# (Required) Command to execute with the retry mechanism
15+
command:
16+
required: true
17+
type: string
18+
# (Required) Command to clean up resources before retrying the main command
19+
cleanup:
20+
required: false
21+
type: string
22+
# (Optional) Time to wait between each attempt in seconds. Default is 10 seconds
23+
sleep_time:
24+
required: false
25+
type: number
26+
default: 10
27+
# (Optional) Follow-up command after the main command is finished.
28+
post-command:
29+
required: false
30+
type: string
31+
32+
runs:
33+
using: "composite"
34+
steps:
35+
- name: Run command
36+
shell: bash
37+
env:
38+
PRE_COMMAND: ${{ inputs.pre-command }}
39+
MAX_RETRY: ${{ inputs.max_retry }}
40+
COMMAND: ${{ inputs.command }}
41+
CLEANUP: ${{ inputs.cleanup }}
42+
POST_COMMAND: ${{ inputs.post-command }}
43+
SLEEP_TIME: ${{ inputs.sleep_time }}
44+
run: |
45+
echo "Starting the execute_and_retry action for command $COMMAND"
46+
echo "Executing pre-command for the execute_and_retry action"
47+
eval "$PRE_COMMAND"
48+
49+
retry_counter=0
50+
while [ $retry_counter -lt $MAX_RETRY ]; do
51+
echo "Attempt Number $retry_counter for execute_and_retry action"
52+
53+
attempt_failed=0
54+
eval "$COMMAND" || attempt_failed=$?
55+
56+
if [ $attempt_failed -ne 0 ]; then
57+
echo "Command failed for execute_and_retry action, executing cleanup command for another attempt"
58+
59+
eval "$CLEANUP" || true
60+
retry_counter=$(($retry_counter+1))
61+
sleep "$SLEEP_TIME"
62+
else
63+
echo "Command executed successfully for execute_and_retry"
64+
break
65+
fi
66+
if [[ $retry_counter -ge $MAX_RETRY ]]; then
67+
echo "Max retry reached, command failed to execute properly. Exiting action"
68+
exit 1
69+
fi
70+
done
71+
72+
echo "Executing post-command for the execute_and_retry action"
73+
eval "$POST_COMMAND"
74+
echo "Exiting execute_and_retry action"

.github/collector/collector-config.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ receivers:
55
endpoint: 0.0.0.0:4317
66

77
exporters:
8-
logging:
9-
loglevel: info
8+
debug:
9+
verbosity: normal
1010
awsxray:
1111
region: us-west-2
1212
awsemf:
@@ -21,11 +21,11 @@ service:
2121
receivers:
2222
- otlp
2323
exporters:
24-
- logging
24+
- debug
2525
- awsxray
2626
metrics:
2727
receivers:
2828
- otlp
2929
exporters:
30-
- logging
30+
- debug
3131
- awsemf

.github/collector/docker-compose.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ services:
2626
- AWS_REGION=us-west-2
2727
- OTEL_JAVAAGENT_DEBUG=true
2828
- OTEL_METRICS_EXPORTER=otlp
29+
- OTEL_EXPORTER_OTLP_PROTOCOL=grpc
30+
- OTEL_INSTRUMENTATION_COMMON_EXPERIMENTAL_CONTROLLER_TELEMETRY_ENABLED=true
2931
volumes:
3032
- /tmp/awscreds:/tmp/awscreds
3133
ports:
Lines changed: 237 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,237 @@
1+
diff --git a/aws-xray/src/main/java/io/opentelemetry/contrib/awsxray/SamplingRuleApplier.java b/aws-xray/src/main/java/io/opentelemetry/contrib/awsxray/SamplingRuleApplier.java
2+
index 1ef8abf..ef84f35 100644
3+
--- a/aws-xray/src/main/java/io/opentelemetry/contrib/awsxray/SamplingRuleApplier.java
4+
+++ b/aws-xray/src/main/java/io/opentelemetry/contrib/awsxray/SamplingRuleApplier.java
5+
@@ -35,6 +35,11 @@ final class SamplingRuleApplier {
6+
7+
private static final Map<String, String> XRAY_CLOUD_PLATFORM;
8+
9+
+ private static final AttributeKey<String> URL_PATH = AttributeKey.stringKey("url.path");
10+
+ private static final AttributeKey<String> URL_FULL = AttributeKey.stringKey("url.full");
11+
+ private static final AttributeKey<String> HTTP_REQUEST_METHOD =
12+
+ AttributeKey.stringKey("http.request.method");
13+
+
14+
static {
15+
Map<String, String> xrayCloudPlatform = new HashMap<>();
16+
xrayCloudPlatform.put(ResourceAttributes.CloudPlatformValues.AWS_EC2, "AWS::EC2::Instance");
17+
@@ -162,11 +167,14 @@ final class SamplingRuleApplier {
18+
String host = null;
19+
20+
for (Map.Entry<AttributeKey<?>, Object> entry : attributes.asMap().entrySet()) {
21+
- if (entry.getKey().equals(SemanticAttributes.HTTP_TARGET)) {
22+
+ if (entry.getKey().equals(SemanticAttributes.HTTP_TARGET)
23+
+ || entry.getKey().equals(URL_PATH)) {
24+
httpTarget = (String) entry.getValue();
25+
- } else if (entry.getKey().equals(SemanticAttributes.HTTP_URL)) {
26+
+ } else if (entry.getKey().equals(SemanticAttributes.HTTP_URL)
27+
+ || entry.getKey().equals(URL_FULL)) {
28+
httpUrl = (String) entry.getValue();
29+
- } else if (entry.getKey().equals(SemanticAttributes.HTTP_METHOD)) {
30+
+ } else if (entry.getKey().equals(SemanticAttributes.HTTP_METHOD)
31+
+ || entry.getKey().equals(HTTP_REQUEST_METHOD)) {
32+
httpMethod = (String) entry.getValue();
33+
} else if (entry.getKey().equals(SemanticAttributes.NET_HOST_NAME)) {
34+
host = (String) entry.getValue();
35+
diff --git a/aws-xray/src/test/java/io/opentelemetry/contrib/awsxray/SamplingRuleApplierTest.java b/aws-xray/src/test/java/io/opentelemetry/contrib/awsxray/SamplingRuleApplierTest.java
36+
index 6bb6e82..55dabbd 100644
37+
--- a/aws-xray/src/test/java/io/opentelemetry/contrib/awsxray/SamplingRuleApplierTest.java
38+
+++ b/aws-xray/src/test/java/io/opentelemetry/contrib/awsxray/SamplingRuleApplierTest.java
39+
@@ -42,6 +42,11 @@ class SamplingRuleApplierTest {
40+
41+
private static final String CLIENT_ID = "test-client-id";
42+
43+
+ private static final AttributeKey<String> URL_PATH = AttributeKey.stringKey("url.path");
44+
+ private static final AttributeKey<String> URL_FULL = AttributeKey.stringKey("url.full");
45+
+ private static final AttributeKey<String> HTTP_REQUEST_METHOD =
46+
+ AttributeKey.stringKey("http.request.method");
47+
+
48+
@Nested
49+
@SuppressWarnings("ClassCanBeStatic")
50+
class ExactMatch {
51+
@@ -68,6 +73,15 @@ class SamplingRuleApplierTest {
52+
.put(AttributeKey.longKey("speed"), 10)
53+
.build();
54+
55+
+ private final Attributes newSemCovAttributes =
56+
+ Attributes.builder()
57+
+ .put(HTTP_REQUEST_METHOD, "GET")
58+
+ .put(SemanticAttributes.NET_HOST_NAME, "opentelemetry.io")
59+
+ .put(URL_PATH, "/instrument-me")
60+
+ .put(AttributeKey.stringKey("animal"), "cat")
61+
+ .put(AttributeKey.longKey("speed"), 10)
62+
+ .build();
63+
+
64+
// FixedRate set to 1.0 in rule and no reservoir
65+
@Test
66+
void fixedRateAlwaysSample() {
67+
@@ -116,6 +130,21 @@ class SamplingRuleApplierTest {
68+
.isTrue();
69+
}
70+
71+
+ @Test
72+
+ void matchesURLFullNewSemCov() {
73+
+ assertThat(applier.matches(newSemCovAttributes, resource)).isTrue();
74+
+
75+
+ // http.url works too
76+
+ assertThat(
77+
+ applier.matches(
78+
+ attributes.toBuilder()
79+
+ .remove(URL_FULL)
80+
+ .put(URL_FULL, "scheme://host:port/instrument-me")
81+
+ .build(),
82+
+ resource))
83+
+ .isTrue();
84+
+ }
85+
+
86+
@Test
87+
void serviceNameNotMatch() {
88+
assertThat(
89+
@@ -137,6 +166,13 @@ class SamplingRuleApplierTest {
90+
assertThat(applier.matches(attributes, resource)).isFalse();
91+
}
92+
93+
+ @Test
94+
+ void methodNewSemCovNotMatch() {
95+
+ Attributes attributes =
96+
+ this.newSemCovAttributes.toBuilder().put(HTTP_REQUEST_METHOD, "POST").build();
97+
+ assertThat(applier.matches(attributes, resource)).isFalse();
98+
+ }
99+
+
100+
@Test
101+
void hostNotMatch() {
102+
// Replacing dot with character makes sure we're not accidentally treating dot as regex
103+
@@ -178,6 +214,34 @@ class SamplingRuleApplierTest {
104+
assertThat(applier.matches(attributes, resource)).isFalse();
105+
}
106+
107+
+ @Test
108+
+ void pathNewSemCovNotMatch() {
109+
+ Attributes attributes =
110+
+ this.newSemCovAttributes.toBuilder().put(URL_PATH, "/instrument-you").build();
111+
+ assertThat(applier.matches(attributes, resource)).isFalse();
112+
+ attributes =
113+
+ this.newSemCovAttributes.toBuilder()
114+
+ .remove(URL_PATH)
115+
+ .put(URL_FULL, "scheme://host:port/instrument-you")
116+
+ .build();
117+
+ assertThat(applier.matches(attributes, resource)).isFalse();
118+
+ attributes =
119+
+ this.newSemCovAttributes.toBuilder()
120+
+ .remove(URL_PATH)
121+
+ .put(URL_FULL, "scheme://host:port")
122+
+ .build();
123+
+ assertThat(applier.matches(attributes, resource)).isFalse();
124+
+
125+
+ // Correct path, but we ignore anyways since the URL is malformed per spec, scheme is always
126+
+ // present.
127+
+ attributes =
128+
+ this.newSemCovAttributes.toBuilder()
129+
+ .remove(URL_PATH)
130+
+ .put(URL_FULL, "host:port/instrument-me")
131+
+ .build();
132+
+ assertThat(applier.matches(attributes, resource)).isFalse();
133+
+ }
134+
+
135+
@Test
136+
void attributeNotMatch() {
137+
Attributes attributes =
138+
@@ -243,6 +307,15 @@ class SamplingRuleApplierTest {
139+
.put(AttributeKey.longKey("speed"), 10)
140+
.build();
141+
142+
+ private final Attributes newSemCovAttributes =
143+
+ Attributes.builder()
144+
+ .put(HTTP_REQUEST_METHOD, "GET")
145+
+ .put(SemanticAttributes.NET_HOST_NAME, "opentelemetry.io")
146+
+ .put(URL_PATH, "/instrument-me?foo=bar&cat=meow")
147+
+ .put(AttributeKey.stringKey("animal"), "cat")
148+
+ .put(AttributeKey.longKey("speed"), 10)
149+
+ .build();
150+
+
151+
// FixedRate set to 0.0 in rule and no reservoir
152+
@Test
153+
void fixedRateNeverSample() {
154+
@@ -329,6 +402,26 @@ class SamplingRuleApplierTest {
155+
assertThat(applier.matches(attributes, resource)).isFalse();
156+
}
157+
158+
+ @Test
159+
+ void newSemCovMethodMatches() {
160+
+ Attributes attributes =
161+
+ this.newSemCovAttributes.toBuilder().put(HTTP_REQUEST_METHOD, "BADGETGOOD").build();
162+
+ assertThat(applier.matches(attributes, resource)).isTrue();
163+
+ attributes = newSemCovAttributes.toBuilder().put(HTTP_REQUEST_METHOD, "BADGET").build();
164+
+ assertThat(applier.matches(attributes, resource)).isTrue();
165+
+ attributes = newSemCovAttributes.toBuilder().put(HTTP_REQUEST_METHOD, "GETGET").build();
166+
+ assertThat(applier.matches(attributes, resource)).isTrue();
167+
+ }
168+
+
169+
+ @Test
170+
+ void newSemCovMethodNotMatch() {
171+
+ Attributes attributes =
172+
+ newSemCovAttributes.toBuilder().put(HTTP_REQUEST_METHOD, "POST").build();
173+
+ assertThat(applier.matches(attributes, resource)).isFalse();
174+
+ attributes = removeAttribute(newSemCovAttributes, HTTP_REQUEST_METHOD);
175+
+ assertThat(applier.matches(attributes, resource)).isFalse();
176+
+ }
177+
+
178+
@Test
179+
void hostMatches() {
180+
Attributes attributes =
181+
@@ -410,6 +503,29 @@ class SamplingRuleApplierTest {
182+
assertThat(applier.matches(attributes, resource)).isFalse();
183+
}
184+
185+
+ @Test
186+
+ void pathNewSemCovMatches() {
187+
+ Attributes attributes =
188+
+ newSemCovAttributes.toBuilder().put(URL_PATH, "/instrument-me?foo=bar&cat=").build();
189+
+ assertThat(applier.matches(attributes, resource)).isTrue();
190+
+ // Deceptive question mark, it's actually a wildcard :-)
191+
+ attributes =
192+
+ newSemCovAttributes.toBuilder().put(URL_PATH, "/instrument-meafoo=bar&cat=").build();
193+
+ assertThat(applier.matches(attributes, resource)).isTrue();
194+
+ }
195+
+
196+
+ @Test
197+
+ void pathNewSemCovNotMatch() {
198+
+ Attributes attributes =
199+
+ newSemCovAttributes.toBuilder().put(URL_PATH, "/instrument-mea?foo=bar&cat=").build();
200+
+ assertThat(applier.matches(attributes, resource)).isFalse();
201+
+ attributes =
202+
+ newSemCovAttributes.toBuilder().put(URL_PATH, "foo/instrument-meafoo=bar&cat=").build();
203+
+ assertThat(applier.matches(attributes, resource)).isFalse();
204+
+ attributes = removeAttribute(newSemCovAttributes, URL_PATH);
205+
+ assertThat(applier.matches(attributes, resource)).isFalse();
206+
+ }
207+
+
208+
@Test
209+
void attributeMatches() {
210+
Attributes attributes =
211+
diff --git a/disk-buffering/build.gradle.kts b/disk-buffering/build.gradle.kts
212+
index 041d2e9..e3d60f4 100644
213+
--- a/disk-buffering/build.gradle.kts
214+
+++ b/disk-buffering/build.gradle.kts
215+
@@ -70,6 +70,10 @@ tasks.named<ShadowJar>("shadowJar") {
216+
mustRunAfter("jar")
217+
}
218+
219+
+tasks.withType<Test>().configureEach {
220+
+ dependsOn("shadowJar")
221+
+}
222+
+
223+
// The javadoc from wire's generated classes has errors that make the task that generates the "javadoc" artifact to fail. This
224+
// makes the javadoc task to ignore those generated classes.
225+
tasks.withType(Javadoc::class.java) {
226+
diff --git a/version.gradle.kts b/version.gradle.kts
227+
index acefcee..329b524 100644
228+
--- a/version.gradle.kts
229+
+++ b/version.gradle.kts
230+
@@ -1,5 +1,5 @@
231+
-val stableVersion = "1.39.0"
232+
-val alphaVersion = "1.39.0-alpha"
233+
+val stableVersion = "1.39.0-adot1"
234+
+val alphaVersion = "1.39.0-alpha-adot1"
235+
236+
allprojects {
237+
if (findProperty("otel.stable") != "true") {

0 commit comments

Comments
 (0)