Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"request": {
"method": "POST",
"url": "https://api.openai.com/v1/chat/completions",
"headers": {
"User-Agent": "OpenAIClientImpl/Java unknown",
"X-Stainless-Arch": "arm64",
"X-Stainless-Lang": "java",
"X-Stainless-OS": "Linux",
"X-Stainless-OS-Version": "6.12.65-linuxkit",
"X-Stainless-Package-Version": "unknown",
"X-Stainless-Retry-Count": "0",
"X-Stainless-Runtime": "JRE",
"X-Stainless-Runtime-Version": "17.0.9",
"X-Stainless-Read-Timeout": "600",
"X-Stainless-Timeout": "600",
"Content-Type": "application/json",
"Content-Length": "96",
"Connection": "Keep-Alive",
"Accept-Encoding": "gzip"
},
"body": "{\"messages\":[{\"content\":\"Hello OpenAI!\",\"role\":\"user\"}],\"model\":\"gpt-3.5-turbo\",\"max_tokens\":35}"
},
"response": {
"status": {
"code": 200,
"message": "OK"
},
"headers": {
"Date": "Fri, 20 Feb 2026 00:00:43 GMT",
"Content-Type": "application/json",
"Transfer-Encoding": "chunked",
"Connection": "keep-alive",
"access-control-expose-headers": "X-Request-ID",
"openai-processing-ms": "796",
"openai-project": "proj_gt6TQZPRbZfoY2J9AQlEJMpd",
"openai-version": "2020-10-01",
"Server": "cloudflare",
"x-ratelimit-limit-requests": "10000",
"x-ratelimit-limit-tokens": "50000000",
"x-ratelimit-remaining-requests": "9999",
"x-ratelimit-remaining-tokens": "49999994",
"x-ratelimit-reset-requests": "6ms",
"x-ratelimit-reset-tokens": "0s",
"x-request-id": "req_ac2897c2c6e840a0a0e12c7684ecfaae",
"x-openai-proxy-wasm": "v0.1",
"cf-cache-status": "DYNAMIC",
"set-cookie": "__cf_bm=gxZLEchqKMKTztQgXT8SUS624bU_sDykIXEy5gIFT_0-1771545642.824098-1.0.1.1-QpgexMX9Wbte8oAZv3LqUJZ1h0k6pkjTClR8qrer4op9P_ZpyvkkAKda8jZv24esL4dcf9wH2J0QFkZwslpRyBNi17Ws.QFAgt18DyHO8dv4c_nHnZ_4GYCIU1r8ldNt; HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Fri, 20 Feb 2026 00:30:43 GMT",
"Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload",
"X-Content-Type-Options": "nosniff",
"Content-Encoding": "gzip",
"CF-RAY": "9d09b9aba85630ad-SEA",
"alt-svc": "h3=\":443\"; ma=86400"
},
"body": "{\n \"id\": \"chatcmpl-DB8ElAOKW90QXI3wOJx1LBxBOdfgf\",\n \"object\": \"chat.completion\",\n \"created\": 1771545643,\n \"model\": \"gpt-3.5-turbo-0125\",\n \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": \"Hello! How can I assist you today?\",\n \"refusal\": null,\n \"annotations\": []\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 11,\n \"completion_tokens\": 9,\n \"total_tokens\": 20,\n \"prompt_tokens_details\": {\n \"cached_tokens\": 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": \"default\",\n \"system_fingerprint\": null\n}\n"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"request": {
"method": "POST",
"url": "https://api.openai.com/v1/chat/completions",
"headers": {
"User-Agent": "OpenAIClientImpl/Java unknown",
"X-Stainless-Arch": "arm64",
"X-Stainless-Lang": "java",
"X-Stainless-OS": "Linux",
"X-Stainless-OS-Version": "6.12.65-linuxkit",
"X-Stainless-Package-Version": "unknown",
"X-Stainless-Retry-Count": "0",
"X-Stainless-Runtime": "JRE",
"X-Stainless-Runtime-Version": "17.0.9",
"X-Stainless-Read-Timeout": "600",
"X-Stainless-Timeout": "600",
"Content-Type": "application/json",
"Content-Length": "537",
"Connection": "Keep-Alive",
"Accept-Encoding": "gzip"
},
"body": "{\"messages\":[{\"content\":\"Bob is a student at Stanford University. He is studying computer science.\",\"role\":\"user\"}],\"model\":\"gpt-3.5-turbo\",\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"extract_student_info\",\"description\":\"Get the student information from the body of the input text\",\"parameters\":{\"type\":\"object\",\"properties\":{\"major\":{\"description\":\"Major subject.\",\"type\":\"string\"},\"school\":{\"description\":\"The university name.\",\"type\":\"string\"},\"name\":{\"description\":\"Name of the person\",\"type\":\"string\"}}}},\"type\":\"function\"}]}"
},
"response": {
"status": {
"code": 200,
"message": "OK"
},
"headers": {
"Date": "Fri, 20 Feb 2026 00:01:06 GMT",
"Content-Type": "application/json",
"Transfer-Encoding": "chunked",
"Connection": "keep-alive",
"access-control-expose-headers": "X-Request-ID",
"openai-processing-ms": "463",
"openai-project": "proj_gt6TQZPRbZfoY2J9AQlEJMpd",
"openai-version": "2020-10-01",
"Server": "cloudflare",
"x-ratelimit-limit-requests": "10000",
"x-ratelimit-limit-tokens": "50000000",
"x-ratelimit-remaining-requests": "9999",
"x-ratelimit-remaining-tokens": "49999979",
"x-ratelimit-reset-requests": "6ms",
"x-ratelimit-reset-tokens": "0s",
"x-request-id": "req_1503996b1cea4bca91a0697db9eec68e",
"x-openai-proxy-wasm": "v0.1",
"cf-cache-status": "DYNAMIC",
"set-cookie": "__cf_bm=Y.uMUvKXcR9Yk6xXzcExCuLDDxpKWoS90CZWc5aj_78-1771545665.585499-1.0.1.1-qZlmanRqlTnlgnA_UKxWN6ccJeGJMZ5cU8hQn4XOsKn2_XJnm1IuHxGV8ejtnSlnbsmSfy6dmFNMOlDANMzF9kJG1U4ZD82BHh6ZqUZnE5Xgyn07s46Z66pomW1vQ4BI; HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Fri, 20 Feb 2026 00:31:06 GMT",
"Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload",
"X-Content-Type-Options": "nosniff",
"Content-Encoding": "gzip",
"CF-RAY": "9d09ba39ea9bdf09-SEA",
"alt-svc": "h3=\":443\"; ma=86400"
},
"body": "{\n \"id\": \"chatcmpl-DB8F79pRqLfT6pTKajxAu4MpCpMZe\",\n \"object\": \"chat.completion\",\n \"created\": 1771545665,\n \"model\": \"gpt-3.5-turbo-0125\",\n \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": null,\n \"tool_calls\": [\n {\n \"id\": \"call_NAE9VXAzyT6ftmPl4lmeSb4E\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"extract_student_info\",\n \"arguments\": \"{\\\"name\\\":\\\"Bob\\\",\\\"school\\\":\\\"Stanford University\\\",\\\"major\\\":\\\"computer science\\\"}\"\n }\n }\n ],\n \"refusal\": null,\n \"annotations\": []\n },\n \"logprobs\": null,\n \"finish_reason\": \"tool_calls\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 89,\n \"completion_tokens\": 26,\n \"total_tokens\": 115,\n \"prompt_tokens_details\": {\n \"cached_tokens\": 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": \"default\",\n \"system_fingerprint\": null\n}\n"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"request": {
"method": "POST",
"url": "https://api.openai.com/v1/responses",
"headers": {
"User-Agent": "OpenAIClientImpl/Java unknown",
"X-Stainless-Arch": "arm64",
"X-Stainless-Lang": "java",
"X-Stainless-OS": "Linux",
"X-Stainless-OS-Version": "6.12.65-linuxkit",
"X-Stainless-Package-Version": "unknown",
"X-Stainless-Retry-Count": "0",
"X-Stainless-Runtime": "JRE",
"X-Stainless-Runtime-Version": "17.0.9",
"X-Stainless-Read-Timeout": "600",
"X-Stainless-Timeout": "600",
"Content-Type": "application/json",
"Content-Length": "151",
"Connection": "Keep-Alive",
"Accept-Encoding": "gzip"
},
"body": "{\"input\":\"Where is the nearest Dunkin' Donuts?\",\"instructions\":\"Talk with a Boston accent.\",\"max_output_tokens\":50,\"model\":\"gpt-4.1\",\"temperature\":0.1}"
},
"response": {
"status": {
"code": 200,
"message": "OK"
},
"headers": {
"Date": "Fri, 20 Feb 2026 00:01:31 GMT",
"Content-Type": "application/json",
"Transfer-Encoding": "chunked",
"Connection": "keep-alive",
"Server": "cloudflare",
"openai-version": "2020-10-01",
"openai-project": "proj_gt6TQZPRbZfoY2J9AQlEJMpd",
"x-request-id": "req_796176c9da464aaf8c000e63907a2bf7",
"openai-processing-ms": "1286",
"cf-cache-status": "DYNAMIC",
"set-cookie": "__cf_bm=HilBezoeGvyXngzMc0Hg5DN6LG9wn_W3H8k.lG1Jz20-1771545689.5935988-1.0.1.1-bWm4zCWS6C.HmOejInX98jG7KXqlhLKGLxZlPVQtSvp_ZVUH8sbSxIOSCmYHzImhWSX55AD1yIc.F4swLEWMcUUtZPrBalOmf3KSpx75d.0DPU0BD_n4nstlZ1bNu0LX; HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Fri, 20 Feb 2026 00:31:31 GMT",
"Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload",
"X-Content-Type-Options": "nosniff",
"Content-Encoding": "gzip",
"CF-RAY": "9d09bacffb441760-SEA",
"alt-svc": "h3=\":443\"; ma=86400"
},
"body": "{\n \"id\": \"resp_081d29a052f49e9a016997a459f6fc819681f5286582acecea\",\n \"object\": \"response\",\n \"created_at\": 1771545690,\n \"status\": \"incomplete\",\n \"background\": false,\n \"billing\": {\n \"payer\": \"developer\"\n },\n \"completed_at\": null,\n \"error\": null,\n \"frequency_penalty\": 0.0,\n \"incomplete_details\": {\n \"reason\": \"max_output_tokens\"\n },\n \"instructions\": \"Talk with a Boston accent.\",\n \"max_output_tokens\": 50,\n \"max_tool_calls\": null,\n \"model\": \"gpt-4.1-2025-04-14\",\n \"output\": [\n {\n \"id\": \"msg_081d29a052f49e9a016997a45a44608196a2d157dfe2ab47ff\",\n \"type\": \"message\",\n \"status\": \"incomplete\",\n \"content\": [\n {\n \"type\": \"output_text\",\n \"annotations\": [],\n \"logprobs\": [],\n \"text\": \"Ah, ya lookin\\u2019 for a Dunkies, huh? Classic! In Boston, ya can\\u2019t throw a rock without hittin\\u2019 a Dunkin\\u2019. There\\u2019s prob\\u2019ly one on the next block, right next to the T stop.\"\n }\n ],\n \"role\": \"assistant\"\n }\n ],\n \"parallel_tool_calls\": true,\n \"presence_penalty\": 0.0,\n \"previous_response_id\": null,\n \"prompt_cache_key\": null,\n \"prompt_cache_retention\": null,\n \"reasoning\": {\n \"effort\": null,\n \"summary\": null\n },\n \"safety_identifier\": null,\n \"service_tier\": \"default\",\n \"store\": false,\n \"temperature\": 0.1,\n \"text\": {\n \"format\": {\n \"type\": \"text\"\n },\n \"verbosity\": \"medium\"\n },\n \"tool_choice\": \"auto\",\n \"tools\": [],\n \"top_logprobs\": 0,\n \"top_p\": 1.0,\n \"truncation\": \"disabled\",\n \"usage\": {\n \"input_tokens\": 27,\n \"input_tokens_details\": {\n \"cached_tokens\": 0\n },\n \"output_tokens\": 50,\n \"output_tokens_details\": {\n \"reasoning_tokens\": 0\n },\n \"total_tokens\": 77\n },\n \"user\": null,\n \"metadata\": {}\n}"
}
}
10 changes: 9 additions & 1 deletion utils/_context/_scenarios/integration_frameworks.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def __init__(self, name: str, doc: str) -> None:
name,
doc=doc,
github_workflow="endtoend",
agent_image="ghcr.io/datadog/dd-apm-test-agent/ddapm-test-agent:v1.38.0",
agent_image="ghcr.io/datadog/dd-apm-test-agent/ddapm-test-agent:v1.42.0",
scenario_groups=(groups.integration_frameworks,),
)

