Repository navigation
Commit 1ae46c4
committed
feat(gooddata-eval): label gen-ai traces through W3C baggage
Langfuse v4 cannot add a label to an observation after it is created:
the trace-create ingestion event stops working on 2026-11-16 and no
endpoint updates an existing observation. A caller that wants its
gen-ai traces grouped by combo or CI run therefore has to send the
label with the request.
ChatClient now reads GOODDATA_EVAL_TRACE_LABELS (key=value pairs,
comma-separated) and sends them as a W3C baggage header on every chat
request: each label as langfuse_metadata_<key>, and model_version also
as langfuse_version, the dimension Langfuse groups cost by. gen-ai's
Langfuse span processor copies langfuse_* baggage onto every span it
starts, so the root generation, the cost-bearing children, retries and
the title trace all carry the labels. Values are percent-encoded; OTel
decodes them with unquote_plus, so '+' and spaces survive. Unset or
empty sends no header, which keeps every existing run unchanged.
Verified against gen-ai's own langfuse 4.14.4 SDK and FastAPI
instrumentation: the header this builds lands as langfuse.version and
langfuse.trace.metadata.* on both the root and the child generation.
gen-ai only keeps caller langfuse_* baggage where
genAi.langfuse.acceptCallerBaggage is on (gooddata/gdc-nas#27251).
jira: trivial
risk: low1 parent 0a7b141 commit 1ae46c4
3 files changed
Lines changed: 89 additions & 1 deletion
File tree
- packages/gooddata-eval
- src/gooddata_eval/core/chat
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
156 | 156 | | |
157 | 157 | | |
158 | 158 | | |
| 159 | + | |
159 | 160 | | |
160 | 161 | | |
161 | 162 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
135 | 136 | | |
136 | 137 | | |
137 | 138 | | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
138 | 165 | | |
139 | 166 | | |
140 | 167 | | |
| |||
466 | 493 | | |
467 | 494 | | |
468 | 495 | | |
469 | | - | |
| 496 | + | |
470 | 497 | | |
471 | 498 | | |
472 | 499 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
3 | 5 | | |
4 | 6 | | |
5 | 7 | | |
| |||
1053 | 1055 | | |
1054 | 1056 | | |
1055 | 1057 | | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
| 1065 | + | |
| 1066 | + | |
| 1067 | + | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
0 commit comments