Skip to content

Commit a1e4abb

Browse files
authored
Merge branch 'main' into zhaez/merge-releases
2 parents 6445cff + 9b5c640 commit a1e4abb

File tree

23 files changed

+3671
-29
lines changed

23 files changed

+3671
-29
lines changed

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

Lines changed: 3116 additions & 0 deletions
Large diffs are not rendered by default.

.github/patches/versions

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
OTEL_JAVA_INSTRUMENTATION_VERSION=v2.18.1
2+
OTEL_JAVA_CONTRIB_VERSION=v1.48.0

.github/workflows/owasp.yml renamed to .github/workflows/daily-scan.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ jobs:
112112
id: high_scan_v2
113113
uses: ./.github/actions/image_scan
114114
with:
115-
image-ref: "public.ecr.aws/aws-observability/adot-autoinstrumentation-java:v2.11.3"
115+
image-ref: "public.ecr.aws/aws-observability/adot-autoinstrumentation-java:v2.11.4"
116116
severity: 'CRITICAL,HIGH'
117117
logout: 'false'
118118

@@ -121,7 +121,7 @@ jobs:
121121
id: low_scan_v2
122122
uses: ./.github/actions/image_scan
123123
with:
124-
image-ref: "public.ecr.aws/aws-observability/adot-autoinstrumentation-java:v2.11.3"
124+
image-ref: "public.ecr.aws/aws-observability/adot-autoinstrumentation-java:v2.11.4"
125125
severity: 'MEDIUM,LOW,UNKNOWN'
126126
logout: 'false'
127127

