Skip to content

Commit 9d3b99f

Browse files
merge main
2 parents b28a200 + 23b6953 commit 9d3b99f

File tree

407 files changed

+6169
-4016
lines changed

Some content is hidden

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

407 files changed

+6169
-4016
lines changed

.fossa.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ targets:
7676
- type: gradle
7777
path: ./
7878
target: ':instrumentation:apache-dubbo-2.7:library-autoconfigure'
79+
- type: gradle
80+
path: ./
81+
target: ':instrumentation:apache-elasticjob-3.0:javaagent'
7982
- type: gradle
8083
path: ./
8184
target: ':instrumentation:apache-httpasyncclient-4.1:javaagent'
@@ -829,6 +832,9 @@ targets:
829832
- type: gradle
830833
path: ./
831834
target: ':instrumentation:opentelemetry-api:opentelemetry-api-1.52:javaagent'
835+
- type: gradle
836+
path: ./
837+
target: ':instrumentation:opentelemetry-api:opentelemetry-api-1.56:javaagent'
832838
- type: gradle
833839
path: ./
834840
target: ':instrumentation:opentelemetry-instrumentation-annotations:opentelemetry-instrumentation-annotations-1.16:javaagent'

.github/config/lychee.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Lychee configuration file
2-
# See https://lychee.cli.rs/config/
2+
# See https://lychee.cli.rs/guides/config/
33

44
timeout = 30
55
retry_wait_time = 5

.github/config/markdownlint.yml

Lines changed: 0 additions & 14 deletions
This file was deleted.

