Skip to content

Commit 49f47f1

Browse files
authored
Merge branch 'main' into kafka-connect
2 parents 34dec15 + 21d5470 commit 49f47f1

File tree

49 files changed

+1196
-711
lines changed

Some content is hidden

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

49 files changed

+1196
-711
lines changed

.github/scripts/draft-change-log-entries.sh

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,31 +15,29 @@ if [[ $minor == 0 ]]; then
1515
prior_minor=$(sed -n "s/^## Version $prior_major\.\([0-9]\+\)\..*/\1/p" CHANGELOG.md | head -1)
1616
if [[ -z $prior_minor ]]; then
1717
# assuming this is the first release
18-
range=
18+
range=HEAD
1919
else
2020
range="v$prior_major.$prior_minor.0..HEAD"
2121
fi
2222
else
2323
range="v$major.$((minor - 1)).0..HEAD"
2424
fi
2525

26-
echo "## Unreleased"
27-
echo
28-
echo "### Migration notes"
26+
echo "# Changelog"
2927
echo
28+
echo "## Unreleased"
3029
echo
30+
31+
"$(dirname "$0")/extract-labeled-prs.sh" "$range"
32+
3133
echo "### 🌟 New javaagent instrumentation"
3234
echo
33-
echo
3435
echo "### 🌟 New library instrumentation"
3536
echo
36-
echo
3737
echo "### 📈 Enhancements"
3838
echo
39-
echo
4039
echo "### 🛠️ Bug fixes"
4140
echo
42-
echo
4341
echo "### 🧰 Tooling"
4442
echo
4543

