Skip to content

Commit 0465b82

Browse files
authored
Fix endpoint telemetry request body
What Does This Do Change request-body-type to request_body_type to mach the defined schema Add optional fields to endpoint unit tests Motivation The current implementation of endpoint discovery for API Security does not match the latest version of the RFC. Additional Notes https://docs.google.com/document/d/1txwuurIiSUWjYX7Xa0let7e49XKW2uhm1djgqjl_gL0/edit?tab=t.0
1 parent d6b43cb commit 0465b82

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ public void writeEndpoint(final Endpoint endpoint) throws IOException {
329329
bodyWriter.name("operation_name").value(endpoint.getOperation());
330330
bodyWriter.name("resource_name").value(endpoint.getResource());
331331
if (endpoint.getRequestBodyType() != null) {
332-
bodyWriter.name("request-body-type").jsonValue(endpoint.getRequestBodyType());
332+
bodyWriter.name("request_body_type").jsonValue(endpoint.getRequestBodyType());
333333
}
334334
if (endpoint.getResponseBodyType() != null) {
335335
bodyWriter.name("response_body_type").jsonValue(endpoint.getResponseBodyType());

telemetry/src/test/groovy/datadog/telemetry/TelemetryServiceSpecification.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class TelemetryServiceSpecification extends DDSpecification {
2626
def distribution = new DistributionSeries().namespace("tracers").metric("distro").points([1, 2, 3]).tags(["tag1", "tag2"]).common(false)
2727
def logMessage = new LogMessage().message("log-message").tags("tag1:tag2").level(LogMessageLevel.DEBUG).stackTrace("stack-trace").tracerTime(32423).count(1)
2828
def productChange = new ProductChange().productType(ProductChange.ProductType.APPSEC).enabled(true)
29-
def endpoint = new Endpoint().first(true).type('REST').method("GET").operation('http.request').resource("GET /test").path("/test")
29+
def endpoint = new Endpoint().first(true).type('REST').method("GET").operation('http.request').resource("GET /test").path("/test").requestBodyType(['application/json']).responseBodyType(['application/json']).responseCode([200]).authentication(['JWT'])
3030

3131
def 'happy path without data'() {
3232
setup:

0 commit comments

Comments
 (0)