Skip to content

Commit cab98b4

Browse files
committed
merge
2 parents 54eb3ae + 8481d9a commit cab98b4

File tree

20 files changed

+406
-52
lines changed

20 files changed

+406
-52
lines changed

.mise/tasks/lint/markdown.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#!/usr/bin/env bash
22
#MISE description="Lint markdown files"
3-
#MISE flag "--fix" help="Automatically fix issues"
3+
#USAGE flag "--fix" help="Automatically fix issues"
44

55
set -e
66

7-
if [ "${usage_fix}" = "true" ]; then
7+
if [ "${usage_fix:-false}" = "true" ]; then
88
markdownlint-cli2 --fix "**/*.md" "#**/build" "#CHANGELOG.md" "#licenses/licenses.md"
99
else
1010
markdownlint-cli2 "**/*.md" "#**/build" "#CHANGELOG.md" "#licenses/licenses.md"

benchmark-overhead-jmh/build.gradle.kts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
21
import me.champeau.jmh.JMHTask
32
import net.ltgt.gradle.errorprone.errorprone
43

@@ -44,7 +43,7 @@ tasks {
4443
val jmhStartFlightRecording = gradle.startParameter.projectProperties.get("jmh.startFlightRecording")
4544

4645
named<JMHTask>("jmh") {
47-
val shadowTask = project(":javaagent").tasks.named<ShadowJar>("shadowJar").get()
46+
val shadowTask = project(":javaagent").tasks.named<Jar>("shadowJar").get()
4847
inputs.files(layout.files(shadowTask))
4948

5049
// note: without an exporter, toSpanData() won't even be called

docs/instrumentation-list.yaml

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7681,6 +7681,111 @@ libraries:
76817681
type: STRING
76827682
- name: user_agent.original
76837683
type: STRING
7684+
- when: otel.instrumentation.http.server.emit-experimental-telemetry=true
7685+
metrics:
7686+
- name: http.client.request.duration
7687+
description: Duration of HTTP client requests.
7688+
type: HISTOGRAM
7689+
unit: s
7690+
attributes:
7691+
- name: http.request.method
7692+
type: STRING
7693+
- name: http.response.status_code
7694+
type: LONG
7695+
- name: network.protocol.version
7696+
type: STRING
7697+
- name: server.address
7698+
type: STRING
7699+
- name: server.port
7700+
type: LONG
7701+
- name: http.server.active_requests
7702+
description: Number of active HTTP server requests.
7703+
type: LONG_SUM
7704+
unit: requests
7705+
attributes:
7706+
- name: http.request.method
7707+
type: STRING
7708+
- name: url.scheme
7709+
type: STRING
7710+
- name: http.server.request.duration
7711+
description: Duration of HTTP server requests.
7712+
type: HISTOGRAM
7713+
unit: s
7714+
attributes:
7715+
- name: http.request.method
7716+
type: STRING
7717+
- name: http.response.status_code
7718+
type: LONG
7719+
- name: http.route
7720+
type: STRING
7721+
- name: network.protocol.version
7722+
type: STRING
7723+
- name: url.scheme
7724+
type: STRING
7725+
- name: http.server.response.body.size
7726+
description: Size of HTTP server response bodies.
7727+
type: HISTOGRAM
7728+
unit: By
7729+
attributes:
7730+
- name: http.request.method
7731+
type: STRING
7732+
- name: http.response.status_code
7733+
type: LONG
7734+
- name: http.route
7735+
type: STRING
7736+
- name: network.protocol.version
7737+
type: STRING
7738+
- name: url.scheme
7739+
type: STRING
7740+
spans:
7741+
- span_kind: CLIENT
7742+
attributes:
7743+
- name: error.type
7744+
type: STRING
7745+
- name: http.request.method
7746+
type: STRING
7747+
- name: http.request.method_original
7748+
type: STRING
7749+
- name: http.request.resend_count
7750+
type: LONG
7751+
- name: http.response.status_code
7752+
type: LONG
7753+
- name: network.protocol.version
7754+
type: STRING
7755+
- name: server.address
7756+
type: STRING
7757+
- name: server.port
7758+
type: LONG
7759+
- name: url.full
7760+
type: STRING
7761+
- span_kind: SERVER
7762+
attributes:
7763+
- name: client.address
7764+
type: STRING
7765+
- name: error.type
7766+
type: STRING
7767+
- name: http.request.method
7768+
type: STRING
7769+
- name: http.request.method_original
7770+
type: STRING
7771+
- name: http.response.status_code
7772+
type: LONG
7773+
- name: http.route
7774+
type: STRING
7775+
- name: network.protocol.version
7776+
type: STRING
7777+
- name: server.address
7778+
type: STRING
7779+
- name: server.port
7780+
type: LONG
7781+
- name: url.path
7782+
type: STRING
7783+
- name: url.query
7784+
type: STRING
7785+
- name: url.scheme
7786+
type: STRING
7787+
- name: user_agent.original
7788+
type: STRING
76847789
kubernetes:
76857790
- name: kubernetes-client-7.0
76867791
display_name: Kubernetes Client

instrumentation-docs/instrumentations.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ readonly INSTRUMENTATIONS=(
155155
"ktor:ktor-1.0:library:test"
156156
"ktor:ktor-2.0:library:test"
157157
"ktor:ktor-3.0:library:test"
158+
"ktor:ktor-3.0:library:testExperimental"
158159
"kubernetes-client-7.0:javaagent:test"
159160
"kubernetes-client-7.0:javaagent:testExperimental"
160161
"lettuce:lettuce-4.0:javaagent:test"

instrumentation/jmx-metrics/library/build.gradle.kts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
21

32
plugins {
43
id("otel.library-instrumentation")
@@ -19,7 +18,7 @@ dependencies {
1918

2019
tasks {
2120
test {
22-
val shadowTask = project(":javaagent").tasks.named<ShadowJar>("shadowJar")
21+
val shadowTask = project(":javaagent").tasks.named<Jar>("shadowJar")
2322
val testAppTask = project(":instrumentation:jmx-metrics:testing-webapp").tasks.named<War>("war")
2423

2524
dependsOn(shadowTask)

instrumentation/kafka/kafka-connect-2.6/testing/build.gradle.kts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
21

32
plugins {
43
id("otel.java-conventions")
@@ -8,7 +7,7 @@ otelJava {
87
minJavaVersionSupported.set(JavaVersion.VERSION_11)
98
}
109

11-
val agentShadowJar = project(":javaagent").tasks.named<ShadowJar>("shadowJar")
10+
val agentShadowJar = project(":javaagent").tasks.named<Jar>("shadowJar")
1211

1312
dependencies {
1413
testImplementation(project(":smoke-tests"))

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,16 @@ kotlin {
5454
javaParameters = true
5555
}
5656
}
57+
58+
tasks {
59+
val testExperimental by registering(Test::class) {
60+
testClassesDirs = sourceSets.test.get().output.classesDirs
61+
classpath = sourceSets.test.get().runtimeClasspath
62+
63+
jvmArgs("-Dotel.instrumentation.http.server.emit-experimental-telemetry=true")
64+
}
65+
66+
check {
67+
dependsOn(testExperimental)
68+
}
69+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
* Copyright The OpenTelemetry Authors
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
package io.opentelemetry.instrumentation.ktor.v3_0
7+
8+
import io.ktor.server.application.Application
9+
import io.opentelemetry.instrumentation.testing.junit.InstrumentationExtension
10+
import io.opentelemetry.instrumentation.testing.junit.http.HttpServerInstrumentationExtension
11+
import org.junit.jupiter.api.condition.EnabledIfSystemProperty
12+
import org.junit.jupiter.api.extension.RegisterExtension
13+
14+
@EnabledIfSystemProperty(
15+
named = "otel.instrumentation.http.server.emit-experimental-telemetry",
16+
matches = "true"
17+
)
18+
class ServerMetricsTest : AbstractKtorServerMetricsTest() {
19+
companion object {
20+
@JvmStatic
21+
@RegisterExtension
22+
val testing: InstrumentationExtension = HttpServerInstrumentationExtension.forAgent()
23+
}
24+
25+
override fun serverInstall(application: Application) {
26+
// javaagent automatically instruments the application
27+
}
28+
29+
// For javaagent, HTTP server metrics are emitted by the Netty instrumentation
30+
// since Ktor runs on top of Netty as its HTTP engine
31+
override fun instrumentationName(): String = "io.opentelemetry.netty-4.1"
32+
}

instrumentation/ktor/ktor-3.0/library/build.gradle.kts

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,21 @@ kotlin {
3333
}
3434
}
3535

36-
tasks.test {
37-
systemProperty("collectMetadata", findProperty("collectMetadata")?.toString() ?: "false")
36+
tasks {
37+
withType<Test>().configureEach {
38+
systemProperty("collectMetadata", findProperty("collectMetadata")?.toString() ?: "false")
39+
}
40+
41+
val testExperimental by registering(Test::class) {
42+
testClassesDirs = sourceSets.test.get().output.classesDirs
43+
classpath = sourceSets.test.get().runtimeClasspath
44+
45+
// this is used for enabling/disabling tests, library instrumentation doesn't use this flag
46+
jvmArgs("-Dotel.instrumentation.http.server.emit-experimental-telemetry=true")
47+
systemProperty("metadataConfig", "otel.instrumentation.http.server.emit-experimental-telemetry=true")
48+
}
49+
50+
check {
51+
dependsOn(testExperimental)
52+
}
3853
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* Copyright The OpenTelemetry Authors
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
package io.opentelemetry.instrumentation.ktor.v3_0
7+
8+
import io.ktor.server.application.install
9+
import io.opentelemetry.instrumentation.ktor.v2_0.common.internal.Experimental
10+
import io.opentelemetry.instrumentation.ktor.v3_0.InstrumentationProperties.INSTRUMENTATION_NAME
11+
import io.opentelemetry.instrumentation.testing.junit.InstrumentationExtension
12+
import io.opentelemetry.instrumentation.testing.junit.http.HttpServerInstrumentationExtension
13+
import org.junit.jupiter.api.condition.EnabledIfSystemProperty
14+
import org.junit.jupiter.api.extension.RegisterExtension
15+
16+
@EnabledIfSystemProperty(
17+
named = "otel.instrumentation.http.server.emit-experimental-telemetry",
18+
matches = "true"
19+
)
20+
class ServerMetricsTest : AbstractKtorServerMetricsTest() {
21+
companion object {
22+
@JvmStatic
23+
@RegisterExtension
24+
val testing: InstrumentationExtension = HttpServerInstrumentationExtension.forLibrary()
25+
}
26+
27+
override fun serverInstall(application: io.ktor.server.application.Application) {
28+
application.install(KtorServerTelemetry) {
29+
setOpenTelemetry(testing.openTelemetry)
30+
Experimental.emitExperimentalTelemetry(this)
31+
}
32+
}
33+
34+
override fun instrumentationName(): String = INSTRUMENTATION_NAME
35+
}

0 commit comments

Comments
 (0)