Skip to content

Commit 19e8c9c

Browse files
Merge branch 'main' into add_metric_annotation_instrument
2 parents 79c49f3 + c878a99 commit 19e8c9c

File tree

45 files changed

+449
-199
lines changed

Some content is hidden

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

45 files changed

+449
-199
lines changed

.github/workflows/codeql.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ jobs:
6363
cache-read-only: ${{ github.event_name == 'pull_request' }}
6464

6565
- name: Initialize CodeQL
66-
uses: github/codeql-action/init@4e828ff8d448a8a6e532957b1811f387a63867e8 # v3.29.4
66+
uses: github/codeql-action/init@51f77329afa6477de8c49fc9c7046c15b9a4e79d # v3.29.5
6767
with:
6868
languages: ${{ matrix.language }}
6969
# using "latest" helps to keep up with the latest Kotlin support
@@ -79,6 +79,6 @@ jobs:
7979
run: ./gradlew assemble -x javadoc -x :instrumentation:quarkus-resteasy-reactive:quarkus3-testing:quarkusGenerateCodeDev -x :instrumentation:quarkus-resteasy-reactive:quarkus2-testing:quarkusGenerateCodeDev --no-build-cache --no-daemon
8080

8181
- name: Perform CodeQL analysis
82-
uses: github/codeql-action/analyze@4e828ff8d448a8a6e532957b1811f387a63867e8 # v3.29.4
82+
uses: github/codeql-action/analyze@51f77329afa6477de8c49fc9c7046c15b9a4e79d # v3.29.5
8383
with:
8484
category: "/language:${{matrix.language}}"

.github/workflows/documentation-disable-list-audit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
java-version: 17
2121

2222
- name: Set up gradle
23-
uses: gradle/actions/setup-gradle@06832c7b30a0129d7fb559bcc6e43d26f6374244 # v4.3.1
23+
uses: gradle/actions/setup-gradle@ac638b010cf58a27ee6c972d7336334ccaf61c96 # v4.4.1
2424

2525
- name: Run instrumentation analyzer (identify any module changes)
2626
run: ./gradlew :instrumentation-docs:runAnalysis
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
name: Metadata Update
2+
3+
on:
4+
workflow_dispatch: # allow this to be manually triggered
5+
schedule:
6+
- cron: "00 1 * * *" # daily at 1:00 UTC
7+
8+
permissions:
9+
contents: read
10+
11+
# Should only be one job running at a time to avoid conflicts with the metadata update branch
12+
concurrency:
13+
group: metadata-update
14+
cancel-in-progress: true
15+
16+
jobs:
17+
update:
18+
runs-on: ubuntu-latest
19+
permissions:
20+
contents: write # for git push to PR branch
21+
pull-requests: write # for adding label and assignee to PR
22+
23+
steps:
24+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
25+
26+
- name: Free disk space
27+
run: .github/scripts/gha-free-disk-space.sh
28+
29+
- name: Set up JDK for running Gradle
30+
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
31+
with:
32+
distribution: temurin
33+
java-version-file: .java-version
34+
35+
- name: Set up gradle
36+
uses: gradle/actions/setup-gradle@ac638b010cf58a27ee6c972d7336334ccaf61c96 # v4.4.1
37+
38+
- name: Collect telemetry
39+
run: ./instrumentation-docs/ci-collect.sh
40+
41+
- name: Run documentation analyzer
42+
run: ./gradlew :instrumentation-docs:runAnalysis
43+
44+
- name: Check for diff
45+
id: diffcheck
46+
run: |
47+
git add docs/instrumentation-list.yaml
48+
if ! git diff --cached --quiet; then
49+
echo "has_diff=true" >> $GITHUB_OUTPUT
50+
else
51+
echo "has_diff=false" >> $GITHUB_OUTPUT
52+
fi
53+
54+
- name: Use CLA approved github bot
55+
if: steps.diffcheck.outputs.has_diff == 'true'
56+
run: .github/scripts/use-cla-approved-bot.sh
57+
58+
- uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6
59+
if: steps.diffcheck.outputs.has_diff == 'true'
60+
id: otelbot-token
61+
with:
62+
app-id: ${{ vars.OTELBOT_APP_ID }}
63+
private-key: ${{ secrets.OTELBOT_PRIVATE_KEY }}
64+
65+
- name: Find or create metadata update branch
66+
if: steps.diffcheck.outputs.has_diff == 'true'
67+
id: findbranch
68+
env:
69+
GH_TOKEN: ${{ steps.otelbot-token.outputs.token }}
70+
run: |
71+
BRANCH_NAME="metadata-update-main"
72+
echo "branch=$BRANCH_NAME" >> $GITHUB_OUTPUT
73+
if git ls-remote --exit-code --heads origin "$BRANCH_NAME"; then
74+
git fetch origin "$BRANCH_NAME"
75+
git checkout "$BRANCH_NAME"
76+
git merge origin/main --no-edit
77+
else
78+
git checkout -b "$BRANCH_NAME" origin/main
79+
fi
80+
81+
- name: Commit and push changes
82+
if: steps.diffcheck.outputs.has_diff == 'true'
83+
env:
84+
GH_TOKEN: ${{ steps.otelbot-token.outputs.token }}
85+
run: |
86+
BRANCH_NAME="${{ steps.findbranch.outputs.branch }}"
87+
git commit -m "chore: update instrumentation list [automated]" || echo "No changes to commit."
88+
git push origin "$BRANCH_NAME"
89+
90+
- name: Create PR if needed
91+
if: steps.diffcheck.outputs.has_diff == 'true'
92+
id: createpr
93+
env:
94+
GH_TOKEN: ${{ steps.otelbot-token.outputs.token }}
95+
run: |
96+
BRANCH_NAME="${{ steps.findbranch.outputs.branch }}"
97+
PR_EXISTS=$(gh pr list --state open --head "$BRANCH_NAME" --label automation --json url -q '.[0].url')
98+
if [ -z "$PR_EXISTS" ]; then
99+
gh pr create \
100+
--title "chore: update instrumentation list [automated]" \
101+
--body "This PR was created automatically by the metadata update workflow." \
102+
--head "$BRANCH_NAME" \
103+
--base main
104+
echo "new_pr=true" >> $GITHUB_OUTPUT
105+
else
106+
echo "PR already exists: $PR_EXISTS"
107+
echo "new_pr=false" >> $GITHUB_OUTPUT
108+
fi
109+
110+
- name: Add label to PR
111+
if: steps.createpr.outputs.new_pr == 'true'
112+
env:
113+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
114+
run: |
115+
BRANCH_NAME="${{ steps.findbranch.outputs.branch }}"
116+
PR_URL=$(gh pr list --state open --head "$BRANCH_NAME" --json url -q '.[0].url')
117+
if [ -n "$PR_URL" ]; then
118+
gh pr edit "$PR_URL" --add-label "automation" --add-assignee jaydeluca
119+
else
120+
echo "No open PR found for branch $BRANCH_NAME."
121+
fi