.github/workflows/main-build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ jobs:
256256
aws s3 cp ./build/distributions/aws-opentelemetry-java-layer.zip s3://adot-main-build-staging-jar/adot-java-lambda-layer-${{ github.run_id }}.zip
257257
258258
application-signals-e2e-test:
259+
name: "Application Signals E2E Test"
259260
needs: [build, application-signals-lambda-layer-build]
260261
uses: ./.github/workflows/application-signals-e2e-test.yml
261262
secrets: inherit
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
name: Post Release - Prepare Main for Next Development Cycle
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Version number (e.g., 1.0.1)'
8+
required: true
9+
10+
env:
11+
AWS_DEFAULT_REGION: us-east-1
12+
13+
permissions:
14+
id-token: write
15+
contents: write
16+
pull-requests: write
17+
18+
jobs:
19+
check-version:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout main
23+
uses: actions/checkout@v2
24+
with:
25+
ref: main
26+
fetch-depth: 0
27+
28+
- name: Extract Major.Minor Version and setup Env variable
29+
run: |
30+
echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV
31+
echo "MAJOR_MINOR=$(echo ${{ github.event.inputs.version }} | sed -E 's/([0-9]+\.[0-9]+)\.[0-9]+/\1/')" >> $GITHUB_ENV
32+
33+
- name: Get current major.minor version from main branch
34+
id: get_version
35+
run: |
36+
CURRENT_VERSION=$(grep '__version__' aws-opentelemetry-distro/src/amazon/opentelemetry/distro/version.py | sed -E 's/__version__ = "([0-9]+\.[0-9]+)\.[0-9]+.*"/\1/')
37+
echo "CURRENT_MAJOR_MINOR_VERSION=$CURRENT_VERSION" >> $GITHUB_ENV
38+
39+
- name: Set major and minor for current version
40+
run: |
41+
echo "CURRENT_MAJOR=$(echo $CURRENT_MAJOR_MINOR_VERSION | cut -d. -f1)" >> $GITHUB_ENV
42+
echo "CURRENT_MINOR=$(echo $CURRENT_MAJOR_MINOR_VERSION | cut -d. -f2)" >> $GITHUB_ENV
43+
44+
- name: Set major and minor for input version
45+
run: |
46+
echo "INPUT_MAJOR=$(echo $MAJOR_MINOR | cut -d. -f1)" >> $GITHUB_ENV
47+
echo "INPUT_MINOR=$(echo $MAJOR_MINOR | cut -d. -f2)" >> $GITHUB_ENV
48+
49+
- name: Compare major.minor version and skip if behind
50+
run: |
51+
if [ "$CURRENT_MAJOR" -gt "$INPUT_MAJOR" ] || { [ "$CURRENT_MAJOR" -eq "$INPUT_MAJOR" ] && [ "$CURRENT_MINOR" -gt "$INPUT_MINOR" ]; }; then
52+
echo "Input version is behind main's current major.minor version, don't need to update major version"
53+
exit 1
54+
fi
55+
56+
57+
prepare-main:
58+
runs-on: ubuntu-latest
59+
needs: check-version
60+
steps:
61+
- name: Configure AWS credentials for BOT secrets
62+
uses: aws-actions/configure-aws-credentials@v4
63+
with:
64+
role-to-assume: ${{ secrets.AWS_ROLE_ARN_SECRETS_MANAGER }}
65+
aws-region: ${{ env.AWS_DEFAULT_REGION }}
66+
67+
- name: Get Bot secrets
68+
uses: aws-actions/aws-secretsmanager-get-secrets@v1
69+
id: bot_secrets
70+
with:
71+
secret-ids: |
72+
BOT_TOKEN ,${{ secrets.BOT_TOKEN_SECRET_ARN }}
73+
parse-json-secrets: true
74+
75+
- name: Setup Git
76+
uses: actions/checkout@v2
77+
with:
78+
fetch-depth: 0
79+
token: ${{ env.BOT_TOKEN_GITHUB_RW_PATOKEN }}
80+
81+
- name: Configure Git
82+
run: |
83+
git config user.name "github-actions"
84+
git config user.email "[email protected]"
85+
86+
- name: Extract Major.Minor Version and setup Env variable
87+
run: |
88+
echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV
89+
echo "MAJOR_MINOR=$(echo ${{ github.event.inputs.version }} | sed -E 's/([0-9]+\.[0-9]+)\.[0-9]+/\1/')" >> $GITHUB_ENV
90+
91+
- name: Determine release branch and checkout
92+
run: |
93+
RELEASE_BRANCH="release/v${MAJOR_MINOR}.x"
94+
git fetch origin $RELEASE_BRANCH
95+
git checkout -b "prepare-main-for-next-dev-cycle-${VERSION}" origin/$RELEASE_BRANCH
96+
97+
- name: Update version to next development version in main
98+
run: |
99+
DEV_VERSION="${{ github.event.inputs.version }}.dev0"
100+
sed -i'' -e "s/val adotVersion = \".*\"/val adotVersion = \"${DEV_VERSION}\"/" version.gradle.kts
101+
VERSION="${{ github.event.inputs.version }}"
102+
sed -i'' -e 's/adot-autoinstrumentation-java:v2.*"/adot-autoinstrumentation-java:v'$VERSION'"/' .github/workflows/daily-scan.yml
103+
git add version.gradle.kts
104+
git add .github/workflows/daily-scan.yml
105+
git commit -m "Prepare main for next development cycle: Update version to $DEV_VERSION"
106+
git push --set-upstream origin "prepare-main-for-next-dev-cycle-${VERSION}"
107+
108+
- name: Create Pull Request to main
109+
env:
110+
GITHUB_TOKEN: ${{ env.BOT_TOKEN_GITHUB_RW_PATOKEN }}
111+
run: |
112+
DEV_VERSION="${{ github.event.inputs.version }}.dev0"
113+
gh pr create --title "Post release $VERSION: Update version to $DEV_VERSION" \
114+
--body "This PR prepares the main branch for the next development cycle by updating the version to $DEV_VERSION and updating the image version to be scanned to the latest released.
115+
116+
This PR should only be merge when release for version v$VERSION is success.
117+
118+
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice." \
119+
--head prepare-main-for-next-dev-cycle-${VERSION} \
120+
--base main
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
name: Pre Release Prepare - Update Version and Create PR
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Version number (e.g., 1.0.1)'
8+
required: true
9+
is_patch:
10+
description: 'Is this a patch? (true or false)'
11+
required: true
12+
default: 'false'
13+
14+
env:
15+
AWS_DEFAULT_REGION: us-east-1
16+
17+
permissions:
18+
contents: write
19+
pull-requests: write
20+
id-token: write
21+
22+
23+
jobs:
24+
update-version-and-create-pr:
25+
runs-on: ubuntu-latest
26+
steps:
27+
- name: Configure AWS credentials for BOT secrets
28+
uses: aws-actions/configure-aws-credentials@v4
29+
with:
30+
role-to-assume: ${{ secrets.AWS_ROLE_ARN_SECRETS_MANAGER }}
31+
aws-region: ${{ env.AWS_DEFAULT_REGION }}
32+
33+
- name: Get Bot secrets
34+
uses: aws-actions/aws-secretsmanager-get-secrets@v1
35+
id: bot_secrets
36+
with:
37+
secret-ids: |
38+
BOT_TOKEN ,${{ secrets.BOT_TOKEN_SECRET_ARN }}
39+
parse-json-secrets: true
40+
41+
- name: Checkout main branch
42+
uses: actions/checkout@v3
43+
with:
44+
ref: 'main'
45+
token: ${{ env.BOT_TOKEN_GITHUB_RW_PATOKEN }}
46+
47+
- name: Setup Git
48+
run: |
49+
git config user.name "github-actions"
50+
git config user.email "[email protected]"
51+
52+
- name: Extract Major.Minor Version and setup Env variable
53+
run: |
54+
echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV
55+
echo "MAJOR_MINOR=$(echo ${{ github.event.inputs.version }} | sed -E 's/([0-9]+\.[0-9]+)\.[0-9]+/\1/')" >> $GITHUB_ENV
56+
57+
- name: Create branches
58+
run: |
59+
IS_PATCH=${{ github.event.inputs.is_patch }}
60+
if [[ "$IS_PATCH" != "true" && "$IS_PATCH" != "false" ]]; then
61+
echo "Invalid input for IS_PATCH. Must be 'true' or 'false'."
62+
exit 1
63+
fi
64+
65+
66+
if git ls-remote --heads origin release/v${MAJOR_MINOR}.x | grep -q "release/v${MAJOR_MINOR}.x"; then
67+
if [ "$IS_PATCH" = "true" ]; then
68+
git fetch origin release/v${MAJOR_MINOR}.x
69+
echo "Branch release/v${MAJOR_MINOR}.x already exists, checking out."
70+
git checkout "release/v${MAJOR_MINOR}.x"
71+
else
72+
echo "Error, release series branch release/v${MAJOR_MINOR}.x exist for non-patch release"
73+
echo "Check your input or branch"
74+
exit 1
75+
fi
76+
else
77+
if [ "$IS_PATCH" = "true" ]; then
78+
echo "Error, release series branch release/v${MAJOR_MINOR}.x NOT exist for patch release"
79+
echo "Check your input or branch"
80+
exit 1
81+
else
82+
echo "Creating branch release/v${MAJOR_MINOR}.x."
83+
git checkout -b "release/v${MAJOR_MINOR}.x"
84+
git push origin "release/v${MAJOR_MINOR}.x"
85+
fi
86+
fi
87+
88+
git checkout -b "v${VERSION}_release"
89+
git push origin "v${VERSION}_release"
90+
91+
- name: Update version in file
92+
run: |
93+
sed -i'' -e "s/val adotVersion = \".*\"/val adotVersion = \"${VERSION}\"/" version.gradle.kts
94+
git commit -am "Update version to ${VERSION}"
95+
git push origin "v${VERSION}_release"
96+
97+
- name: Create pull request against the release branch
98+
env:
99+
GITHUB_TOKEN: ${{ env.BOT_TOKEN_GITHUB_RW_PATOKEN }}
100+
run: |
101+
gh pr create --title "Pre-release: Update version to ${VERSION}" \
102+
--body "This PR updates the version to ${VERSION}.
103+
104+
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice." \
105+
--head v${{ github.event.inputs.version }}_release \
106+
--base release/v${MAJOR_MINOR}.x

