Skip to content

Commit

Permalink
Merge 4e7e0c3 into a1f394c
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanosiano committed Apr 4, 2024
2 parents a1f394c + 4e7e0c3 commit d00b75d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### Features

- Add description to OkHttp spans ([#3320](https://github.com/getsentry/sentry-java/pull/3320))
- Add support for Spring Rest Client ([#3199](https://github.com/getsentry/sentry-java/pull/3199))

## 7.6.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ internal class SentryOkHttpEvent(private val hub: IHub, private val request: Req
fun startSpan(event: String) {
// Find the parent of the span being created. E.g. secureConnect is child of connect
val parentSpan = findParentSpan(event)
val span = parentSpan?.startChild("http.client.$event") ?: return
val span = parentSpan?.startChild("http.client.$event", "http.client.$event") ?: return
if (event == RESPONSE_BODY_EVENT) {
// We save this event is reading the response body, so that it will not be auto-finished
isReadingResponseBody.set(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,28 +168,35 @@ class SentryOkHttpEventListenerTest {
}
1 -> {
assertEquals("http.client.proxy_select", span.operation)
assertEquals("http.client.proxy_select", span.description)
assertNotNull(span.data["proxies"])
}
2 -> {
assertEquals("http.client.dns", span.operation)
assertEquals("http.client.dns", span.description)
assertNotNull(span.data["domain_name"])
assertNotNull(span.data["dns_addresses"])
}
3 -> {
assertEquals("http.client.connect", span.operation)
assertEquals("http.client.connect", span.description)
}
4 -> {
assertEquals("http.client.connection", span.operation)
assertEquals("http.client.connection", span.description)
}
5 -> {
assertEquals("http.client.request_headers", span.operation)
assertEquals("http.client.request_headers", span.description)
}
6 -> {
assertEquals("http.client.response_headers", span.operation)
assertEquals("http.client.response_headers", span.description)
assertEquals(201, span.data[SpanDataConvention.HTTP_STATUS_CODE_KEY])
}
7 -> {
assertEquals("http.client.response_body", span.operation)
assertEquals("http.client.response_body", span.description)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ class SentryOkHttpEventTest {
assertNotNull(span)
assertTrue(spans.containsKey("span"))
assertEquals("http.client.span", span.operation)
assertEquals("http.client.span", span.description)
assertFalse(span.isFinished)
}

Expand Down Expand Up @@ -196,6 +197,7 @@ class SentryOkHttpEventTest {
sut.finishSpan("span") {
if (called == 0) {
assertEquals("http.client.span", it.operation)
assertEquals("http.client.span", it.description)
} else {
assertEquals(sut.callRootSpan, it)
}
Expand Down

0 comments on commit d00b75d

Please sign in to comment.