diff --git a/packages/dd-trace/src/llmobs/writers/spans/agentProxy.js b/packages/dd-trace/src/llmobs/writers/spans/agentProxy.js index 6274f6117e0..62e497f487c 100644 --- a/packages/dd-trace/src/llmobs/writers/spans/agentProxy.js +++ b/packages/dd-trace/src/llmobs/writers/spans/agentProxy.js @@ -10,10 +10,10 @@ const LLMObsBaseSpanWriter = require('./base') class LLMObsAgentProxySpanWriter extends LLMObsBaseSpanWriter { constructor (config) { super({ - intake: config.hostname || 'localhost', - protocol: 'http:', + intake: config.url?.hostname || config.hostname || 'localhost', + protocol: config.url?.protocol || 'http:', endpoint: EVP_PROXY_AGENT_ENDPOINT, - port: config.port + port: config.url?.port || config.port }) this._headers[EVP_SUBDOMAIN_HEADER_NAME] = EVP_SUBDOMAIN_HEADER_VALUE diff --git a/packages/dd-trace/test/llmobs/writers/spans/agentProxy.spec.js b/packages/dd-trace/test/llmobs/writers/spans/agentProxy.spec.js index 6ed0f150885..412b43133a4 100644 --- a/packages/dd-trace/test/llmobs/writers/spans/agentProxy.spec.js +++ b/packages/dd-trace/test/llmobs/writers/spans/agentProxy.spec.js @@ -25,4 +25,12 @@ describe('LLMObsAgentProxySpanWriter', () => { expect(writer._url.href).to.equal('http://localhost:8126/evp_proxy/v2/api/v2/llmobs') }) + + it('uses the url property if provided on the config', () => { + writer = new LLMObsAgentProxySpanWriter({ + url: new URL('http://test-agent:12345') + }) + + expect(writer._url.href).to.equal('http://test-agent:12345/evp_proxy/v2/api/v2/llmobs') + }) })