MCPcopy Index your code
hub / github.com/FlowiseAI/Flowise / getArizeTracer

Function getArizeTracer

packages/components/src/handler.ts:52–84  ·  view source on GitHub ↗
(options: ArizeTracerOptions)

Source from the content-addressed store, hash-verified

50}
51
52function getArizeTracer(options: ArizeTracerOptions): Tracer | undefined {
53 const SEMRESATTRS_PROJECT_NAME = 'openinference.project.name'
54 try {
55 const metadata = new Metadata()
56 metadata.set('api_key', options.apiKey)
57 metadata.set('space_id', options.spaceId)
58 const traceExporter = new GrpcOTLPTraceExporter({
59 url: `${options.baseUrl}/v1`,
60 metadata
61 })
62 const tracerProvider = new NodeTracerProvider({
63 resource: new Resource({
64 [ATTR_SERVICE_NAME]: options.projectName,
65 [ATTR_SERVICE_VERSION]: '1.0.0',
66 [SEMRESATTRS_PROJECT_NAME]: options.projectName,
67 model_id: options.projectName
68 })
69 })
70 tracerProvider.addSpanProcessor(new SimpleSpanProcessor(traceExporter))
71 if (options.enableCallback) {
72 registerInstrumentations({
73 instrumentations: []
74 })
75 const lcInstrumentation = new LangChainInstrumentation()
76 lcInstrumentation.manuallyInstrument(CallbackManagerModule)
77 tracerProvider.register()
78 }
79 return tracerProvider.getTracer(`arize-tracer-${uuidv4().toString()}`)
80 } catch (err) {
81 if (process.env.DEBUG === 'true') console.error(`Error setting up Arize tracer: ${err.message}`)
82 return undefined
83 }
84}
85
86interface PhoenixTracerOptions {
87 apiKey: string

Callers 2

additionalCallbacksFunction · 0.85
initializeProviderMethod · 0.85

Calls 2

setMethod · 0.80
registerMethod · 0.65

Tested by

no test coverage detected