@@ -48,4 +46,5 @@ git log --reverse \
4846
--author='^(?!renovate\[bot\] )' \
4947
--pretty=format:"- %s" \
5048
"$range" \
51-
| sed -E 's,\(#([0-9]+)\)$,\n ([#\1](https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/\1)),'
49+
| sed -E 's, *\(#([0-9]+)\)$,\n ([#\1](https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/\1)),'
50+
echo
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
#!/bin/bash -e
2+
3+
# This script extracts PRs with "breaking change" and "deprecation" labels for the given version range
4+
# Usage: extract-labeled-prs.sh [git-range]
5+
# If no range is provided, it uses HEAD
6+
7+
range="${1:-HEAD}"
8+
9+
# Get the date range for filtering
10+
if [[ "$range" == "HEAD" ]]; then
11+
# Get all commits from HEAD
12+
oldest_commit=$(git log --reverse --pretty=format:"%H" HEAD | head -1)
13+
since_date=$(git show -s --format=%ci "$oldest_commit" | cut -d' ' -f1)
14+
else
15+
# Get commits in the specified range
16+
if [[ $range =~ ^(.+)\.\.(.+)$ ]]; then
17+
from_ref="${BASH_REMATCH[1]}"
18+
oldest_commit=$(git rev-parse "$from_ref")
19+
since_date=$(git show -s --format=%ci "$oldest_commit" | cut -d' ' -f1)
20+
else
21+
echo "[ERROR] Invalid range format: $range" >&2
22+
exit 1
23+
fi
24+
fi
25+
26+
# Initialize tracking variables
27+
breaking_changes=""
28+
deprecations=""
29+
breaking_changes_found=false
30+
deprecations_found=false
31+
32+
# Get PRs with "breaking change" label using GitHub search
33+
breaking_prs=$(gh pr list \
34+
--repo open-telemetry/opentelemetry-java-instrumentation \
35+
--label "breaking change" \
36+
--state merged \
37+
--search "merged:>=$since_date" \
38+
--json number,title \
39+
--jq '.[] | "\(.number)|\(.title)"' 2>/dev/null || echo "")
40+
41+
if [[ -n "$breaking_prs" ]]; then
42+
breaking_changes_found=true
43+
while IFS='|' read -r pr_number pr_title; do
44+
breaking_changes+="- $pr_title"$'\n'" ([#$pr_number](https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/$pr_number))"$'\n'
45+
done <<< "$breaking_prs"
46+
fi
47+
48+
# Get PRs with "deprecation" label using GitHub search
49+
deprecation_prs=$(gh pr list \
50+
--repo open-telemetry/opentelemetry-java-instrumentation \
51+
--label "deprecation" \
52+
--state merged \
53+
--search "merged:>=$since_date" \
54+
--json number,title \
55+
--jq '.[] | "\(.number)|\(.title)"' 2>/dev/null || echo "")
56+
57+
if [[ -n "$deprecation_prs" ]]; then
58+
deprecations_found=true
59+
while IFS='|' read -r pr_number pr_title; do
60+
deprecations+="- $pr_title"$'\n'" ([#$pr_number](https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/$pr_number))"$'\n'
61+
done <<< "$deprecation_prs"
62+
fi
63+
64+
# Output breaking changes section
65+
if [[ "$breaking_changes_found" == "true" ]]; then
66+
echo "### ⚠️ Breaking Changes"
67+
echo
68+
echo -n "$breaking_changes"
69+
echo
70+
fi
71+
72+
# Output deprecations section
73+
if [[ "$deprecations_found" == "true" ]]; then
74+
echo "### 🚫 Deprecations"
75+
echo
76+
echo -n "$deprecations"
77+
echo
78+
fi
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
name: PR Automation Comments
2+
on:
3+
pull_request:
4+
types: [labeled]
5+
6+
permissions:
7+
pull-requests: write
8+
9+
jobs:
10+
comment-on-breaking-change:
11+
if: contains(github.event.label.name, 'breaking change')
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Comment on PR
15+
uses: actions/github-script@v7
16+
with:
17+
script: |
18+
const { data: comments } = await github.rest.issues.listComments({
19+
owner: context.repo.owner,
20+
repo: context.repo.repo,
21+
issue_number: context.issue.number,
22+
});
23+
24+
// Check if we've already commented about breaking changes
25+
const botComment = comments.find(comment =>
26+
comment.user.login === 'github-actions[bot]' &&
27+
comment.body.includes('⚠️ Breaking Change Documentation Required')
28+
);
29+
30+
if (!botComment) {
31+
const commentBody = [
32+
"## ⚠️ Breaking Change Documentation Required",
33+
"",
34+
"This PR has been labeled as a **breaking change**. Please ensure you provide the following information:",
35+
"",
36+
"### Migration Notes Required",
37+
"Please add detailed migration notes to help users understand:",
38+
"- What is changing and why",
39+
"- How to update their code/configuration",
40+
"- Any alternative approaches if applicable",
41+
"- Code examples showing before/after usage",
42+
"",
43+
"### Checklist",
44+
"- [ ] Migration notes added to the PR description",
45+
"- [ ] Breaking change is documented in the changelog entry for the next release",
46+
"- [ ] Consider if this change requires a major version bump",
47+
"",
48+
"Your migration notes will be included in the release notes to help users upgrade smoothly. The more detailed and helpful they are, the better the user experience will be.",
49+
"",
50+
"---",
51+
"*This comment was automatically generated because the `breaking change` label was applied to this PR.*"
52+
].join("\n");
53+
54+
await github.rest.issues.createComment({
55+
owner: context.repo.owner,
56+
repo: context.repo.repo,
57+
issue_number: context.issue.number,
58+
body: commentBody
59+
});
60+
}
61+
62+
comment-on-deprecation:
63+
if: contains(github.event.label.name, 'deprecation')
64+
runs-on: ubuntu-latest
65+
steps:
66+
- name: Comment on PR
67+
uses: actions/github-script@v7
68+
with:
69+
script: |
70+
const { data: comments } = await github.rest.issues.listComments({
71+
owner: context.repo.owner,
72+
repo: context.repo.repo,
73+
issue_number: context.issue.number,
74+
});
75+
76+
// Check if we've already commented about deprecation
77+
const botComment = comments.find(comment =>
78+
comment.user.login === 'github-actions[bot]' &&
79+
comment.body.includes('📋 Deprecation Notice')
80+
);
81+
82+
if (!botComment) {
83+
const commentBody = [
84+
"## 📋 Deprecation Notice",
85+
"",
86+
"This PR has been labeled as a **deprecation**. Please ensure you provide the following information:",
87+
"",
88+
"### 📝 Deprecation Details Required",
89+
"Please add details to help users understand:",
90+
"- What is being deprecated and why",
91+
"- What should be used instead (if applicable)",
92+
"- Timeline for removal (if known)",
93+
"- Any migration guidance",
94+
"",
95+
"### 📋 Checklist",
96+
"- [ ] Deprecation details added to the PR description",
97+
"- [ ] Deprecation is documented in the changelog entry for the next release",
98+
"- [ ] Consider adding deprecation warnings in code/documentation",
99+
"",
100+
"Your deprecation notes will be included in the release notes to help users prepare for future changes.",
101+
"",
102+
"---",
103+
"*This comment was automatically generated because the `deprecation` label was applied to this PR.*"
104+
].join("\n");
105+
106+
await github.rest.issues.createComment({
107+
owner: context.repo.owner,
108+
repo: context.repo.repo,
109+
issue_number: context.issue.number,
110+
body: commentBody
111+
});
112+
}
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: PR Label Automation
2+
on:
3+
issue_comment:
4+
types: [created]
5+
6+
permissions:
7+
contents: read
8+
issues: write
9+
pull-requests: write
10+
11+
jobs:
12+
auto-label:
13+
# Only run on pull request comments
14+
if: github.event.issue.pull_request != null
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Add breaking change label
18+
if: github.event.comment.body == '/breaking-change'
19+
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
20+
with:
21+
script: |
22+
// Add the breaking change label
23+
await github.rest.issues.addLabels({
24+
owner: context.repo.owner,
25+
repo: context.repo.repo,
26+
issue_number: context.issue.number,
27+
labels: ['breaking change']
28+
});
29+
30+
// React to the comment to show it was processed
31+
await github.rest.reactions.createForIssueComment({
32+
owner: context.repo.owner,
33+
repo: context.repo.repo,
34+
comment_id: context.payload.comment.id,
35+
content: '+1'
36+
});
37+
38+
// Add a reply comment to confirm the action
39+
await github.rest.issues.createComment({
40+
owner: context.repo.owner,
41+
repo: context.repo.repo,
42+
issue_number: context.issue.number,
43+
body: '✅ Added `breaking change` label to this PR.'
44+
});
45+
46+
- name: Add deprecation label
47+
if: github.event.comment.body == '/deprecation'
48+
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
49+
with:
50+
script: |
51+
// Add the deprecation label
52+
await github.rest.issues.addLabels({
53+
owner: context.repo.owner,
54+
repo: context.repo.repo,
55+
issue_number: context.issue.number,
56+
labels: ['deprecation']
57+
});
58+
59+
// React to the comment to show it was processed
60+
await github.rest.reactions.createForIssueComment({
61+
owner: context.repo.owner,
62+
repo: context.repo.repo,
63+
comment_id: context.payload.comment.id,
64+
content: '+1'
65+
});
66+
67+
// Add a reply comment to confirm the action
68+
await github.rest.issues.createComment({
69+
owner: context.repo.owner,
70+
repo: context.repo.repo,
71+
issue_number: context.issue.number,
72+
body: '✅ Added `deprecation` label to this PR.'
73+
});

