Akka http server span names are always akka.request #3478 (#5150)

* Akka http server span names are always akka.request #3478
 - removed hardcoded span name "akka.request"
 - implemented route() in AkkaHttpServerAttributesExtractor to provide a better span name
 - retrofitted AkkaHttpServerInstrumentationTest.groovy

* Akka http server span names are always akka.request #3478
 - removed hardcoded span name "akka.request" and changed to "HTTP {METHOD}"
 - retrofitted AkkaHttpServerInstrumentationTest.groovy

* Akka http server span names are always akka.request #3478
 - removed hardcoded span name "akka.request" and changed to "HTTP {METHOD}"
 - retrofitted AkkaHttpServerInstrumentationTest.groovy

* Akka http server span names are always akka.request #3478
 - removed hardcoded span name "akka.request" and changed to "HTTP {METHOD}"
 - retrofitted AkkaHttpServerInstrumentationTest.groovy and related tests
This commit is contained in:
Matthew Ho 2022-01-20 14:11:33 -08:00 committed by GitHub
parent 2177a22605
commit 66bf050bf8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 6 deletions

View File

@ -10,6 +10,7 @@ import akka.http.scaladsl.model.HttpResponse;
import io.opentelemetry.api.GlobalOpenTelemetry;
import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter;
import io.opentelemetry.instrumentation.api.instrumenter.http.HttpServerMetrics;
import io.opentelemetry.instrumentation.api.instrumenter.http.HttpSpanNameExtractor;
import io.opentelemetry.instrumentation.api.instrumenter.http.HttpSpanStatusExtractor;
import io.opentelemetry.instrumentation.api.server.ServerSpanNaming;
import io.opentelemetry.javaagent.instrumentation.akkahttp.AkkaHttpUtil;
@ -25,7 +26,7 @@ public class AkkaHttpServerSingletons {
Instrumenter.<HttpRequest, HttpResponse>builder(
GlobalOpenTelemetry.get(),
AkkaHttpUtil.instrumentationName(),
unused -> "akka.request")
HttpSpanNameExtractor.create(httpAttributesExtractor))
.setSpanStatusExtractor(HttpSpanStatusExtractor.create(httpAttributesExtractor))
.addAttributesExtractor(httpAttributesExtractor)
.addRequestMetrics(HttpServerMetrics.get())

View File

@ -21,13 +21,13 @@ abstract class AkkaHttpServerInstrumentationTest extends HttpServerTest<Object>
// }
@Override
String expectedServerSpanName(ServerEndpoint endpoint) {
return "akka.request"
boolean testCapturedHttpHeaders() {
false
}
@Override
boolean testCapturedHttpHeaders() {
false
String expectedServerSpanName(ServerEndpoint endpoint) {
return "HTTP GET"
}
@Override

View File

@ -107,7 +107,7 @@ class PlayServerTest extends HttpServerTest<Server> implements AgentTestTrait {
@Override
String expectedServerSpanName(ServerEndpoint endpoint) {
return "akka.request"
return "HTTP GET"
}
}