Skip to content

Commit

Permalink
Merge pull request #4809 from DataDog/andrea.marziali/naming-spray
Browse files Browse the repository at this point in the history
naming schema: spray
  • Loading branch information
amarziali authored Mar 1, 2023
2 parents b68e288 + 0b92cf7 commit c545cdc
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@

public class SprayHttpServerDecorator
extends HttpServerDecorator<HttpRequest, RequestContext, HttpResponse, HttpRequest> {
public static final CharSequence SPRAY_HTTP_REQUEST =
UTF8BytesString.create("spray-http.request");
public static final CharSequence SPRAY_HTTP_SERVER = UTF8BytesString.create("spray-http-server");

public static final SprayHttpServerDecorator DECORATE = new SprayHttpServerDecorator();

private static final CharSequence SPRAY_HTTP_REQUEST =
UTF8BytesString.create(DECORATE.operationName());

@Override
protected AgentPropagation.ContextVisitor<HttpRequest> getter() {
return Request.GETTER;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.activeSpan;
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.startSpan;
import static datadog.trace.instrumentation.spray.SprayHttpServerDecorator.DECORATE;
import static datadog.trace.instrumentation.spray.SprayHttpServerDecorator.SPRAY_HTTP_REQUEST;

import datadog.trace.bootstrap.instrumentation.api.AgentScope;
import datadog.trace.bootstrap.instrumentation.api.AgentSpan;
Expand All @@ -25,7 +24,7 @@ public static AgentScope enter(@Advice.Argument(value = 1, readOnly = false) Req
span = DECORATE.startSpan(request, extractedContext);
} else {
extractedContext = null;
span = startSpan(SPRAY_HTTP_REQUEST);
span = startSpan(DECORATE.spanName());
}

DECORATE.afterStart(span);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import datadog.trace.agent.test.base.HttpServer
import datadog.trace.agent.test.base.HttpServerTest
import datadog.trace.agent.test.naming.TestingGenericHttpNamingConventions
import datadog.trace.instrumentation.spray.SprayHttpServerDecorator

class SprayServerTest extends HttpServerTest<SprayHttpTestWebServer> {
abstract class SprayServerTest extends HttpServerTest<SprayHttpTestWebServer> {

@Override
HttpServer server() {
Expand All @@ -23,7 +24,7 @@ class SprayServerTest extends HttpServerTest<SprayHttpTestWebServer> {

@Override
String expectedOperationName() {
return SprayHttpServerDecorator.DECORATE.SPRAY_HTTP_REQUEST
return operation()
}

@Override
Expand Down Expand Up @@ -56,3 +57,23 @@ class SprayServerTest extends HttpServerTest<SprayHttpTestWebServer> {
def setup() {
}
}

class SprayServerV0ForkedTest extends SprayServerTest {
@Override
int version() {
return 0
}

@Override
String service() {
return null
}

@Override
String operation() {
return "spray-http.request"
}
}

class SprayServerV1ForkedTest extends SprayServerTest implements TestingGenericHttpNamingConventions.ServerV1 {
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ public String operationForComponent(@Nonnull String component) {
case "finatra":
prefix = "finatra";
break;
case "spray-http-server":
prefix = "spray-http";
break;
default:
prefix = "servlet";
break;
Expand Down

0 comments on commit c545cdc

Please sign in to comment.