Skip to content

Commit

Permalink
use url if provided from DD_TRACE_AGENT_URL (#5128)
Browse files Browse the repository at this point in the history
  • Loading branch information
sabrenner authored Jan 17, 2025
1 parent 015a722 commit f214673
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/dd-trace/src/llmobs/writers/spans/agentProxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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')
})
})

0 comments on commit f214673

Please sign in to comment.