Skip to content

Commit 4259a5c

Browse files
committed
wip
1 parent 08c4cf3 commit 4259a5c

File tree

4 files changed

+13
-6
lines changed

4 files changed

+13
-6
lines changed

dd-java-agent/instrumentation/spring-webmvc-3.1/src/main/java/datadog/trace/instrumentation/springweb/RequestMappingInfoIterator.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ private void fetchNext() {
6969
new Endpoint()
7070
.type(Endpoint.Type.REST)
7171
.operation(Endpoint.Operation.HTTP_REQUEST)
72+
.resource(method + " " + path)
7273
.path(path)
7374
.method(method)
7475
.requestBodyType(requestBody)

dd-java-agent/instrumentation/spring-webmvc-5.3/src/main/java/datadog/trace/instrumentation/springweb/RequestMappingInfoWithPathPatternsIterator.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ private void fetchNext() {
7373
new Endpoint()
7474
.type(Endpoint.Type.REST)
7575
.operation(Endpoint.Operation.HTTP_REQUEST)
76+
.resource(method + " " + path)
7677
.path(path)
7778
.method(method)
7879
.requestBodyType(requestBody)

internal-api/src/main/java/datadog/trace/api/telemetry/Endpoint.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ public class Endpoint {
1616
private String method;
1717
private String path;
1818
private String operation;
19+
private String resource;
1920
private List<String> requestBodyType;
2021
private List<String> responseBodyType;
2122
private List<Integer> responseCode;
@@ -67,6 +68,15 @@ public Endpoint operation(final String operation) {
6768
return this;
6869
}
6970

71+
public String getResource() {
72+
return resource;
73+
}
74+
75+
public Endpoint resource(final String resource) {
76+
this.resource = resource;
77+
return this;
78+
}
79+
7080
public List<String> getRequestBodyType() {
7181
return requestBodyType;
7282
}

telemetry/src/main/java/datadog/telemetry/TelemetryRequestBody.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -327,12 +327,7 @@ public void writeEndpoint(final Endpoint endpoint) throws IOException {
327327
bodyWriter.name("path").value(endpoint.getPath());
328328
}
329329
bodyWriter.name("operation_name").value(endpoint.getOperation());
330-
bodyWriter
331-
.name("resource_name")
332-
.value(
333-
endpoint.getMethod() != null && endpoint.getPath() != null
334-
? endpoint.getMethod() + " " + endpoint.getPath()
335-
: "UNDEFINED");
330+
bodyWriter.name("resource_name").value(endpoint.getResource());
336331
if (endpoint.getRequestBodyType() != null) {
337332
bodyWriter.name("request-body-type").jsonValue(endpoint.getRequestBodyType());
338333
}

0 commit comments

Comments
 (0)