@@ -31,53 +31,46 @@ class ActionTelemetry implements Telemetry {
31
31
logInputAndOutput : boolean ,
32
32
projectId ?: string
33
33
) : void {
34
- if ( ! logInputAndOutput ) {
35
- return ;
36
- }
37
34
const attributes = span . attributes ;
38
- const actionName = ( attributes [ 'genkit:name' ] as string ) || '<unknown>' ;
39
35
const type = attributes [ 'genkit:type' ] as string ;
40
- const subtype = attributes [ 'genkit:metadata:subtype' ] as string ;
36
+ if ( ! logInputAndOutput || type === 'embedder' || type === 'indexer' ) {
37
+ return ;
38
+ }
41
39
42
- if (
43
- type === 'promptTemplate' ||
44
- subtype === 'tool' ||
45
- actionName === 'generate'
46
- ) {
47
- const path = ( attributes [ 'genkit:path' ] as string ) || '<unknown>' ;
48
- const input = truncate ( attributes [ 'genkit:input' ] as string ) ;
49
- const output = truncate ( attributes [ 'genkit:output' ] as string ) ;
50
- const sessionId = attributes [ 'genkit:sessionId' ] as string ;
51
- const threadName = attributes [ 'genkit:threadName' ] as string ;
52
- let featureName = extractOuterFeatureNameFromPath ( path ) ;
53
- if ( ! featureName || featureName === '<unknown>' ) {
54
- featureName = actionName ;
55
- }
40
+ const actionName = ( attributes [ 'genkit:name' ] as string ) || '<unknown>' ;
41
+ const path = ( attributes [ 'genkit:path' ] as string ) || '<unknown>' ;
42
+ const input = truncate ( attributes [ 'genkit:input' ] as string ) ;
43
+ const output = truncate ( attributes [ 'genkit:output' ] as string ) ;
44
+ const sessionId = attributes [ 'genkit:sessionId' ] as string ;
45
+ const threadName = attributes [ 'genkit:threadName' ] as string ;
46
+ let featureName = extractOuterFeatureNameFromPath ( path ) ;
47
+ if ( ! featureName || featureName === '<unknown>' ) {
48
+ featureName = actionName ;
49
+ }
56
50
57
- if ( input ) {
58
- this . writeLog (
59
- span ,
60
- 'Input' ,
61
- featureName ,
62
- path ,
63
- input ,
64
- projectId ,
65
- sessionId ,
66
- threadName
67
- ) ;
68
- }
69
- if ( output ) {
70
- this . writeLog (
71
- span ,
72
- 'Output' ,
73
- featureName ,
74
- path ,
75
- output ,
76
- projectId ,
77
- sessionId ,
78
- threadName
79
- ) ;
80
- }
51
+ if ( input ) {
52
+ this . writeLog (
53
+ span ,
54
+ 'Input' ,
55
+ featureName ,
56
+ path ,
57
+ input ,
58
+ projectId ,
59
+ sessionId ,
60
+ threadName
61
+ ) ;
62
+ }
63
+ if ( output ) {
64
+ this . writeLog (
65
+ span ,
66
+ 'Output' ,
67
+ featureName ,
68
+ path ,
69
+ output ,
70
+ projectId ,
71
+ sessionId ,
72
+ threadName
73
+ ) ;
81
74
}
82
75
}
83
76
0 commit comments