File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,20 @@ import env from "@/env.ts";
1010
1111diag . setLogger ( new DiagConsoleLogger ( ) , DiagLogLevel . ERROR ) ;
1212
13+ const isLLMProviderFetch = ( span : any ) => {
14+ const aiProviderHostnames = [
15+ "openai.com" ,
16+ "anthropic.com" ,
17+ "claude.ai" ,
18+ "groq.com" ,
19+ "aiplatform.googleapis.com" ,
20+ ] ;
21+
22+ return aiProviderHostnames . some ( ( hostname ) =>
23+ span . attributes [ "http.url" ] ?. toString ( ) . includes ( hostname )
24+ ) ;
25+ } ;
26+
1327export function register ( ) {
1428 registerOTel ( {
1529 serviceName : env . CTTS_AI_LLM_PHOENIX_PROJECT ,
@@ -29,9 +43,9 @@ export function register() {
2943 spanFilter : ( span ) => {
3044 // console.log("SPAN", span);
3145 const includeSpanCriteria = [
32- isOpenInferenceSpan ( span ) ,
3346 span . attributes [ "http.route" ] == "/api/ai/llm" , // Include the root span, which is in the hono app
34- span . instrumentationLibrary . name . includes ( "@vercel/otel" ) , // Include the actual LLM API fetch span
47+ isOpenInferenceSpan ( span ) ,
48+ isLLMProviderFetch ( span ) , // Include fetch spans to LLM providers
3549 ] ;
3650 return includeSpanCriteria . some ( ( c ) => c ) ;
3751 } ,
You can’t perform that action at this time.
0 commit comments