Skip to content

Commit cf4d0a7

Browse files
committed
finish metric emitting instrumentations
1 parent a326cf5 commit cf4d0a7

File tree

12 files changed

+170
-21
lines changed

12 files changed

+170
-21
lines changed

docs/instrumentation-list.yaml

Lines changed: 131 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ libraries:
556556
dropwizard:
557557
- name: dropwizard-metrics-4.0
558558
description: |
559-
The dropwizard-metrics instrumentation for the dropwizard/codahale metrics library produces OpenTelemetry compliant versions of the metrics generated by the MetricRegistry.
559+
The dropwizard-metrics instrumentation for the dropwizard/codahale metrics library produces OpenTelemetry compliant versions of the metrics generated by the Dropwizard MetricRegistry.
560560
The Dropwizard metrics API does not have a concept of metric labels/tags/attributes, thus the data produced by this integration might be of very low quality, depending on how the API is used in the instrumented application.
561561
disabled_by_default: true
562562
source_path: instrumentation/dropwizard/dropwizard-metrics-4.0
@@ -1519,6 +1519,8 @@ libraries:
15191519
- org.opensearch.client:opensearch-rest-client:[1.0,3.0)
15201520
oracle:
15211521
- name: oracle-ucp-11.2
1522+
description: The Oracle Universal Connection Pool (UCP) instrumentation generates
1523+
connection pool metrics.
15221524
source_path: instrumentation/oracle-ucp-11.2
15231525
scope:
15241526
name: io.opentelemetry.oracle-ucp-11.2
@@ -1528,8 +1530,37 @@ libraries:
15281530
library:
15291531
- com.oracle.database.jdbc:ucp:11.2.0.4
15301532
- com.oracle.database.jdbc:ojdbc8:12.2.0.1
1533+
metrics:
1534+
- name: db.client.connections.usage
1535+
description: The number of connections that are currently in state described
1536+
by the state attribute.
1537+
type: LONG_SUM
1538+
unit: connections
1539+
attributes:
1540+
- name: pool.name
1541+
type: STRING
1542+
- name: state
1543+
type: STRING
1544+
- name: db.client.connections.pending_requests
1545+
description: The number of pending requests for an open connection, cumulative
1546+
for the entire pool.
1547+
type: LONG_SUM
1548+
unit: requests
1549+
attributes:
1550+
- name: pool.name
1551+
type: STRING
1552+
- name: db.client.connections.max
1553+
description: The maximum number of open connections allowed.
1554+
type: LONG_SUM
1555+
unit: connections
1556+
attributes:
1557+
- name: pool.name
1558+
type: STRING
15311559
oshi:
15321560
- name: oshi
1561+
description: When the OSHI library is detected on the classpath, this instrumentation
1562+
will use the system class loader to load classes from the oshi-core jar that
1563+
are then used to generate system metrics.
15331564
source_path: instrumentation/oshi
15341565
scope:
15351566
name: io.opentelemetry.oshi
@@ -1538,6 +1569,85 @@ libraries:
15381569
- com.github.oshi:oshi-core:[5.3.1,)
15391570
library:
15401571
- com.github.oshi:oshi-core:5.3.1
1572+
configurations:
1573+
- name: otel.instrumentation.oshi.experimental-metrics.enabled
1574+
description: Enable the OSHI process metrics.
1575+
type: boolean
1576+
default: false
1577+
metrics:
1578+
- name: system.memory.utilization
1579+
description: System memory utilization
1580+
type: DOUBLE_GAUGE
1581+
unit: '1'
1582+
attributes:
1583+
- name: state
1584+
type: STRING
1585+
- name: system.network.packets
1586+
description: System network packets
1587+
type: LONG_SUM
1588+
unit: packets
1589+
attributes:
1590+
- name: device
1591+
type: STRING
1592+
- name: direction
1593+
type: STRING
1594+
- name: system.disk.operations
1595+
description: System disk operations
1596+
type: LONG_SUM
1597+
unit: operations
1598+
attributes:
1599+
- name: device
1600+
type: STRING
1601+
- name: direction
1602+
type: STRING
1603+
- name: runtime.java.cpu_time
1604+
description: Runtime Java CPU time
1605+
type: LONG_GAUGE
1606+
unit: ms
1607+
attributes:
1608+
- name: type
1609+
type: STRING
1610+
- name: runtime.java.memory
1611+
description: Runtime Java memory
1612+
type: LONG_SUM
1613+
unit: By
1614+
attributes:
1615+
- name: type
1616+
type: STRING
1617+
- name: system.disk.io
1618+
description: System disk IO
1619+
type: LONG_SUM
1620+
unit: By
1621+
attributes:
1622+
- name: device
1623+
type: STRING
1624+
- name: direction
1625+
type: STRING
1626+
- name: system.network.io
1627+
description: System network IO
1628+
type: LONG_SUM
1629+
unit: By
1630+
attributes:
1631+
- name: device
1632+
type: STRING
1633+
- name: direction
1634+
type: STRING
1635+
- name: system.memory.usage
1636+
description: System memory usage
1637+
type: LONG_SUM
1638+
unit: By
1639+
attributes:
1640+
- name: state
1641+
type: STRING
1642+
- name: system.network.errors
1643+
description: System network errors
1644+
type: LONG_SUM
1645+
unit: errors
1646+
attributes:
1647+
- name: device
1648+
type: STRING
1649+
- name: direction
1650+
type: STRING
15411651
payara:
15421652
- name: payara
15431653
source_path: instrumentation/payara
@@ -2246,6 +2356,8 @@ libraries:
22462356
- io.vertx:vertx-core:[3.0.0,4.0.0)
22472357
vibur:
22482358
- name: vibur-dbcp-11.0
2359+
description: Instrumentation for the vibur-dbcp library, which provides connection
2360+
pool metrics.
22492361
source_path: instrumentation/vibur-dbcp-11.0
22502362
scope:
22512363
name: io.opentelemetry.vibur-dbcp-11.0
@@ -2254,6 +2366,24 @@ libraries:
22542366
- org.vibur:vibur-dbcp:[11.0,)
22552367
library:
22562368
- org.vibur:vibur-dbcp:11.0
2369+
metrics:
2370+
- name: db.client.connections.usage
2371+
description: The number of connections that are currently in state described
2372+
by the state attribute.
2373+
type: LONG_SUM
2374+
unit: connections
2375+
attributes:
2376+
- name: pool.name
2377+
type: STRING
2378+
- name: state
2379+
type: STRING
2380+
- name: db.client.connections.max
2381+
description: The maximum number of open connections allowed.
2382+
type: LONG_SUM
2383+
unit: connections
2384+
attributes:
2385+
- name: pool.name
2386+
type: STRING
22572387
wicket:
22582388
- name: wicket-8.0
22592389
source_path: instrumentation/wicket-8.0

