Skip to content

Commit ec93763

Browse files
committed
Merge branch 'main' into jdk.httpserver
2 parents f78ec08 + 0e2cc4f commit ec93763

File tree

57 files changed

+1035
-240
lines changed

Some content is hidden

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

57 files changed

+1035
-240
lines changed

.fossa.yml

+3
Original file line numberDiff line numberDiff line change
@@ -757,6 +757,9 @@ targets:
757757
- type: gradle
758758
path: ./
759759
target: ':instrumentation:opentelemetry-api:opentelemetry-api-1.42:javaagent'
760+
- type: gradle
761+
path: ./
762+
target: ':instrumentation:opentelemetry-api:opentelemetry-api-1.47:javaagent'
760763
- type: gradle
761764
path: ./
762765
target: ':instrumentation:pekko:pekko-actor-1.0:javaagent'

.github/renovate.json5

+6-3
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,13 @@
1313
"separateMinorPatch": true,
1414
"packageRules": [
1515
{
16-
// this is to reduce the number of renovate PRs by consolidating them into a weekly batch
17-
"matchManagers": ["github-actions"],
16+
// this is to reduce the number of renovate PRs
17+
"matchManagers": [
18+
"github-actions",
19+
"dockerfile"
20+
],
1821
"extends": ["schedule:weekly"],
19-
"groupName": "github actions",
22+
"groupName": "weekly update",
2023
"separateMinorPatch": false // overrides separateMinorPatch specified above
2124
},
2225
{

.github/workflows/build-common.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ jobs:
6868
cache-read-only: ${{ inputs.cache-read-only }}
6969

7070
- name: Generate license report
71-
run: ./gradlew generateLicenseReport ${{ inputs.no-build-cache && '--no-build-cache' || '' }}
71+
# with the build cache enabled occasionally produces outdated results
72+
run: ./gradlew generateLicenseReport --no-build-cache
7273

7374
- name: Check licenses
7475
run: |

.github/workflows/fossa.yml

+1
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ jobs:
1717
- uses: fossas/fossa-action@93a52ecf7c3ac7eb40f5de77fd69b1a19524de94 # v1.5.0
1818
with:
1919
api-key: ${{secrets.FOSSA_API_KEY}}
20+
team: OpenTelemetry

.github/workflows/release-update-cloudfoundry-index.yml

+5-3
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ jobs:
1919
steps:
2020
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2121

22+
# need to run this script before we switch branches
23+
# since the script doesn't exist on the cloudfoundry branch
24+
- name: Use CLA approved github bot
25+
run: .github/scripts/use-cla-approved-github-bot.sh
26+
2227
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2328
with:
2429
ref: 'cloudfoundry'
@@ -39,9 +44,6 @@ jobs:
3944
- name: display changes
4045
run: git diff
4146

42-
- name: Use CLA approved bot
43-
run: .github/scripts/use-cla-approved-bot.sh
44-
4547
- uses: actions/create-github-app-token@67e27a7eb7db372a1c61a7f9bdab8699e9ee57f7 # v1.11.3
4648
id: otelbot-token
4749
with:

dependencyManagement/build.gradle.kts

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ plugins {
55
data class DependencySet(val group: String, val version: String, val modules: List<String>)
66

77
// this line is managed by .github/scripts/update-sdk-version.sh
8-
val otelSdkVersion = "1.46.0"
8+
val otelSdkVersion = "1.47.0"
99
val otelContribVersion = "1.43.0-alpha"
1010
val otelSdkAlphaVersion = otelSdkVersion.replaceFirst("(-SNAPSHOT)?$".toRegex(), "-alpha$1")
1111

@@ -91,7 +91,7 @@ val DEPENDENCIES = listOf(
9191
"com.github.stefanbirkner:system-rules:1.19.0",
9292
"uk.org.webcompere:system-stubs-jupiter:2.0.3",
9393
"com.uber.nullaway:nullaway:0.12.3",
94-
"commons-beanutils:commons-beanutils:1.10.0",
94+
"commons-beanutils:commons-beanutils:1.10.1",
9595
"commons-cli:commons-cli:1.9.0",
9696
"commons-codec:commons-codec:1.18.0",
9797
"commons-collections:commons-collections:3.2.2",

examples/distro/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ subprojects {
2727
ext {
2828
versions = [
2929
// this line is managed by .github/scripts/update-sdk-version.sh
30-
opentelemetrySdk : "1.46.0",
30+
opentelemetrySdk : "1.47.0",
3131

3232
// these lines are managed by .github/scripts/update-version.sh
3333
opentelemetryJavaagent : "2.13.0-SNAPSHOT",

examples/extension/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ version '1.0'
2323
ext {
2424
versions = [
2525
// this line is managed by .github/scripts/update-sdk-version.sh
26-
opentelemetrySdk : "1.46.0",
26+
opentelemetrySdk : "1.47.0",
2727

2828
// these lines are managed by .github/scripts/update-version.sh
2929
opentelemetryJavaagent : "2.13.0-SNAPSHOT",

instrumentation/aws-sdk/aws-sdk-1.11/library/src/main/java/io/opentelemetry/instrumentation/awssdk/v1_11/AwsSdkInstrumenterFactory.java

+35-15
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
import io.opentelemetry.instrumentation.api.semconv.http.HttpClientAttributesExtractor;
2929
import java.util.ArrayList;
3030
import java.util.Arrays;
31-
import java.util.Collections;
3231
import java.util.List;
32+
import java.util.function.Consumer;
3333
import javax.annotation.Nullable;
3434

3535
final class AwsSdkInstrumenterFactory {
@@ -189,14 +189,16 @@ Instrumenter<Request<?>, Response<?>> producerInstrumenter() {
189189
}
190190

191191
Instrumenter<Request<?>, Response<?>> dynamoDbInstrumenter() {
192-
DynamoDbAttributesExtractor dynamoDbAttributesExtractor = new DynamoDbAttributesExtractor();
193-
194-
return Instrumenter.<Request<?>, Response<?>>builder(
195-
openTelemetry, INSTRUMENTATION_NAME, spanName)
196-
.addAttributesExtractors(attributesExtractors())
197-
.addAttributesExtractors(Collections.singletonList(dynamoDbAttributesExtractor))
198-
.addOperationMetrics(DbClientMetrics.get())
199-
.buildInstrumenter(SpanKindExtractor.alwaysClient());
192+
return createInstrumenter(
193+
openTelemetry,
194+
spanName,
195+
SpanKindExtractor.alwaysClient(),
196+
attributesExtractors(),
197+
builder ->
198+
builder
199+
.addAttributesExtractor(new DynamoDbAttributesExtractor())
200+
.addOperationMetrics(DbClientMetrics.get()),
201+
true);
200202
}
201203

202204
private static <REQUEST, RESPONSE> Instrumenter<REQUEST, RESPONSE> createInstrumenter(
@@ -206,11 +208,29 @@ private static <REQUEST, RESPONSE> Instrumenter<REQUEST, RESPONSE> createInstrum
206208
List<? extends AttributesExtractor<? super REQUEST, ? super RESPONSE>> attributeExtractors,
207209
List<AttributesExtractor<REQUEST, RESPONSE>> additionalAttributeExtractors,
208210
boolean enabled) {
209-
return Instrumenter.<REQUEST, RESPONSE>builder(
210-
openTelemetry, INSTRUMENTATION_NAME, spanNameExtractor)
211-
.addAttributesExtractors(attributeExtractors)
212-
.addAttributesExtractors(additionalAttributeExtractors)
213-
.setEnabled(enabled)
214-
.buildInstrumenter(spanKindExtractor);
211+
return createInstrumenter(
212+
openTelemetry,
213+
spanNameExtractor,
214+
spanKindExtractor,
215+
attributeExtractors,
216+
builder -> builder.addAttributesExtractors(additionalAttributeExtractors),
217+
enabled);
218+
}
219+
220+
private static <REQUEST, RESPONSE> Instrumenter<REQUEST, RESPONSE> createInstrumenter(
221+
OpenTelemetry openTelemetry,
222+
SpanNameExtractor<REQUEST> spanNameExtractor,
223+
SpanKindExtractor<REQUEST> spanKindExtractor,
224+
List<? extends AttributesExtractor<? super REQUEST, ? super RESPONSE>> attributeExtractors,
225+
Consumer<InstrumenterBuilder<REQUEST, RESPONSE>> customizer,
226+
boolean enabled) {
227+
InstrumenterBuilder<REQUEST, RESPONSE> builder =
228+
Instrumenter.<REQUEST, RESPONSE>builder(
229+
openTelemetry, INSTRUMENTATION_NAME, spanNameExtractor)
230+
.addAttributesExtractors(attributeExtractors)
231+
.setEnabled(enabled);
232+
customizer.accept(builder);
233+
234+
return builder.buildInstrumenter(spanKindExtractor);
215235
}
216236
}

instrumentation/aws-sdk/aws-sdk-1.11/library/src/main/java/io/opentelemetry/instrumentation/awssdk/v1_11/DynamoDbAttributesExtractor.java

+26-2
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,12 @@
1717
import java.util.List;
1818
import javax.annotation.Nullable;
1919

20-
public class DynamoDbAttributesExtractor implements AttributesExtractor<Request<?>, Response<?>> {
20+
class DynamoDbAttributesExtractor implements AttributesExtractor<Request<?>, Response<?>> {
2121

2222
// copied from DbIncubatingAttributes
23+
private static final AttributeKey<String> DB_OPERATION = AttributeKey.stringKey("db.operation");
24+
private static final AttributeKey<String> DB_OPERATION_NAME =
25+
AttributeKey.stringKey("db.operation.name");
2326
private static final AttributeKey<String> DB_SYSTEM = AttributeKey.stringKey("db.system");
2427
private static final AttributeKey<String> DB_SYSTEM_NAME =
2528
AttributeKey.stringKey("db.system.name");
@@ -36,14 +39,35 @@ public class DynamoDbAttributesExtractor implements AttributesExtractor<Request<
3639
public void onStart(AttributesBuilder attributes, Context parentContext, Request<?> request) {
3740
if (SemconvStability.emitStableDatabaseSemconv()) {
3841
AttributesExtractorUtil.internalSet(attributes, DB_SYSTEM_NAME, AWS_DYNAMODB);
39-
} else {
42+
}
43+
if (SemconvStability.emitOldDatabaseSemconv()) {
4044
AttributesExtractorUtil.internalSet(attributes, DB_SYSTEM, DYNAMODB);
4145
}
46+
47+
String operation = getOperationName(request.getOriginalRequest());
48+
if (operation != null) {
49+
if (SemconvStability.emitStableDatabaseSemconv()) {
50+
AttributesExtractorUtil.internalSet(attributes, DB_OPERATION_NAME, operation);
51+
}
52+
if (SemconvStability.emitOldDatabaseSemconv()) {
53+
AttributesExtractorUtil.internalSet(attributes, DB_OPERATION, operation);
54+
}
55+
}
56+
4257
String tableName = RequestAccess.getTableName(request.getOriginalRequest());
4358
AttributesExtractorUtil.internalSet(
4459
attributes, AWS_DYNAMODB_TABLE_NAMES, Collections.singletonList(tableName));
4560
}
4661

62+
private static String getOperationName(Object request) {
63+
String name = request.getClass().getSimpleName();
64+
if (!name.endsWith("Request")) {
65+
return null;
66+
}
67+
68+
return name.substring(0, name.length() - "Request".length());
69+
}
70+
4771
@Override
4872
public void onEnd(
4973
AttributesBuilder attributes,

instrumentation/aws-sdk/aws-sdk-1.11/testing/src/main/java/io/opentelemetry/instrumentation/awssdk/v1_11/AbstractDynamoDbClientTest.java

+9-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
import static io.opentelemetry.semconv.ServerAttributes.SERVER_ADDRESS;
1313
import static io.opentelemetry.semconv.ServerAttributes.SERVER_PORT;
1414
import static io.opentelemetry.semconv.incubating.AwsIncubatingAttributes.AWS_DYNAMODB_TABLE_NAMES;
15+
import static io.opentelemetry.semconv.incubating.DbIncubatingAttributes.DB_OPERATION;
16+
import static io.opentelemetry.semconv.incubating.DbIncubatingAttributes.DB_OPERATION_NAME;
1517
import static io.opentelemetry.semconv.incubating.DbIncubatingAttributes.DB_SYSTEM;
1618
import static io.opentelemetry.semconv.incubating.DbIncubatingAttributes.DB_SYSTEM_NAME;
1719
import static io.opentelemetry.semconv.incubating.DbIncubatingAttributes.DbSystemNameIncubatingValues.AWS_DYNAMODB;
@@ -59,13 +61,19 @@ public void sendRequestWithMockedResponse() throws Exception {
5961
SemconvStability.emitStableDatabaseSemconv()
6062
? AWS_DYNAMODB
6163
: DbIncubatingAttributes.DbSystemIncubatingValues.DYNAMODB),
64+
equalTo(maybeStable(DB_OPERATION), "CreateTable"),
6265
equalTo(AWS_DYNAMODB_TABLE_NAMES, singletonList("sometable")));
6366

6467
Object response = client.createTable(new CreateTableRequest("sometable", null));
6568
assertRequestWithMockedResponse(
6669
response, client, "DynamoDBv2", "CreateTable", "POST", additionalAttributes);
6770

6871
assertDurationMetric(
69-
testing(), "io.opentelemetry.aws-sdk-1.11", DB_SYSTEM_NAME, SERVER_ADDRESS, SERVER_PORT);
72+
testing(),
73+
"io.opentelemetry.aws-sdk-1.11",
74+
DB_SYSTEM_NAME,
75+
DB_OPERATION_NAME,
76+
SERVER_ADDRESS,
77+
SERVER_PORT);
7078
}
7179
}

instrumentation/aws-sdk/aws-sdk-2.2/library/src/main/java/io/opentelemetry/instrumentation/awssdk/v2_2/AwsSdkTelemetry.java

+3
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ public static AwsSdkTelemetryBuilder builder(OpenTelemetry openTelemetry) {
5454
private final Instrumenter<SqsReceiveRequest, Response> consumerReceiveInstrumenter;
5555
private final Instrumenter<SqsProcessRequest, Response> consumerProcessInstrumenter;
5656
private final Instrumenter<ExecutionAttributes, Response> producerInstrumenter;
57+
private final Instrumenter<ExecutionAttributes, Response> dynamoDbInstrumenter;
5758
private final boolean captureExperimentalSpanAttributes;
5859
@Nullable private final TextMapPropagator messagingPropagator;
5960
private final boolean useXrayPropagator;
@@ -84,6 +85,7 @@ public static AwsSdkTelemetryBuilder builder(OpenTelemetry openTelemetry) {
8485
this.consumerReceiveInstrumenter = instrumenterFactory.consumerReceiveInstrumenter();
8586
this.consumerProcessInstrumenter = instrumenterFactory.consumerProcessInstrumenter();
8687
this.producerInstrumenter = instrumenterFactory.producerInstrumenter();
88+
this.dynamoDbInstrumenter = instrumenterFactory.dynamoDbInstrumenter();
8789
this.captureExperimentalSpanAttributes = captureExperimentalSpanAttributes;
8890
this.recordIndividualHttpError = recordIndividualHttpError;
8991
}
@@ -98,6 +100,7 @@ public ExecutionInterceptor newExecutionInterceptor() {
98100
consumerReceiveInstrumenter,
99101
consumerProcessInstrumenter,
100102
producerInstrumenter,
103+
dynamoDbInstrumenter,
101104
captureExperimentalSpanAttributes,
102105
messagingPropagator,
103106
useXrayPropagator,

instrumentation/aws-sdk/aws-sdk-2.2/library/src/main/java/io/opentelemetry/instrumentation/awssdk/v2_2/internal/AwsSdkInstrumenterFactory.java

+40-6
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import io.opentelemetry.api.trace.Span;
1414
import io.opentelemetry.context.Context;
1515
import io.opentelemetry.context.propagation.TextMapPropagator;
16+
import io.opentelemetry.instrumentation.api.incubator.semconv.db.DbClientMetrics;
1617
import io.opentelemetry.instrumentation.api.incubator.semconv.messaging.MessageOperation;
1718
import io.opentelemetry.instrumentation.api.incubator.semconv.messaging.MessagingAttributesExtractor;
1819
import io.opentelemetry.instrumentation.api.incubator.semconv.messaging.MessagingAttributesGetter;
@@ -27,6 +28,7 @@
2728
import java.util.ArrayList;
2829
import java.util.Arrays;
2930
import java.util.List;
31+
import java.util.function.Consumer;
3032
import javax.annotation.Nullable;
3133
import software.amazon.awssdk.core.interceptor.ExecutionAttributes;
3234
import software.amazon.awssdk.core.interceptor.SdkExecutionAttribute;
@@ -204,6 +206,19 @@ public Instrumenter<ExecutionAttributes, Response> producerInstrumenter() {
204206
true);
205207
}
206208

209+
public Instrumenter<ExecutionAttributes, Response> dynamoDbInstrumenter() {
210+
return createInstrumenter(
211+
openTelemetry,
212+
AwsSdkInstrumenterFactory::spanName,
213+
SpanKindExtractor.alwaysClient(),
214+
attributesExtractors(),
215+
builder ->
216+
builder
217+
.addAttributesExtractor(new DynamoDbAttributesExtractor())
218+
.addOperationMetrics(DbClientMetrics.get()),
219+
true);
220+
}
221+
207222
private static <REQUEST, RESPONSE> Instrumenter<REQUEST, RESPONSE> createInstrumenter(
208223
OpenTelemetry openTelemetry,
209224
SpanNameExtractor<REQUEST> spanNameExtractor,
@@ -212,12 +227,31 @@ private static <REQUEST, RESPONSE> Instrumenter<REQUEST, RESPONSE> createInstrum
212227
List<AttributesExtractor<REQUEST, RESPONSE>> additionalAttributeExtractors,
213228
boolean enabled) {
214229

215-
return Instrumenter.<REQUEST, RESPONSE>builder(
216-
openTelemetry, INSTRUMENTATION_NAME, spanNameExtractor)
217-
.addAttributesExtractors(attributeExtractors)
218-
.addAttributesExtractors(additionalAttributeExtractors)
219-
.setEnabled(enabled)
220-
.buildInstrumenter(spanKindExtractor);
230+
return createInstrumenter(
231+
openTelemetry,
232+
spanNameExtractor,
233+
spanKindExtractor,
234+
attributeExtractors,
235+
builder -> builder.addAttributesExtractors(additionalAttributeExtractors),
236+
enabled);
237+
}
238+
239+
private static <REQUEST, RESPONSE> Instrumenter<REQUEST, RESPONSE> createInstrumenter(
240+
OpenTelemetry openTelemetry,
241+
SpanNameExtractor<REQUEST> spanNameExtractor,
242+
SpanKindExtractor<REQUEST> spanKindExtractor,
243+
List<? extends AttributesExtractor<? super REQUEST, ? super RESPONSE>> attributeExtractors,
244+
Consumer<InstrumenterBuilder<REQUEST, RESPONSE>> customizer,
245+
boolean enabled) {
246+
247+
InstrumenterBuilder<REQUEST, RESPONSE> builder =
248+
Instrumenter.<REQUEST, RESPONSE>builder(
249+
openTelemetry, INSTRUMENTATION_NAME, spanNameExtractor)
250+
.addAttributesExtractors(attributeExtractors)
251+
.setEnabled(enabled);
252+
customizer.accept(builder);
253+
254+
return builder.buildInstrumenter(spanKindExtractor);
221255
}
222256

223257
private static String spanName(ExecutionAttributes attributes) {

0 commit comments

Comments
 (0)