Expand Down Expand Up @@ -159,3 +159,11 @@ def _set_dd_trace_integrations_enabled(self, library: str) -> None:
self.environment["DD_TRACE_DNS_ENABLED"] = "false"
self.environment["DD_TRACE_NET_ENABLED"] = "false"
self.environment["DD_TRACE_FETCH_ENABLED"] = "false"
elif library == "java":
# Disable Jetty/Javalin/servlet instrumentation to only see OpenAI spans
self.environment["DD_INTEGRATION_OKHTTP_ENABLED"] = "false"
self.environment["DD_INTEGRATION_JETTY_ENABLED"] = "false"
# Reduce telemetry intervals for faster metric reporting in tests
self.environment["DD_TELEMETRY_HEARTBEAT_INTERVAL"] = "1"
self.environment["DD_TELEMETRY_METRICS_INTERVAL"] = "1"
self.environment["DD_TRACE_DEBUG"] = "true"
32 changes: 32 additions & 0 deletions utils/build/docker/java/openai-java.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
FROM maven:3.9.5-eclipse-temurin-17

ARG FRAMEWORK_VERSION

WORKDIR /app

COPY utils/build/docker/java/openai_app /app

RUN ["./gradlew", "init"]


# TODO $FRAMEWORK_VERSION pass thru if set


