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

Function getOpikTracer

packages/components/src/handler.ts:150–182  ·  view source on GitHub ↗
(options: OpikTracerOptions)

Source from the content-addressed store, hash-verified

148}
149
150function getOpikTracer(options: OpikTracerOptions): Tracer | undefined {
151 const SEMRESATTRS_PROJECT_NAME = 'openinference.project.name'
152 try {
153 const traceExporter = new ProtoOTLPTraceExporter({
154 url: `${options.baseUrl}/v1/private/otel/v1/traces`,
155 headers: {
156 Authorization: options.apiKey,
157 projectName: options.projectName,
158 'Comet-Workspace': options.workspace
159 }
160 })
161 const tracerProvider = new NodeTracerProvider({
162 resource: new Resource({
163 [ATTR_SERVICE_NAME]: options.projectName,
164 [ATTR_SERVICE_VERSION]: '1.0.0',
165 [SEMRESATTRS_PROJECT_NAME]: options.projectName
166 })
167 })
168 tracerProvider.addSpanProcessor(new SimpleSpanProcessor(traceExporter))
169 if (options.enableCallback) {
170 registerInstrumentations({
171 instrumentations: []
172 })
173 const lcInstrumentation = new LangChainInstrumentation()
174 lcInstrumentation.manuallyInstrument(CallbackManagerModule)
175 tracerProvider.register()
176 }
177 return tracerProvider.getTracer(`opik-tracer-${uuidv4().toString()}`)
178 } catch (err) {
179 if (process.env.DEBUG === 'true') console.error(`Error setting up Opik tracer: ${err.message}`)
180 return undefined
181 }
182}
183
184function tryGetJsonSpaces() {
185 try {

Callers 2

additionalCallbacksFunction · 0.85
initializeProviderMethod · 0.85

Calls 1

registerMethod · 0.65

Tested by

no test coverage detected