instrumentation-docs/collect.sh

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,24 @@
55

66
set -euo pipefail
77

8+
# Oracle UCP won't run on Apple Silicon, so we need to use colima to run as x86_64
9+
if [[ "$(uname -m)" == "arm64" || "$(uname -m)" == "aarch64" ]]; then
10+
colima start --arch x86_64 --memory 4
11+
export TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE=/var/run/docker.sock
12+
export DOCKER_HOST="unix://${HOME}/.colima/docker.sock"
13+
fi
14+
815
readonly INSTRUMENTATIONS=(
916
# <module path (colon-separated)> : <javaagent|library> : [ gradle-task-suffix ]
17+
"apache-dbcp-2.0:javaagent:test"
1018
"apache-httpclient:apache-httpclient-5.0:javaagent:test"
1119
"alibaba-druid-1.0:javaagent:test"
1220
"c3p0-0.9:javaagent:test"
13-
"tomcat:tomcat-jdbc:javaagent:test"
1421
"hikaricp-3.0:javaagent:test"
15-
"apache-dbcp-2.0:javaagent:test"
22+
"tomcat:tomcat-jdbc:javaagent:test"
23+
"oracle-ucp-11.2:javaagent:test"
24+
"oshi:javaagent:test"
25+
"vibur-dbcp-11.0:javaagent:test"
1626
)
1727