.github/copilot-instructions.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# OpenTelemetry Java Instrumentation
2+
3+
## Testing
4+
5+
Tests use AssertJ for assertions and JUnit 5 as the testing framework
6+
7+
Test classes and methods should not be public
8+
9+
When registering tests in gradle configurations, if using `val testName by registering(Test::class) {`...
10+
then you need to include `testClassesDirs` and `classpath` like so:
11+
12+
```
13+
val testExperimental by registering(Test::class) {
14+
testClassesDirs = sourceSets.test.get().output.classesDirs
15+
classpath = sourceSets.test.get().runtimeClasspath
16+
...
17+
}
18+
```
19+
20+
## General Java guidelines
21+
22+
* Always import classes when possible (i.e. don't use fully qualified class names in code).
23+
24+
## Gradle CLI
25+
26+
Never use the `--rerun-tasks` flag unless explicitly asked to use this option.
27+
28+
Gradle automatically detects changes and re-runs tasks automatically when needed. Using `--rerun-tasks`
29+
is wasteful and slows down builds unnecessarily.
30+
31+
## Throwing exceptions
32+
33+
When writing instrumentation, you have to be really careful about throwing exceptions. For library
34+
instrumentations it might be acceptable, but in javaagent code you shouldn't throw exceptions
35+
(keep in mind that javaagent instrumentations sometimes use library instrumentations).
36+
37+
In javaagent instrumentations we try not to break applications. If there are changes in the instrumented
38+
library that are not compatible with the instrumentation we disable the instrumentation instead of letting
39+
it fail. This is handled by muzzle. In javaagent instrumentations you should not fail if the methods
40+
that you need don't exist.
41+
42+
## Javaagent Instrumentation
43+
44+
### Java8BytecodeBridge
45+
46+
When to use `Java8BytecodeBridge.currentContext()` vs `Context.current()` ?
47+
48+
Using `Context.current()` is preferred. `Java8BytecodeBridge.currentContext()` is for using inside
49+
advice. We need this method because advice code is inlined in the instrumented method as it is.
50+
Since `Context.current()` is a static interface method it will cause a bytecode verification error
51+
when it is inserted into a pre 8 class. `Java8BytecodeBridge.currentContext()` is a regular class
52+
static method and can be used in any class version.

.github/renovate.json5

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,22 @@
189189
enabled: false,
190190
},
191191
{
192-
// intentionally using Spring Boot 2 in these smoke tests
192+
// intentionally using Spring Boot 2 to make sure the earliest version is supported
193+
matchFileNames: [
194+
'smoke-tests/images/spring-boot/build.gradle.kts',
195+
'smoke-tests-otel-starter/spring-boot-2/build.gradle.kts',
196+
'smoke-tests-otel-starter/spring-boot-common/build.gradle.kts',
197+
'smoke-tests-otel-starter/spring-boot-reactive-2/build.gradle.kts',
198+
'smoke-tests-otel-starter/spring-boot-reactive-common/build.gradle.kts',
199+
'smoke-tests-otel-starter/spring-smoke-testing/build.gradle.kts',
200+
],
201+
matchPackageNames: [
202+
'org.springframework.boot:spring-boot-dependencies',
203+
],
204+
enabled: false
205+
},
206+
{
207+
// Spring Boot 2 smoke tests are intentionally using slf4j 1.x
193208
matchFileNames: [
194209
'smoke-tests/images/spring-boot/build.gradle.kts',
195210
'smoke-tests-otel-starter/spring-boot-2/build.gradle.kts',
@@ -200,7 +215,6 @@
200215
],
201216
matchPackageNames: [
202217
'org.slf4j:slf4j-api',
203-
'org.springframework.boot:**',
204218
],
205219
matchUpdateTypes: [
206220
'major',
@@ -323,19 +337,6 @@
323337
],
324338
allowedVersions: '/^1\\.3\\./',
325339
},
326-
{
327-
// intentionally using Spring Boot 2 in dependency management (for Java 8 support)
328-
matchFileNames: [
329-
'dependencyManagement/build.gradle.kts',
330-
],
331-
matchUpdateTypes: [
332-
'major',
333-
],
334-
enabled: false,
335-
matchPackageNames: [
336-
'org.springframework.boot:spring-boot-dependencies:**',
337-
],
338-
},
339340
{
340341
// pinned version to Jetty 8 (Servlet 3.0) for compatibility
341342
matchFileNames: [

.github/repository-settings.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ private admin repo.
1414
- `GRADLE_PUBLISH_KEY` - owned by [@trask](https://github.com/trask)
1515
- `GRADLE_PUBLISH_SECRET` - owned by [@trask](https://github.com/trask)
1616
- `NVD_API_KEY` - stored in OpenTelemetry-Java 1Password
17-
- Generated at https://nvd.nist.gov/developers/request-an-api-key
17+
- Generated at <https://nvd.nist.gov/developers/request-an-api-key>
1818
- Key is associated with [@trask](https://github.com/trask)'s gmail address
1919
- `SONATYPE_KEY` - owned by [@trask](https://github.com/trask)
2020
- `SONATYPE_USER` - owned by [@trask](https://github.com/trask)

.github/scripts/check-javaagent-suppression-keys.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#!/bin/bash -e
22

3-
# shellcheck disable=SC2044
43
for file in $(find instrumentation -name "*Module.java"); do
54

65
if ! grep -q "extends InstrumentationModule" "$file"; then
@@ -11,9 +10,7 @@ for file in $(find instrumentation -name "*Module.java"); do
1110
continue
1211
fi
1312

14-
# shellcheck disable=SC2001
1513
module_name=$(echo "$file" | sed 's#.*/\([^/]*\)/javaagent/src/.*#\1#')
16-
# shellcheck disable=SC2001
1714
simple_module_name=$(echo "$module_name" | sed 's/-[0-9.]*$//')
1815

1916
if [[ "$simple_module_name" == *jaxrs* ]]; then

.github/scripts/check-package-names.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#!/bin/bash -e
22

3-
# shellcheck disable=SC2001
4-
53
for dir in $(find instrumentation -name "*.java" | grep library/src/main/java | sed 's#/[^/]*$##' | sort -u); do
64

75
module_name=$(echo "$dir" | sed 's#.*/\([^/]*\)/library/src/main/java/.*#\1#')

.github/scripts/diff-suppression-keys-with-docs.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ curl https://raw.githubusercontent.com/open-telemetry/opentelemetry.io/main/cont
99

1010
comm -3 \
1111
<(
12-
# shellcheck disable=SC2016 # "Expressions don't expand in single quotes"
1312
sed -n '/----------------------/,${p;/^$/q}' agent-config.md \
1413
| sed '1d;$d' \
1514
| cut -d '|' -f 3 \

.github/scripts/generate-release-contributors.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ from=$(git log --reverse --pretty=format:"%cI" "$from_version..HEAD" | head -1)
1515
# get the last commit on main that was included in the release
1616
to=$(git merge-base origin/main HEAD | xargs git log -1 --pretty=format:"%cI")
1717

18-
# shellcheck disable=SC2016 # "Expressions don't expand in single quotes"
1918
contributors1=$(gh api graphql --paginate -F q="repo:$GITHUB_REPOSITORY is:pr base:main is:merged merged:$from..$to" -f query='
2019
query($q: String!, $endCursor: String) {
2120
search(query: $q, type: ISSUE, first: 100, after: $endCursor) {
@@ -53,7 +52,6 @@ query($q: String!, $endCursor: String) {
5352

5453
# this query captures authors of issues which have had PRs in the current range reference the issue
5554
# but not necessarily through closingIssuesReferences (e.g. addressing just a part of an issue)
56-
# shellcheck disable=SC2016 # "Expressions don't expand in single quotes"
5755
contributors2=$(gh api graphql --paginate -F q="repo:$GITHUB_REPOSITORY is:pr base:main is:merged merged:$from..$to" -f query='
5856
query($q: String!, $endCursor: String) {
5957
search(query: $q, type: ISSUE, first: 100, after: $endCursor) {

0 commit comments

Comments
 (0)