File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 1
1
import { Logger } from 'winston'
2
+ import { URL } from 'url'
2
3
import { v4 as uuidv4 } from 'uuid'
3
4
import { Client } from 'langsmith'
4
5
import CallbackHandler from 'langfuse-langchain'
@@ -94,10 +95,14 @@ interface PhoenixTracerOptions {
94
95
function getPhoenixTracer ( options : PhoenixTracerOptions ) : Tracer | undefined {
95
96
const SEMRESATTRS_PROJECT_NAME = 'openinference.project.name'
96
97
try {
98
+ const parsed = new URL ( options . baseUrl )
99
+ const baseEndpoint = `${ parsed . protocol } //${ parsed . host } `
100
+ const path = parsed . pathname . replace ( / \/ $ / , '' )
97
101
const traceExporter = new ProtoOTLPTraceExporter ( {
98
- url : `${ options . baseUrl } /v1/traces` ,
102
+ url : `${ baseEndpoint } ${ path } /v1/traces` ,
99
103
headers : {
100
- api_key : options . apiKey
104
+ api_key : options . apiKey || '' ,
105
+ authorization : `Bearer ${ options . apiKey || '' } `
101
106
}
102
107
} )
103
108
const tracerProvider = new NodeTracerProvider ( {
You can’t perform that action at this time.
0 commit comments