Skip to content

Commit ca3a6f0

Browse files
committed
get metrics
1 parent 5fe853a commit ca3a6f0

File tree

3 files changed

+45
-2
lines changed

3 files changed

+45
-2
lines changed

docs/instrumentation-list.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7278,6 +7278,20 @@ libraries:
72787278
default: true
72797279
telemetry:
72807280
- when: default
7281+
metrics:
7282+
- name: http.client.request.duration
7283+
description: Duration of HTTP client requests.
7284+
type: HISTOGRAM
7285+
unit: s
7286+
attributes:
7287+
- name: http.request.method
7288+
type: STRING
7289+
- name: http.response.status_code
7290+
type: LONG
7291+
- name: server.address
7292+
type: STRING
7293+
- name: server.port
7294+
type: LONG
72817295
spans:
72827296
- span_kind: CLIENT
72837297
attributes:
@@ -7296,6 +7310,20 @@ libraries:
72967310
- name: url.full
72977311
type: STRING
72987312
- when: otel.instrumentation.kubernetes-client.experimental-span-attributes=true
7313+
metrics:
7314+
- name: http.client.request.duration
7315+
description: Duration of HTTP client requests.
7316+
type: HISTOGRAM
7317+
unit: s
7318+
attributes:
7319+
- name: http.request.method
7320+
type: STRING
7321+
- name: http.response.status_code
7322+
type: LONG
7323+
- name: server.address
7324+
type: STRING
7325+
- name: server.port
7326+
type: LONG
72997327
spans:
73007328
- span_kind: CLIENT
73017329
attributes:

docs/supported-libraries.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,13 @@ These are the supported libraries and frameworks:
9696
| [JBoss Log Manager](https://github.com/jboss-logging/jboss-logmanager) | 1.1+ | N/A | none |
9797
| [JDBC](https://docs.oracle.com/javase/8/docs/api/java/sql/package-summary.html) | Java 8+ | [opentelemetry-jdbc](../instrumentation/jdbc/library) | [Database Client Spans], [Database Client Metrics] [6] |
9898
| [Jedis](https://github.com/xetorthio/jedis) | 1.4+ | N/A | [Database Client Spans], [Database Client Metrics] [6] |
99-
| [JFinal](https://github.com/jfinal/jfinal) | 3.2+ | N/A | Provides `http.route` [2], Controller Spans [3] |
99+
| [JFinal](https://github.com/jfinal/jfinal) | 3.2+ | N/A | Provides `http.route` [2], Controller Spans [3] |
100100
| [JMS](https://javaee.github.io/javaee-spec/javadocs/javax/jms/package-summary.html) | 1.1+ | N/A | [Messaging Spans] |
101101
| [Jodd Http](https://http.jodd.org/) | 4.2+ | N/A | [HTTP Client Spans], [HTTP Client Metrics] |
102102
| [JSP](https://javaee.github.io/javaee-spec/javadocs/javax/servlet/jsp/package-summary.html) | 2.3.x only | N/A | Controller Spans [3] |
103103
| [Kotlin Coroutines](https://kotlinlang.org/docs/coroutines-overview.html) | 1.0+ | N/A | Context propagation |
104104
| [Ktor](https://github.com/ktorio/ktor) | 1.0+ | [opentelemetry-ktor-1.0](../instrumentation/ktor/ktor-1.0/library),<br>[opentelemetry-ktor-2.0](../instrumentation/ktor/ktor-2.0/library),<br>[opentelemetry-ktor-3.0](../instrumentation/ktor/ktor-3.0/library) | [HTTP Client Spans], [HTTP Client Metrics], [HTTP Server Spans], [HTTP Server Metrics] |
105-
| [Kubernetes Client](https://github.com/kubernetes-client/java) | 7.0+ | N/A | [HTTP Client Spans] |
105+
| [Kubernetes Client](https://github.com/kubernetes-client/java) | 7.0+ | N/A | [HTTP Client Spans], [HTTP Client Metrics] |
106106
| [Lettuce](https://github.com/lettuce-io/lettuce-core) | 4.0+ | [opentelemetry-lettuce-5.1](../instrumentation/lettuce/lettuce-5.1/library) | [Database Client Spans], [Database Client Metrics]&nbsp;[6] |
107107
| [Log4j 1](https://logging.apache.org/log4j/1.2/) | 1.2+ | N/A | none |
108108
| [Log4j 2](https://logging.apache.org/log4j/2.x/) | 2.11+ | [opentelemetry-log4j-appender-2.17](../instrumentation/log4j/log4j-appender-2.17/library),<br>[opentelemetry-log4j-context-data-2.17-autoconfigure](../instrumentation/log4j/log4j-context-data/log4j-context-data-2.17/library-autoconfigure) | none |

instrumentation/kubernetes-client-7.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/kubernetesclient/KubernetesClientTest.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import io.opentelemetry.api.trace.SpanKind;
2525
import io.opentelemetry.instrumentation.testing.junit.AgentInstrumentationExtension;
2626
import io.opentelemetry.instrumentation.testing.junit.InstrumentationExtension;
27+
import io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions;
2728
import io.opentelemetry.sdk.trace.data.StatusData;
2829
import io.opentelemetry.testing.internal.armeria.common.HttpResponse;
2930
import io.opentelemetry.testing.internal.armeria.common.HttpStatus;
@@ -104,6 +105,20 @@ void synchronousCall() throws ApiException {
104105
stringKey("kubernetes-client.namespace"),
105106
experimental("namespace")),
106107
equalTo(stringKey("kubernetes-client.name"), experimental("name")))));
108+
109+
testing.waitAndAssertMetrics(
110+
"io.opentelemetry.kubernetes-client-7.0",
111+
"http.client.request.duration",
112+
metrics ->
113+
metrics.anySatisfy(
114+
metric ->
115+
OpenTelemetryAssertions.assertThat(metric)
116+
.hasDescription("Duration of HTTP client requests.")
117+
.hasUnit("s")
118+
.hasHistogramSatisfying(
119+
histogram ->
120+
histogram.hasPointsSatisfying(
121+
point -> point.hasSumGreaterThan(0.0)))));
107122
}
108123

109124
@Test

0 commit comments

Comments
 (0)