File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -120,7 +120,11 @@ class BaseLLMObsWriter {
120
120
}
121
121
122
122
const { hostname, port } = this . _config
123
- const base = this . _config . url || new URL ( format ( {
123
+
124
+ const overrideOriginEnv = getEnvironmentVariable ( '_DD_LLMOBS_OVERRIDE_ORIGIN' )
125
+ const overrideOriginUrl = overrideOriginEnv && new URL ( overrideOriginEnv )
126
+
127
+ const base = overrideOriginUrl ?? this . _config . url ?? new URL ( format ( {
124
128
protocol : 'http:' ,
125
129
hostname,
126
130
port
Original file line number Diff line number Diff line change 1
1
'use strict'
2
2
const { expect } = require ( 'chai' )
3
3
const proxyquire = require ( 'proxyquire' )
4
+ const { useEnv } = require ( '../../../../../integration-tests/helpers' )
4
5
5
6
describe ( 'BaseLLMObsWriter' , ( ) => {
6
7
let BaseLLMObsWriter
@@ -60,6 +61,19 @@ describe('BaseLLMObsWriter', () => {
60
61
expect ( writer . url ) . to . equal ( 'http://localhost:8126/evp_proxy/v2/endpoint' )
61
62
} )
62
63
64
+ describe ( 'with override origin' , ( ) => {
65
+ useEnv ( {
66
+ _DD_LLMOBS_OVERRIDE_ORIGIN : 'http://override-origin:12345'
67
+ } )
68
+
69
+ it ( 'constructs a writer with the correct url' , ( ) => {
70
+ writer = new BaseLLMObsWriter ( options )
71
+ writer . setAgentless ( false )
72
+
73
+ expect ( writer . url ) . to . equal ( 'http://override-origin:12345/evp_proxy/v2/endpoint' )
74
+ } )
75
+ } )
76
+
63
77
describe ( 'with config url' , ( ) => {
64
78
beforeEach ( ( ) => {
65
79
options . config . url = new URL ( 'http://test-agent:12345' )
You can’t perform that action at this time.
0 commit comments