# Copy DD trace installation scripts and binaries
COPY utils/build/docker/java/install_ddtrace.sh binaries* /binaries/

RUN /binaries/install_ddtrace.sh

# Build the application
RUN ["./gradlew", "build"]

# Create logs directory
RUN mkdir -p /integration-framework-tracer-logs

# Set environment variables
ENV DD_TRACE_STARTUP_LOGS=true

ENV JAVA_TOOL_OPTIONS="-javaagent:/dd-tracer/dd-java-agent.jar"

# Run the application with DD Java agent
CMD ["./gradlew", "run", "--no-daemon"]
2 changes: 2 additions & 0 deletions utils/build/docker/java/openai_app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.gradle/
build/
30 changes: 30 additions & 0 deletions utils/build/docker/java/openai_app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
plugins {
id 'java'
id 'application'
id 'com.github.johnrengelman.shadow' version '7.1.2'
}

group = 'com.example'
version = '1.0.0'

sourceCompatibility = '17'
targetCompatibility = '17'

repositories {
mavenCentral()
}

dependencies {
implementation 'io.javalin:javalin:5.3.2'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.14.2'
implementation 'org.json:json:20230227'
implementation 'org.slf4j:slf4j-simple:2.0.3'
implementation 'com.openai:openai-java:3.0.0'
implementation 'com.anthropic:anthropic-java:2.4.0'

implementation files('/dd-tracer/dd-java-agent.jar')
}

application {
mainClass = 'SingleFileServer'
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading
Loading