Skip to content

Commit

Permalink
don't change operation name for not-found
Browse files Browse the repository at this point in the history
  • Loading branch information
bplommer committed Aug 24, 2020
1 parent 0a3cc3b commit a79325c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,15 @@ object KamonSupport {
for {
requestHandler <- Resource.liftF(F.delay(instrumentation.createHandler(getRequestBuilder(request), ctx)))
response <- underlying.run(requestHandler.request).attempt
trackedResponse <- Resource.liftF(handleResponse(response, requestHandler, instrumentation.settings))
trackedResponse <- Resource.liftF(handleResponse(response, requestHandler))
} yield trackedResponse

def handleResponse[F[_]](
response: Either[Throwable, Response[F]],
requestHandler: HttpClientInstrumentation.RequestHandler[Request[F]],
settings: HttpClientInstrumentation.Settings
)(implicit F:Sync[F]): F[Response[F]] =
response match {
case Right(res) =>
if(res.status.code == 404) requestHandler.span.name(settings.defaultOperationName)
requestHandler.processResponse(getResponseBuilder(res))
F.delay(res)
case Left(error) =>
Expand Down
3 changes: 1 addition & 2 deletions src/test/scala/kamon/http4s/ClientInstrumentationSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,7 @@ class ClientInstrumentationSpec extends WordSpec

eventually(timeout(2 seconds)) {
val span = testSpanReporter().nextSpan().value
//TODO what should be client not found oper name, settings provide no default for clients
span.operationName shouldBe "http.client.request"
span.operationName shouldBe "/tracing/not-found"
span.kind shouldBe Span.Kind.Client
span.metricTags.get(plain("component")) shouldBe "http4s.client"
span.metricTags.get(plain("http.method")) shouldBe "GET"
Expand Down

0 comments on commit a79325c

Please sign in to comment.