Skip to content

Commit 414e6b4

Browse files
committed
start enabling for modules
1 parent 2665951 commit 414e6b4

File tree

10 files changed

+471
-373
lines changed

10 files changed

+471
-373
lines changed

docs/instrumentation-list.yaml

Lines changed: 386 additions & 328 deletions
Large diffs are not rendered by default.

instrumentation-docs/collect.sh

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,22 @@ fi
1414

1515
readonly INSTRUMENTATIONS=(
1616
# <module path (colon-separated)> : <javaagent|library> : [ gradle-task-suffix ]
17-
"apache-dbcp-2.0:javaagent:test"
18-
"apache-httpclient:apache-httpclient-5.0:javaagent:test"
19-
"alibaba-druid-1.0:javaagent:test"
20-
"c3p0-0.9:javaagent:test"
21-
"hikaricp-3.0:javaagent:test"
22-
"tomcat:tomcat-jdbc:javaagent:test"
23-
"oracle-ucp-11.2:javaagent:test"
17+
# "alibaba-druid-1.0:javaagent:test"
18+
# "alibaba-druid-1.0:javaagent:testStableSemconv"
19+
# "apache-dbcp-2.0:javaagent:test"
20+
# "apache-dbcp-2.0:javaagent:testStableSemconv"
21+
# "apache-httpclient:apache-httpclient-5.0:javaagent:test"
22+
# "c3p0-0.9:javaagent:test"
23+
# "c3p0-0.9:javaagent:testStableSemconv"
24+
# "hikaricp-3.0:javaagent:test"
25+
# "hikaricp-3.0:javaagent:testStableSemconv"
26+
# "tomcat:tomcat-jdbc:javaagent:test"
27+
# "tomcat:tomcat-jdbc:javaagent:testStableSemconv"
28+
# "oracle-ucp-11.2:javaagent:test"
29+
# "oracle-ucp-11.2:javaagent:testStableSemconv"
2430
"oshi:javaagent:test"
25-
"vibur-dbcp-11.0:javaagent:test"
31+
"oshi:javaagent:testExperimental"
32+
# "vibur-dbcp-11.0:javaagent:test"
2633
)
2734

2835
readonly TELEMETRY_DIR_NAME=".telemetry"

instrumentation-docs/src/main/java/io/opentelemetry/instrumentation/docs/utils/YamlHelper.java

Lines changed: 20 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ private static Map<String, Object> baseProperties(InstrumentationModule module)
132132

133133
// Get telemetry grouping list
134134
Set<String> telemetryGroups = module.getMetrics().keySet();
135+
135136
if (!telemetryGroups.isEmpty()) {
136137
List<Map<String, Object>> telemetryList = new ArrayList<>();
137138
for (String group : telemetryGroups) {
@@ -148,12 +149,6 @@ private static Map<String, Object> baseProperties(InstrumentationModule module)
148149
}
149150
moduleMap.put("telemetry", telemetryList);
150151
}
151-
152-
if (!module.getMetrics().isEmpty()) {
153-
Map<String, List<Map<String, Object>>> metricsList = getMetricsList(module);
154-
moduleMap.put("metrics", metricsList);
155-
}
156-
157152
return moduleMap;
158153
}
159154

@@ -221,25 +216,25 @@ private static Map<String, Object> configurationToMap(ConfigurationOption config
221216
return conf;
222217
}
223218

224-
private static Map<String, List<Map<String, Object>>> getMetricsList(
225-
InstrumentationModule module) {
226-
Map<String, List<Map<String, Object>>> metricsMap = new LinkedHashMap<>();
227-
if (module.getMetrics() == null) {
228-
return metricsMap;
229-
}
230-
231-
for (Map.Entry<String, List<EmittedMetrics.Metric>> metricEntry :
232-
module.getMetrics().entrySet()) {
233-
List<Map<String, Object>> metricsList = new ArrayList<>();
234-
for (EmittedMetrics.Metric metric : metricEntry.getValue()) {
235-
Map<String, Object> innerMetricMap = getObjectMap(metric);
236-
metricsList.add(innerMetricMap);
237-
}
238-
metricsMap.put(metricEntry.getKey(), metricsList);
239-
}
240-
241-
return metricsMap;
242-
}
219+
// private static Map<String, List<Map<String, Object>>> getMetricsList(
220+
// InstrumentationModule module) {
221+
// Map<String, List<Map<String, Object>>> metricsMap = new LinkedHashMap<>();
222+
// if (module.getMetrics() == null) {
223+
// return metricsMap;
224+
// }
225+
//
226+
// for (Map.Entry<String, List<EmittedMetrics.Metric>> metricEntry :
227+
// module.getMetrics().entrySet()) {
228+
// List<Map<String, Object>> metricsList = new ArrayList<>();
229+
// for (EmittedMetrics.Metric metric : metricEntry.getValue()) {
230+
// Map<String, Object> innerMetricMap = getObjectMap(metric);
231+
// metricsList.add(innerMetricMap);
232+
// }
233+
// metricsMap.put(metricEntry.getKey(), metricsList);
234+
// }
235+
//
236+
// return metricsMap;
237+
// }
243238

