Skip to content
Draft
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
Expand Up @@ -53,6 +53,7 @@ public EvalProcessingWorker(

Headers headers;
HttpUrl submissionUrl;
OkHttpClient httpClient;
if (isAgentless) {
submissionUrl =
HttpUrl.get(
Expand All @@ -63,17 +64,28 @@ public EvalProcessingWorker(
+ "/"
+ EVAL_METRIC_API_PATH);
headers = Headers.of(DD_API_KEY_HEADER_NAME, config.getApiKey());
// The shared intake client is cleartext-only once the flag is enabled for another backend
// intake, and OkHttp then rejects our HTTPS submissions, so keep a client of our own rather
// than share one that cannot reach the eval intake.
httpClient =
config.isForceClearTextHttpForIntakeClient()
? OkHttpUtils.buildHttpClient(submissionUrl, sco.httpClientTimeout)
: sco.getIntakeHttpClient();
} else {
submissionUrl =
HttpUrl.get(
sco.agentUrl.toString()
+ DDAgentFeaturesDiscovery.V2_EVP_PROXY_ENDPOINT
+ EVAL_METRIC_API_PATH);
headers = Headers.of(EVP_SUBDOMAIN_HEADER_NAME, EVAL_METRIC_API_DOMAIN);
// For a UDS or named pipe Agent, `agentUrl` is only a placeholder and the socket transport
// lives on the shared client, so a client of our own would never reach the Agent.
httpClient = sco.agentHttpClient;
}

EvalSerializingHandler serializingHandler =
new EvalSerializingHandler(queue, flushInterval, timeUnit, submissionUrl, headers);
new EvalSerializingHandler(
queue, flushInterval, timeUnit, submissionUrl, headers, httpClient);
this.serializerThread = newAgentThread(LLMOBS_EVALS_PROCESSOR, serializingHandler);
}

Expand Down Expand Up @@ -116,12 +128,13 @@ public EvalSerializingHandler(
final long flushInterval,
final TimeUnit timeUnit,
final HttpUrl submissionUrl,
final Headers headers) {
final Headers headers,
final OkHttpClient httpClient) {
this.queue = queue;
this.moshi = new Moshi.Builder().add(LLMObsEval.class, new LLMObsEval.Adapter()).build();

this.evalJsonAdapter = moshi.adapter(LLMObsEval.Request.class);
this.httpClient = new OkHttpClient();
this.httpClient = httpClient;
this.submissionUrl = submissionUrl;
this.headers = headers;

Expand Down