Skip to content

Commit cc7e61b

Browse files
authored
Merge branch 'main' into suppression-keys
2 parents 46f47a7 + 2c3b50e commit cc7e61b

File tree

128 files changed

+872
-1082
lines changed

Some content is hidden

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

128 files changed

+872
-1082
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash -e
2+
3+
# all missing version coverage should be documented in supported-libraries.md
4+
5+
if grep -r --include build.gradle.kts latestDepTestLibrary instrumentation \
6+
| grep -v :+\" \
7+
| grep -v "// see .* module" \
8+
| grep -v "// see test suite below" \
9+
| grep -v "// no longer applicable" \
10+
| grep -v "// related dependency" \
11+
| grep -v "// native on-by-default instrumentation after this version" \
12+
| grep -v "// documented limitation" \
13+
| grep -v "instrumentation/jaxrs-client/jaxrs-client-2.0-testing/build.gradle.kts"; then
14+
15+
echo
16+
echo "Found an undocumented latestDepTestLibrary (see above)."
17+
echo
18+
echo "See .gith/scripts/check-latest-dep-test-overrides.sh in this repository"
19+
echo "and add one of the required comments."
20+
exit 1
21+
fi

.github/scripts/find-instrumentation-with-upper-version-limits.sh

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

.github/workflows/build-common.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,13 @@ jobs:
126126

127127
- run: .github/scripts/check-javaagent-suppression-keys.sh
128128

129+
check-latest-dep-test-overrides:
130+
runs-on: ubuntu-latest
131+
steps:
132+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
133+
134+
- run: .github/scripts/check-latest-dep-test-overrides.sh
135+
129136
build:
130137
runs-on: ubuntu-latest
131138
steps:

docs/apidiffs/current_vs_latest/opentelemetry-instrumentation-api.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,18 @@ Comparing source compatibility of opentelemetry-instrumentation-api-2.12.0-SNAPS
44
GENERIC TEMPLATES: === REQUEST:java.lang.Object, === RESPONSE:java.lang.Object
55
+++ NEW METHOD: PUBLIC(+) io.opentelemetry.instrumentation.api.semconv.http.HttpClientAttributesExtractorBuilder<REQUEST,RESPONSE> setCapturedRequestHeaders(java.util.Collection<java.lang.String>)
66
+++ NEW METHOD: PUBLIC(+) io.opentelemetry.instrumentation.api.semconv.http.HttpClientAttributesExtractorBuilder<REQUEST,RESPONSE> setCapturedResponseHeaders(java.util.Collection<java.lang.String>)
7+
+++ NEW METHOD: PUBLIC(+) io.opentelemetry.instrumentation.api.semconv.http.HttpClientAttributesExtractorBuilder<REQUEST,RESPONSE> setKnownMethods(java.util.Collection<java.lang.String>)
78
*** MODIFIED CLASS: PUBLIC FINAL io.opentelemetry.instrumentation.api.semconv.http.HttpServerAttributesExtractorBuilder (not serializable)
89
=== CLASS FILE FORMAT VERSION: 52.0 <- 52.0
910
GENERIC TEMPLATES: === REQUEST:java.lang.Object, === RESPONSE:java.lang.Object
1011
+++ NEW METHOD: PUBLIC(+) io.opentelemetry.instrumentation.api.semconv.http.HttpServerAttributesExtractorBuilder<REQUEST,RESPONSE> setCapturedRequestHeaders(java.util.Collection<java.lang.String>)
1112
+++ NEW METHOD: PUBLIC(+) io.opentelemetry.instrumentation.api.semconv.http.HttpServerAttributesExtractorBuilder<REQUEST,RESPONSE> setCapturedResponseHeaders(java.util.Collection<java.lang.String>)
13+
+++ NEW METHOD: PUBLIC(+) io.opentelemetry.instrumentation.api.semconv.http.HttpServerAttributesExtractorBuilder<REQUEST,RESPONSE> setKnownMethods(java.util.Collection<java.lang.String>)
14+
*** MODIFIED CLASS: PUBLIC FINAL io.opentelemetry.instrumentation.api.semconv.http.HttpServerRouteBuilder (not serializable)
15+
=== CLASS FILE FORMAT VERSION: 52.0 <- 52.0
16+
GENERIC TEMPLATES: === REQUEST:java.lang.Object
17+
+++ NEW METHOD: PUBLIC(+) io.opentelemetry.instrumentation.api.semconv.http.HttpServerRouteBuilder<REQUEST> setKnownMethods(java.util.Collection<java.lang.String>)
18+
*** MODIFIED CLASS: PUBLIC FINAL io.opentelemetry.instrumentation.api.semconv.http.HttpSpanNameExtractorBuilder (not serializable)
19+
=== CLASS FILE FORMAT VERSION: 52.0 <- 52.0
20+
GENERIC TEMPLATES: === REQUEST:java.lang.Object
21+
+++ NEW METHOD: PUBLIC(+) io.opentelemetry.instrumentation.api.semconv.http.HttpSpanNameExtractorBuilder<REQUEST> setKnownMethods(java.util.Collection<java.lang.String>)