CONTRIBUTING.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,37 @@ Before submitting new features or changes to current functionality, it is recomm
66
[open an issue](https://github.com/open-telemetry/opentelemetry-java-instrumentation/issues/new)
77
and discuss your ideas or propose the changes you wish to make.
88

9+
10+
## Breaking Changes
11+
12+
When your PR introduces a breaking change:
13+
14+
* Add the `breaking change` label to your PR
15+
- If you can't add labels directly, post a comment containing only `/breaking-change` and the label will be added automatically
16+
* Provide migration notes in the PR description:
17+
- What is changing and why
18+
- How users should update their code/configuration
19+
- Code examples showing before/after usage (if applicable)
20+
21+
**When to Use:**
22+
23+
* API changes that break backward compatibility
24+
* Configuration changes that require user action
25+
* Behavioral changes that might affect existing users
26+
* Removal of deprecated features
27+
28+
## Deprecations
29+
30+
When your PR deprecates functionality:
31+
32+
* Add the `deprecation` label to your PR
33+
- If you can't add labels directly, post a comment containing only `/deprecation` and the label will be added automatically
34+
* Provide deprecation details in the PR description:
35+
- What is being deprecated and why
36+
- What should be used instead (if applicable)
37+
- Timeline for removal (if known)
38+
- Any migration guidance
39+
940
## Building
1041

1142
This project requires Java 21 to build and run tests. Newer JDK's may work, but this version is used in CI.

RELEASING.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ the second Monday of the month (roughly a few days after the monthly minor relea
2929
- Merge a pull request to `main` updating the `CHANGELOG.md`.
3030
- The heading for the unreleased entries should be `## Unreleased`.
3131
- Use `.github/scripts/draft-change-log-entries.sh` as a starting point for writing the change log.
32+
- The script will automatically include a "Breaking Changes" section for PRs labeled with `breaking change`.
33+
- The script will automatically include a "Deprecations" section for PRs labeled with `deprecation`.
3234
- Run the [Prepare release branch workflow](https://github.com/open-telemetry/opentelemetry-java-instrumentation/actions/workflows/prepare-release-branch.yml).
3335
- Press the "Run workflow" button, and leave the default branch `main` selected.
3436
- Review and merge the two pull requests that it creates

conventions/src/main/kotlin/otel.java-conventions.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,6 @@ testing {
209209
implementation("org.slf4j:log4j-over-slf4j")
210210
implementation("org.slf4j:jcl-over-slf4j")
211211
implementation("org.slf4j:jul-to-slf4j")
212-
implementation("com.github.stefanbirkner:system-rules")
213212
}
214213
}
215214
}

dependencyManagement/build.gradle.kts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,6 @@ val DEPENDENCIES = listOf(
8686

8787
"io.r2dbc:r2dbc-proxy:1.1.6.RELEASE",
8888
"ch.qos.logback:logback-classic:1.3.15", // 1.4+ requires Java 11+
89-
"com.github.stefanbirkner:system-lambda:1.2.1",
90-
"com.github.stefanbirkner:system-rules:1.19.0",
9189
"uk.org.webcompere:system-stubs-jupiter:2.0.3",
9290
"com.uber.nullaway:nullaway:0.12.10",
9391
"commons-beanutils:commons-beanutils:1.11.0",

0 commit comments

Comments
 (0)