.github/workflows/ossf-scorecard.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,6 @@ jobs:
4242
# Upload the results to GitHub's code scanning dashboard (optional).
4343
# Commenting out will disable upload of results to your repo's Code Scanning dashboard
4444
- name: "Upload to code-scanning"
45-
uses: github/codeql-action/upload-sarif@4e828ff8d448a8a6e532957b1811f387a63867e8 # v3.29.4
45+
uses: github/codeql-action/upload-sarif@51f77329afa6477de8c49fc9c7046c15b9a4e79d # v3.29.5
4646
with:
4747
sarif_file: results.sarif

.github/workflows/publish-petclinic-benchmark-image.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
2323

2424
- name: Login to GitHub container registry
25-
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
25+
uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0
2626
with:
2727
registry: ghcr.io
2828
username: ${{ github.repository_owner }}

.github/workflows/publish-smoke-test-early-jdk8-images.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
java-version-file: .java-version
3232

3333
- name: Login to GitHub package registry
34-
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
34+
uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0
3535
with:
3636
registry: ghcr.io
3737
username: ${{ github.repository_owner }}

.github/workflows/publish-smoke-test-fake-backend-images.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
java-version-file: .java-version
3232

3333
- name: Login to GitHub package registry
34-
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
34+
uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0
3535
with:
3636
registry: ghcr.io
3737
username: ${{ github.repository_owner }}

.github/workflows/publish-smoke-test-servlet-images.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ jobs:
6666
java-version-file: .java-version
6767

6868
- name: Login to GitHub package registry
69-
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
69+
uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0
7070
with:
7171
registry: ghcr.io
7272
username: ${{ github.repository_owner }}

.github/workflows/reusable-publish-smoke-test-images.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
java-version-file: .java-version
5252

5353
- name: Login to GitHub package registry
54-
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
54+
uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0
5555
with:
5656
registry: ghcr.io
5757
username: ${{ github.repository_owner }}

benchmark-overhead/src/test/java/io/opentelemetry/agents/LatestAgentSnapshotResolver.java

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import java.nio.file.Paths;
1414
import java.nio.file.StandardOpenOption;
1515
import java.util.Optional;
16+
import java.time.Duration;
1617
import okhttp3.OkHttpClient;
1718
import okhttp3.Request;
1819
import okhttp3.Response;
@@ -30,6 +31,11 @@ public class LatestAgentSnapshotResolver {
3031
"https://oss.sonatype.org/content/repositories/snapshots/io/opentelemetry/javaagent/opentelemetry-javaagent";
3132
static final String LATEST_SNAPSHOT_META = BASE_URL + "/maven-metadata.xml";
3233

34+
private static final OkHttpClient client = new OkHttpClient.Builder()
35+
.connectTimeout(Duration.ofMinutes(1))
36+
.readTimeout(Duration.ofMinutes(1))
37+
.build();
38+
3339
Optional<Path> resolve() throws IOException {
3440
String version = fetchLatestSnapshotVersion();
3541
logger.info("Latest snapshot version is {}", version);
@@ -81,11 +87,33 @@ private byte[] fetchBodyBytesFrom(String url) throws IOException {
8187
return fetchBodyFrom(url).bytes();
8288
}
8389

90+
// The sonatype repository can be very unreliable, so we retry a few times
8491
private ResponseBody fetchBodyFrom(String url) throws IOException {
8592
Request request = new Request.Builder().url(url).build();
86-
OkHttpClient client = new OkHttpClient();
87-
Response response = client.newCall(request).execute();
88-
ResponseBody body = response.body();
89-
return body;
93+
IOException lastException = null;
94+
95+
for (int attempt = 0; attempt < 3; attempt++) {
96+
try {
97+
try (Response response = client.newCall(request).execute()) {
98+
if (!response.isSuccessful()) {
99+
throw new IOException("Unexpected HTTP code " + response.code() + " for " + url);
100+
}
101+
ResponseBody body = response.body();
102+
if (body != null) {
103+
byte[] data = body.bytes();
104+
return ResponseBody.create(data, body.contentType());
105+
} else {
106+
throw new IOException("Response body is null");
107+
}
108+
}
109+
} catch (IOException e) {
110+
lastException = e;
111+
if (attempt < 2) {
112+
logger.warn("Attempt {} to fetch {} failed: {}. Retrying...", attempt + 1, url, e.getMessage());
113+
}
114+
}
115+
}
116+
throw lastException;
90117
}
91118
}
119+

0 commit comments

Comments
 (0)