.github/workflows/release-build.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,24 @@ jobs:
3131
runs-on: ubuntu-latest
3232
steps:
3333
- uses: actions/checkout@v5
34+
35+
- name: Check main build status
36+
env:
37+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38+
run: |
39+
WORKFLOW_ID=$(gh api repos/${{ github.repository }}/actions/workflows --jq '.workflows[] | select(.name=="Java Agent Main Build") | .id')
40+
LATEST_RUN=$(gh api repos/${{ github.repository }}/actions/workflows/$WORKFLOW_ID/runs --jq '[.workflow_runs[] | select(.head_branch=="${{ github.ref_name }}")] | sort_by(.created_at) | .[-1] | {conclusion, status}')
41+
STATUS=$(echo "$LATEST_RUN" | jq -r '.status')
42+
CONCLUSION=$(echo "$LATEST_RUN" | jq -r '.conclusion')
43+
44+
if [ "$STATUS" = "in_progress" ] || [ "$STATUS" = "queued" ]; then
45+
echo "Main build is still running (status: $STATUS). Cannot proceed with release."
46+
exit 1
47+
elif [ "$CONCLUSION" != "success" ]; then
48+
echo "Latest main build on branch ${{ github.ref_name }} conclusion: $CONCLUSION"
49+
exit 1
50+
fi
51+
echo "Main build succeeded, proceeding with release"
3452
- uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
3553
with:
3654
java-version-file: .java-version

awsagentprovider/build.gradle.kts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,10 @@ dependencies {
3838
implementation("io.opentelemetry.contrib:opentelemetry-aws-xray")
3939
// AWS Resource Detectors
4040
implementation("io.opentelemetry.contrib:opentelemetry-aws-resources")
41-
// Json file reader
41+
// JSON file reader
4242
implementation("com.fasterxml.jackson.core:jackson-databind:2.16.1")
43+
// YAML file reader
44+
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.16.1")
4345
// Import AWS SDK v1 core for ARN parsing utilities
4446
implementation("com.amazonaws:aws-java-sdk-core:1.12.773")
4547
// Export configuration

awsagentprovider/src/main/java/software/amazon/opentelemetry/javaagent/providers/AttributePropagatingSpanProcessor.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ public void onStart(Context parentContext, ReadWriteSpan span) {
112112
if (propagationData != null) {
113113
span.setAttribute(propagationDataKey, propagationData);
114114
}
115+
span.setAttribute(AwsAttributeKeys.AWS_TRACE_FLAG_SAMPLED, span.getSpanContext().isSampled());
115116
}
116117

117118
private boolean isConsumerKind(ReadableSpan span) {

awsagentprovider/src/main/java/software/amazon/opentelemetry/javaagent/providers/AwsAgentPropertiesCustomizerProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public void customize(AutoConfigurationCustomizer autoConfiguration) {
2626
() ->
2727
new HashMap<String, String>() {
2828
{
29-
put("otel.propagators", "baggage,xray,tracecontext,b3,b3multi");
29+
put("otel.propagators", "baggage,xray,tracecontext");
3030
put("otel.instrumentation.aws-sdk.experimental-span-attributes", "true");
3131
put(
3232
"otel.instrumentation.aws-sdk.experimental-record-individual-http-error",

0 commit comments

Comments
 (0)