244239
private static Map<String, Object> getObjectMap(EmittedMetrics.Metric metric) {
245240
Map<String, Object> innerMetricMap = new LinkedHashMap<>();

instrumentation/apache-dbcp-2.0/javaagent/build.gradle.kts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,18 @@ dependencies {
1919
testImplementation(project(":instrumentation:apache-dbcp-2.0:testing"))
2020
}
2121

22+
val collectMetadata = findProperty("collectMetadata")?.toString() ?: "false"
23+
2224
tasks {
2325
val testStableSemconv by registering(Test::class) {
2426
jvmArgs("-Dotel.semconv-stability.opt-in=database")
27+
28+
systemProperty("collectMetadata", collectMetadata)
29+
systemProperty("metaDataConfig", "otel.semconv-stability.opt-in=database")
2530
}
2631

2732
test {
28-
systemProperty("collectMetadata", findProperty("collectMetadata")?.toString() ?: "false")
33+
systemProperty("collectMetadata", collectMetadata)
2934
}
3035

3136
check {

instrumentation/c3p0-0.9/javaagent/build.gradle.kts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,18 @@ dependencies {
2121
testImplementation(project(":instrumentation:c3p0-0.9:testing"))
2222
}
2323

24+
val collectMetadata = findProperty("collectMetadata")?.toString() ?: "false"
25+
2426
tasks {
2527
val testStableSemconv by registering(Test::class) {
2628
jvmArgs("-Dotel.semconv-stability.opt-in=database")
29+
30+
systemProperty("collectMetadata", collectMetadata)
31+
systemProperty("metaDataConfig", "otel.semconv-stability.opt-in=database")
2732
}
2833

2934
test {
30-
systemProperty("collectMetadata", findProperty("collectMetadata")?.toString() ?: "false")
35+
systemProperty("collectMetadata", collectMetadata)
3136
}
3237

3338
check {

instrumentation/hikaricp-3.0/javaagent/build.gradle.kts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,18 @@ dependencies {
2222
testImplementation(project(":instrumentation:hikaricp-3.0:testing"))
2323
}
2424

25+
val collectMetadata = findProperty("collectMetadata")?.toString() ?: "false"
26+
2527
tasks {
2628
val testStableSemconv by registering(Test::class) {
2729
jvmArgs("-Dotel.semconv-stability.opt-in=database")
30+
31+
systemProperty("collectMetadata", collectMetadata)
32+
systemProperty("metaDataConfig", "otel.semconv-stability.opt-in=database")
2833
}
2934

3035
test {
31-
systemProperty("collectMetadata", findProperty("collectMetadata")?.toString() ?: "false")
36+
systemProperty("collectMetadata", collectMetadata)
3237
}
3338

3439
check {

instrumentation/oracle-ucp-11.2/javaagent/build.gradle.kts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,19 @@ dependencies {
2020
testImplementation(project(":instrumentation:oracle-ucp-11.2:testing"))
2121
}
2222

23+
val collectMetadata = findProperty("collectMetadata")?.toString() ?: "false"
24+
2325
tasks {
2426
test {
2527
usesService(gradle.sharedServices.registrations["testcontainersBuildService"].service)
28+
systemProperty("collectMetadata", collectMetadata)
2629
}
2730

2831
val testStableSemconv by registering(Test::class) {
2932
jvmArgs("-Dotel.semconv-stability.opt-in=database")
30-
}
3133

32-
test {
33-
systemProperty("collectMetadata", findProperty("collectMetadata")?.toString() ?: "false")
34+
systemProperty("collectMetadata", collectMetadata)
35+
systemProperty("metaDataConfig", "otel.semconv-stability.opt-in=database")
3436
}
3537

3638
check {

instrumentation/oshi/javaagent/build.gradle.kts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,20 @@ dependencies {
2222
testImplementation(project(":instrumentation:oshi:testing"))
2323
}
2424

25+
val collectMetadata = findProperty("collectMetadata")?.toString() ?: "false"
26+
27+
2528
tasks {
26-
withType<Test>().configureEach {
27-
jvmArgs("-Dotel.instrumentation.oshi.experimental-metrics.enabled=true")
29+
test {
30+
systemProperty("collectMetadata", collectMetadata)
2831
}
2932

30-
test {
31-
systemProperty("collectMetadata", findProperty("collectMetadata")?.toString() ?: "false")
33+
val testExperimental by registering(Test::class) {
34+
jvmArgs("-Dotel.instrumentation.oshi.experimental-metrics.enabled=true")
35+
jvmArgs("-Dotel.semconv-stability.opt-in=database")
36+
37+
systemProperty("collectMetadata", collectMetadata)
38+
systemProperty("metaDataConfig", "otel.semconv-stability.opt-in=database")
3239
}
40+
3341
}

instrumentation/oshi/metadata.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
description: When the OSHI library is detected on the classpath, this instrumentation will use the system class loader to load classes from the oshi-core jar that are then used to generate system metrics.
22
configurations:
33
- name: otel.instrumentation.oshi.experimental-metrics.enabled
4-
description: Enable the OSHI process metrics.
4+
description: Enable the OSHI runtime metrics.
55
type: boolean
66
default: false

instrumentation/tomcat/tomcat-jdbc/javaagent/build.gradle.kts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,21 @@ dependencies {
1616
testImplementation("org.apache.tomcat:tomcat-jdbc:8.5.0")
1717
}
1818

19+
val collectMetadata = findProperty("collectMetadata")?.toString() ?: "false"
20+
1921
tasks {
22+
val testStableSemconv by registering(Test::class) {
23+
jvmArgs("-Dotel.semconv-stability.opt-in=database")
24+
25+
systemProperty("collectMetadata", collectMetadata)
26+
systemProperty("metaDataConfig", "otel.semconv-stability.opt-in=database ")
27+
}
28+
2029
test {
21-
systemProperty("collectMetadata", findProperty("collectMetadata")?.toString() ?: "false")
30+
systemProperty("collectMetadata", collectMetadata)
31+
}
32+
33+
check {
34+
dependsOn(testStableSemconv)
2235
}
2336
}

0 commit comments

Comments
 (0)