docs/contributing/using-instrumenter-api.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,16 @@ Response decoratedMethod(Request request) {
8484
}
8585

8686
Context context = instrumenter.start(parentContext, request);
87+
Response response;
8788
try (Scope scope = context.makeCurrent()) {
88-
Response response = actualMethod(request);
89-
instrumenter.end(context, request, response, null);
90-
return response;
91-
} catch (Throwable error) {
92-
instrumenter.end(context, request, null, error);
93-
throw error;
89+
response = actualMethod(request);
90+
} catch (Throwable t) {
91+
instrumenter.end(context, request, null, t);
92+
throw t;
9493
}
94+
// calling end after the scope is closed is a best practice
95+
instrumenter.end(context, request, response, null);
96+
return response;
9597
}
9698
```
9799

docs/supported-libraries.md

Lines changed: 13 additions & 12 deletions
Large diffs are not rendered by default.

instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/builder/internal/DefaultHttpClientInstrumenterBuilder.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
import java.util.Collection;
3232
import java.util.List;
3333
import java.util.Objects;
34-
import java.util.Set;
3534
import java.util.function.Consumer;
3635
import java.util.function.Function;
3736
import java.util.function.Supplier;
@@ -155,11 +154,11 @@ public DefaultHttpClientInstrumenterBuilder<REQUEST, RESPONSE> setCapturedRespon
155154
* not supplement it.
156155
*
157156
* @param knownMethods A set of recognized HTTP request methods.
158-
* @see HttpClientAttributesExtractorBuilder#setKnownMethods(Set)
157+
* @see HttpClientAttributesExtractorBuilder#setKnownMethods(Collection)
159158
*/
160159
@CanIgnoreReturnValue
161160
public DefaultHttpClientInstrumenterBuilder<REQUEST, RESPONSE> setKnownMethods(
162-
Set<String> knownMethods) {
161+
Collection<String> knownMethods) {
163162
httpAttributesExtractorBuilder.setKnownMethods(knownMethods);
164163
httpSpanNameExtractorBuilder.setKnownMethods(knownMethods);
165164
return this;

instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/builder/internal/DefaultHttpServerInstrumenterBuilder.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
import java.util.Collection;
3131
import java.util.List;
3232
import java.util.Objects;
33-
import java.util.Set;
3433
import java.util.function.Consumer;
3534
import java.util.function.Function;
3635
import java.util.function.Supplier;
@@ -153,11 +152,11 @@ public DefaultHttpServerInstrumenterBuilder<REQUEST, RESPONSE> setCapturedRespon
153152
* not supplement it.
154153
*
155154
* @param knownMethods A set of recognized HTTP request methods.
156-
* @see HttpServerAttributesExtractorBuilder#setKnownMethods(Set)
155+
* @see HttpServerAttributesExtractorBuilder#setKnownMethods(Collection)
157156
*/
158157
@CanIgnoreReturnValue
159158
public DefaultHttpServerInstrumenterBuilder<REQUEST, RESPONSE> setKnownMethods(
160-
Set<String> knownMethods) {
159+
Collection<String> knownMethods) {
161160
httpAttributesExtractorBuilder.setKnownMethods(knownMethods);
162161
httpSpanNameExtractorBuilder.setKnownMethods(knownMethods);
163162
httpServerRouteBuilder.setKnownMethods(knownMethods);

instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/semconv/http/HttpClientAttributesExtractorBuilder.java

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,34 @@ public HttpClientAttributesExtractorBuilder<REQUEST, RESPONSE> setCapturedRespon
137137
*/
138138
@CanIgnoreReturnValue
139139
public HttpClientAttributesExtractorBuilder<REQUEST, RESPONSE> setKnownMethods(
140-
Set<String> knownMethods) {
140+
Collection<String> knownMethods) {
141141
this.knownMethods = new HashSet<>(knownMethods);
142142
return this;
143143
}
144144

145+
/**
146+
* Configures the extractor to recognize an alternative set of HTTP request methods.
147+
*
148+
* <p>By default, this extractor defines "known" methods as the ones listed in <a
149+
* href="https://www.rfc-editor.org/rfc/rfc9110.html#name-methods">RFC9110</a> and the PATCH
150+
* method defined in <a href="https://www.rfc-editor.org/rfc/rfc5789.html">RFC5789</a>. If an
151+
* unknown method is encountered, the extractor will use the value {@value HttpConstants#_OTHER}
152+
* instead of it and put the original value in an extra {@code http.request.method_original}
153+
* attribute.
154+
*
155+
* <p>Note: calling this method <b>overrides</b> the default known method sets completely; it does
156+
* not supplement it.
157+
*
158+
* @param knownMethods A set of recognized HTTP request methods.
159+
*/
160+
// don't deprecate this since users will get deprecation warning without a clean way to suppress
161+
// it if they're using Set
162+
@CanIgnoreReturnValue
163+
public HttpClientAttributesExtractorBuilder<REQUEST, RESPONSE> setKnownMethods(
164+
Set<String> knownMethods) {
165+
return setKnownMethods((Collection<String>) knownMethods);
166+
}
167+
145168
// visible for tests
146169
@CanIgnoreReturnValue
147170
HttpClientAttributesExtractorBuilder<REQUEST, RESPONSE> setResendCountIncrementer(

instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/semconv/http/HttpServerAttributesExtractorBuilder.java

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,34 @@ public HttpServerAttributesExtractorBuilder<REQUEST, RESPONSE> setCapturedRespon
144144
*/
145145
@CanIgnoreReturnValue
146146
public HttpServerAttributesExtractorBuilder<REQUEST, RESPONSE> setKnownMethods(
147-
Set<String> knownMethods) {
147+
Collection<String> knownMethods) {
148148
this.knownMethods = new HashSet<>(knownMethods);
149149
return this;
150150
}
151151

152+
/**
153+
* Configures the extractor to recognize an alternative set of HTTP request methods.
154+
*
155+
* <p>By default, this extractor defines "known" methods as the ones listed in <a
156+
* href="https://www.rfc-editor.org/rfc/rfc9110.html#name-methods">RFC9110</a> and the PATCH
157+
* method defined in <a href="https://www.rfc-editor.org/rfc/rfc5789.html">RFC5789</a>. If an
158+
* unknown method is encountered, the extractor will use the value {@value HttpConstants#_OTHER}
159+
* instead of it and put the original value in an extra {@code http.request.method_original}
160+
* attribute.
161+
*
162+
* <p>Note: calling this method <b>overrides</b> the default known method sets completely; it does
163+
* not supplement it.
164+
*
165+
* @param knownMethods A set of recognized HTTP request methods.
166+
*/
167+
// don't deprecate this since users will get deprecation warning without a clean way to suppress
168+
// it if they're using Set
169+
@CanIgnoreReturnValue
170+
public HttpServerAttributesExtractorBuilder<REQUEST, RESPONSE> setKnownMethods(
171+
Set<String> knownMethods) {
172+
return setKnownMethods((Collection<String>) knownMethods);
173+
}
174+
152175
// visible for tests
153176
@CanIgnoreReturnValue
154177
HttpServerAttributesExtractorBuilder<REQUEST, RESPONSE> setHttpRouteGetter(

0 commit comments

Comments
 (0)