1828
readonly TELEMETRY_DIR_NAME=".telemetry"
@@ -52,8 +62,7 @@ parse_descriptor() {
5262
task_suffix="${parts[$((type_idx + 1))]}"
5363
fi
5464

55-
# Join everything *before* the type token with slashes to make
56-
# instrumentation/<path>/...
65+
# Join everything before the type token with slashes to make instrumentation/<path>/...
5766
local path_segments=("${parts[@]:0:type_idx}")
5867
local module_path="instrumentation/$(IFS=/; echo "${path_segments[*]}")"
5968

@@ -71,7 +80,7 @@ delete_existing_telemetry() {
7180
}
7281

7382
# Converts the three parsed parts into a Gradle task name.
74-
# ex: instrumentation:foo:bar:javaagent:test
83+
# ex: instrumentation:foo:bar:javaagent:test
7584
build_gradle_task() {
7685
local module_path="$1" # instrumentation/foo/bar
7786
local task_type="$2" # javaagent | library
@@ -87,7 +96,7 @@ build_gradle_task() {
8796

8897
# Cleans any stray .telemetry directories left in the repo.
8998
find_and_remove_all_telemetry() {
90-
echo "🔍 Removing stray .telemetry directories..."
99+
echo "Removing stray .telemetry directories..."
91100
find . -type d -name "$TELEMETRY_DIR_NAME" -exec rm -rf {} +
92101
}
93102

@@ -98,7 +107,7 @@ for descriptor in "${INSTRUMENTATIONS[@]}"; do
98107
# Parse the descriptor into its components
99108
if ! read -r module_path task_type task_suffix \
100109
< <(parse_descriptor "$descriptor"); then
101-
continue # skip badly-formed descriptor
110+
continue # skip any badly formed descriptors
102111
fi
103112

104113
# Make sure we’re starting fresh for this instrumentation
@@ -117,5 +126,7 @@ echo
117126
-PcollectMetadata=true \
118127
--rerun-tasks
119128

129+
# uncomment the next line to remove all .telemetry directories
120130
#find_and_remove_all_telemetry
131+
121132
echo "Telemetry file regeneration complete."

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,6 @@ tasks {
4949
jvmArgs("-Dotel.semconv-stability.opt-in=database")
5050
}
5151

52-
test {
53-
systemProperty("collectMetadata", findProperty("collectMetadata")?.toString() ?: "false")
54-
}
55-
5652
check {
5753
dependsOn(testStableSemconv)
5854
}

instrumentation/cassandra/cassandra-4.0/javaagent/build.gradle.kts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,6 @@ tasks {
3232
jvmArgs("-Dotel.semconv-stability.opt-in=database")
3333
}
3434

35-
test {
36-
systemProperty("collectMetadata", findProperty("collectMetadata")?.toString() ?: "false")
37-
}
38-
3935
check {
4036
dependsOn(testStableSemconv)
4137
}

instrumentation/cassandra/cassandra-4.4/javaagent/build.gradle.kts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,6 @@ tasks {
3535
jvmArgs("-Dotel.semconv-stability.opt-in=database")
3636
}
3737

38-
test {
39-
systemProperty("collectMetadata", findProperty("collectMetadata")?.toString() ?: "false")
40-
}
41-
4238
check {
4339
dependsOn(testStableSemconv)
4440
}

instrumentation/dropwizard/dropwizard-metrics-4.0/metadata.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
description: >
22
The dropwizard-metrics instrumentation for the dropwizard/codahale metrics library produces
3-
OpenTelemetry compliant versions of the metrics generated by the MetricRegistry.
3+
OpenTelemetry compliant versions of the metrics generated by the Dropwizard MetricRegistry.
44
55
The Dropwizard metrics API does not have a concept of metric labels/tags/attributes, thus the data
66
produced by this integration might be of very low quality, depending on how the API is used in the

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ tasks {
2929
jvmArgs("-Dotel.semconv-stability.opt-in=database")
3030
}
3131

32+
test {
33+
systemProperty("collectMetadata", findProperty("collectMetadata")?.toString() ?: "false")
34+
}
35+
3236
check {
3337
dependsOn(testStableSemconv)
3438
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
description: The Oracle Universal Connection Pool (UCP) instrumentation generates connection pool metrics.

instrumentation/oshi/javaagent/build.gradle.kts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,8 @@ tasks {
2626
withType<Test>().configureEach {
2727
jvmArgs("-Dotel.instrumentation.oshi.experimental-metrics.enabled=true")
2828
}
29+
30+
test {
31+
systemProperty("collectMetadata", findProperty("collectMetadata")?.toString() ?: "false")
32+
}
2933
}

instrumentation/oshi/metadata.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
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.
2+
configurations:
3+
- name: otel.instrumentation.oshi.experimental-metrics.enabled
4+
description: Enable the OSHI process metrics.
5+
type: boolean
6+
default: false

0 commit comments

Comments
 (0)