@fallom/trace 0.2.13 → 0.2.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -11,6 +11,10 @@ interface SessionContext {
11
11
  configKey: string;
12
12
  sessionId: string;
13
13
  customerId?: string;
14
+ /** Custom key-value metadata for filtering/grouping */
15
+ metadata?: Record<string, string | number | boolean>;
16
+ /** Simple string tags for quick filtering */
17
+ tags?: string[];
14
18
  }
15
19
  /**
16
20
  * Trace context for linking spans together.
@@ -42,6 +46,8 @@ interface TraceData {
42
46
  error_message?: string;
43
47
  time_to_first_token_ms?: number;
44
48
  is_streaming?: boolean;
49
+ metadata?: Record<string, string | number | boolean>;
50
+ tags?: string[];
45
51
  attributes?: Record<string, unknown>;
46
52
  prompt_key?: string;
47
53
  prompt_version?: number;
@@ -58,6 +64,18 @@ interface SessionOptions {
58
64
  sessionId: string;
59
65
  /** Optional customer/user identifier for analytics */
60
66
  customerId?: string;
67
+ /**
68
+ * Custom key-value metadata for filtering/grouping traces.
69
+ * Use this for structured data like deployment type, environment, etc.
70
+ * @example { deployment: "dedicated", requestType: "transcript", provider: "novita" }
71
+ */
72
+ metadata?: Record<string, string | number | boolean>;
73
+ /**
74
+ * Simple string tags for quick filtering.
75
+ * Use this for simple labels/categories.
76
+ * @example ["production", "dedicated", "transcript-analysis"]
77
+ */
78
+ tags?: string[];
61
79
  }
62
80
  /**
63
81
  * Options for wrapAISDK.
package/dist/index.d.ts CHANGED
@@ -11,6 +11,10 @@ interface SessionContext {
11
11
  configKey: string;
12
12
  sessionId: string;
13
13
  customerId?: string;
14
+ /** Custom key-value metadata for filtering/grouping */
15
+ metadata?: Record<string, string | number | boolean>;
16
+ /** Simple string tags for quick filtering */
17
+ tags?: string[];
14
18
  }
15
19
  /**
16
20
  * Trace context for linking spans together.
@@ -42,6 +46,8 @@ interface TraceData {
42
46
  error_message?: string;
43
47
  time_to_first_token_ms?: number;
44
48
  is_streaming?: boolean;
49
+ metadata?: Record<string, string | number | boolean>;
50
+ tags?: string[];
45
51
  attributes?: Record<string, unknown>;
46
52
  prompt_key?: string;
47
53
  prompt_version?: number;
@@ -58,6 +64,18 @@ interface SessionOptions {
58
64
  sessionId: string;
59
65
  /** Optional customer/user identifier for analytics */
60
66
  customerId?: string;
67
+ /**
68
+ * Custom key-value metadata for filtering/grouping traces.
69
+ * Use this for structured data like deployment type, environment, etc.
70
+ * @example { deployment: "dedicated", requestType: "transcript", provider: "novita" }
71
+ */
72
+ metadata?: Record<string, string | number | boolean>;
73
+ /**
74
+ * Simple string tags for quick filtering.
75
+ * Use this for simple labels/categories.
76
+ * @example ["production", "dedicated", "transcript-analysis"]
77
+ */
78
+ tags?: string[];
61
79
  }
62
80
  /**
63
81
  * Options for wrapAISDK.
package/dist/index.js CHANGED
@@ -2118,6 +2118,8 @@ function wrapOpenAI(client, sessionCtx) {
2118
2118
  config_key: ctx.configKey,
2119
2119
  session_id: ctx.sessionId,
2120
2120
  customer_id: ctx.customerId,
2121
+ metadata: ctx.metadata,
2122
+ tags: ctx.tags,
2121
2123
  trace_id: traceId,
2122
2124
  span_id: spanId,
2123
2125
  parent_span_id: parentSpanId,
@@ -2143,6 +2145,8 @@ function wrapOpenAI(client, sessionCtx) {
2143
2145
  config_key: ctx.configKey,
2144
2146
  session_id: ctx.sessionId,
2145
2147
  customer_id: ctx.customerId,
2148
+ metadata: ctx.metadata,
2149
+ tags: ctx.tags,
2146
2150
  trace_id: traceId,
2147
2151
  span_id: spanId,
2148
2152
  parent_span_id: parentSpanId,
@@ -2238,6 +2242,8 @@ function wrapAnthropic(client, sessionCtx) {
2238
2242
  config_key: ctx.configKey,
2239
2243
  session_id: ctx.sessionId,
2240
2244
  customer_id: ctx.customerId,
2245
+ metadata: ctx.metadata,
2246
+ tags: ctx.tags,
2241
2247
  trace_id: traceId,
2242
2248
  span_id: spanId,
2243
2249
  parent_span_id: parentSpanId,
@@ -2263,6 +2269,8 @@ function wrapAnthropic(client, sessionCtx) {
2263
2269
  config_key: ctx.configKey,
2264
2270
  session_id: ctx.sessionId,
2265
2271
  customer_id: ctx.customerId,
2272
+ metadata: ctx.metadata,
2273
+ tags: ctx.tags,
2266
2274
  trace_id: traceId,
2267
2275
  span_id: spanId,
2268
2276
  parent_span_id: parentSpanId,
@@ -2353,6 +2361,8 @@ function wrapGoogleAI(model, sessionCtx) {
2353
2361
  config_key: ctx.configKey,
2354
2362
  session_id: ctx.sessionId,
2355
2363
  customer_id: ctx.customerId,
2364
+ metadata: ctx.metadata,
2365
+ tags: ctx.tags,
2356
2366
  trace_id: traceId,
2357
2367
  span_id: spanId,
2358
2368
  parent_span_id: parentSpanId,
@@ -2378,6 +2388,8 @@ function wrapGoogleAI(model, sessionCtx) {
2378
2388
  config_key: ctx.configKey,
2379
2389
  session_id: ctx.sessionId,
2380
2390
  customer_id: ctx.customerId,
2391
+ metadata: ctx.metadata,
2392
+ tags: ctx.tags,
2381
2393
  trace_id: traceId,
2382
2394
  span_id: spanId,
2383
2395
  parent_span_id: parentSpanId,
@@ -2628,6 +2640,8 @@ function createGenerateTextWrapper(aiModule, sessionCtx, debug = false) {
2628
2640
  config_key: ctx.configKey,
2629
2641
  session_id: ctx.sessionId,
2630
2642
  customer_id: ctx.customerId,
2643
+ metadata: ctx.metadata,
2644
+ tags: ctx.tags,
2631
2645
  trace_id: traceId,
2632
2646
  span_id: spanId,
2633
2647
  parent_span_id: parentSpanId,
@@ -2654,6 +2668,8 @@ function createGenerateTextWrapper(aiModule, sessionCtx, debug = false) {
2654
2668
  config_key: ctx.configKey,
2655
2669
  session_id: ctx.sessionId,
2656
2670
  customer_id: ctx.customerId,
2671
+ metadata: ctx.metadata,
2672
+ tags: ctx.tags,
2657
2673
  trace_id: traceId,
2658
2674
  span_id: spanId,
2659
2675
  parent_span_id: parentSpanId,
@@ -2929,6 +2945,8 @@ function createStreamTextWrapper(aiModule, sessionCtx, debug = false) {
2929
2945
  config_key: ctx.configKey,
2930
2946
  session_id: ctx.sessionId,
2931
2947
  customer_id: ctx.customerId,
2948
+ metadata: ctx.metadata,
2949
+ tags: ctx.tags,
2932
2950
  trace_id: traceId,
2933
2951
  span_id: spanId,
2934
2952
  parent_span_id: parentSpanId,
@@ -2957,6 +2975,8 @@ function createStreamTextWrapper(aiModule, sessionCtx, debug = false) {
2957
2975
  config_key: ctx.configKey,
2958
2976
  session_id: ctx.sessionId,
2959
2977
  customer_id: ctx.customerId,
2978
+ metadata: ctx.metadata,
2979
+ tags: ctx.tags,
2960
2980
  trace_id: traceId,
2961
2981
  span_id: spanId,
2962
2982
  parent_span_id: parentSpanId,
@@ -3058,6 +3078,8 @@ function createGenerateObjectWrapper(aiModule, sessionCtx, debug = false) {
3058
3078
  config_key: ctx.configKey,
3059
3079
  session_id: ctx.sessionId,
3060
3080
  customer_id: ctx.customerId,
3081
+ metadata: ctx.metadata,
3082
+ tags: ctx.tags,
3061
3083
  trace_id: traceId,
3062
3084
  span_id: spanId,
3063
3085
  parent_span_id: parentSpanId,
@@ -3084,6 +3106,8 @@ function createGenerateObjectWrapper(aiModule, sessionCtx, debug = false) {
3084
3106
  config_key: ctx.configKey,
3085
3107
  session_id: ctx.sessionId,
3086
3108
  customer_id: ctx.customerId,
3109
+ metadata: ctx.metadata,
3110
+ tags: ctx.tags,
3087
3111
  trace_id: traceId,
3088
3112
  span_id: spanId,
3089
3113
  parent_span_id: parentSpanId,
@@ -3173,6 +3197,8 @@ function createStreamObjectWrapper(aiModule, sessionCtx, debug = false) {
3173
3197
  config_key: ctx.configKey,
3174
3198
  session_id: ctx.sessionId,
3175
3199
  customer_id: ctx.customerId,
3200
+ metadata: ctx.metadata,
3201
+ tags: ctx.tags,
3176
3202
  trace_id: traceId,
3177
3203
  span_id: spanId,
3178
3204
  parent_span_id: parentSpanId,
@@ -3198,6 +3224,8 @@ function createStreamObjectWrapper(aiModule, sessionCtx, debug = false) {
3198
3224
  config_key: ctx.configKey,
3199
3225
  session_id: ctx.sessionId,
3200
3226
  customer_id: ctx.customerId,
3227
+ metadata: ctx.metadata,
3228
+ tags: ctx.tags,
3201
3229
  trace_id: traceId,
3202
3230
  span_id: spanId,
3203
3231
  parent_span_id: parentSpanId,
@@ -3264,6 +3292,8 @@ function wrapMastraAgent(agent, sessionCtx) {
3264
3292
  config_key: ctx.configKey,
3265
3293
  session_id: ctx.sessionId,
3266
3294
  customer_id: ctx.customerId,
3295
+ metadata: ctx.metadata,
3296
+ tags: ctx.tags,
3267
3297
  trace_id: traceId,
3268
3298
  span_id: spanId,
3269
3299
  parent_span_id: parentSpanId,
@@ -3283,6 +3313,8 @@ function wrapMastraAgent(agent, sessionCtx) {
3283
3313
  config_key: ctx.configKey,
3284
3314
  session_id: ctx.sessionId,
3285
3315
  customer_id: ctx.customerId,
3316
+ metadata: ctx.metadata,
3317
+ tags: ctx.tags,
3286
3318
  trace_id: traceId,
3287
3319
  span_id: spanId,
3288
3320
  parent_span_id: parentSpanId,
@@ -3312,7 +3344,9 @@ var FallomSession = class {
3312
3344
  this.ctx = {
3313
3345
  configKey: options.configKey,
3314
3346
  sessionId: options.sessionId,
3315
- customerId: options.customerId
3347
+ customerId: options.customerId,
3348
+ metadata: options.metadata,
3349
+ tags: options.tags
3316
3350
  };
3317
3351
  }
3318
3352
  /** Get the session context. */
@@ -3363,6 +3397,8 @@ var FallomSession = class {
3363
3397
  config_key: ctx.configKey,
3364
3398
  session_id: ctx.sessionId,
3365
3399
  customer_id: ctx.customerId,
3400
+ metadata: ctx.metadata,
3401
+ tags: ctx.tags,
3366
3402
  trace_id: traceId,
3367
3403
  span_id: spanId,
3368
3404
  parent_span_id: traceCtx?.parentSpanId,
@@ -3387,6 +3423,8 @@ var FallomSession = class {
3387
3423
  config_key: ctx.configKey,
3388
3424
  session_id: ctx.sessionId,
3389
3425
  customer_id: ctx.customerId,
3426
+ metadata: ctx.metadata,
3427
+ tags: ctx.tags,
3390
3428
  trace_id: traceId,
3391
3429
  span_id: spanId,
3392
3430
  parent_span_id: traceCtx?.parentSpanId,
@@ -3420,6 +3458,8 @@ var FallomSession = class {
3420
3458
  config_key: ctx.configKey,
3421
3459
  session_id: ctx.sessionId,
3422
3460
  customer_id: ctx.customerId,
3461
+ metadata: ctx.metadata,
3462
+ tags: ctx.tags,
3423
3463
  trace_id: traceId,
3424
3464
  span_id: spanId,
3425
3465
  parent_span_id: traceCtx?.parentSpanId,
@@ -3444,6 +3484,8 @@ var FallomSession = class {
3444
3484
  config_key: ctx.configKey,
3445
3485
  session_id: ctx.sessionId,
3446
3486
  customer_id: ctx.customerId,
3487
+ metadata: ctx.metadata,
3488
+ tags: ctx.tags,
3447
3489
  trace_id: traceId,
3448
3490
  span_id: spanId,
3449
3491
  parent_span_id: traceCtx?.parentSpanId,
package/dist/index.mjs CHANGED
@@ -1123,6 +1123,8 @@ function wrapOpenAI(client, sessionCtx) {
1123
1123
  config_key: ctx.configKey,
1124
1124
  session_id: ctx.sessionId,
1125
1125
  customer_id: ctx.customerId,
1126
+ metadata: ctx.metadata,
1127
+ tags: ctx.tags,
1126
1128
  trace_id: traceId,
1127
1129
  span_id: spanId,
1128
1130
  parent_span_id: parentSpanId,
@@ -1148,6 +1150,8 @@ function wrapOpenAI(client, sessionCtx) {
1148
1150
  config_key: ctx.configKey,
1149
1151
  session_id: ctx.sessionId,
1150
1152
  customer_id: ctx.customerId,
1153
+ metadata: ctx.metadata,
1154
+ tags: ctx.tags,
1151
1155
  trace_id: traceId,
1152
1156
  span_id: spanId,
1153
1157
  parent_span_id: parentSpanId,
@@ -1243,6 +1247,8 @@ function wrapAnthropic(client, sessionCtx) {
1243
1247
  config_key: ctx.configKey,
1244
1248
  session_id: ctx.sessionId,
1245
1249
  customer_id: ctx.customerId,
1250
+ metadata: ctx.metadata,
1251
+ tags: ctx.tags,
1246
1252
  trace_id: traceId,
1247
1253
  span_id: spanId,
1248
1254
  parent_span_id: parentSpanId,
@@ -1268,6 +1274,8 @@ function wrapAnthropic(client, sessionCtx) {
1268
1274
  config_key: ctx.configKey,
1269
1275
  session_id: ctx.sessionId,
1270
1276
  customer_id: ctx.customerId,
1277
+ metadata: ctx.metadata,
1278
+ tags: ctx.tags,
1271
1279
  trace_id: traceId,
1272
1280
  span_id: spanId,
1273
1281
  parent_span_id: parentSpanId,
@@ -1358,6 +1366,8 @@ function wrapGoogleAI(model, sessionCtx) {
1358
1366
  config_key: ctx.configKey,
1359
1367
  session_id: ctx.sessionId,
1360
1368
  customer_id: ctx.customerId,
1369
+ metadata: ctx.metadata,
1370
+ tags: ctx.tags,
1361
1371
  trace_id: traceId,
1362
1372
  span_id: spanId,
1363
1373
  parent_span_id: parentSpanId,
@@ -1383,6 +1393,8 @@ function wrapGoogleAI(model, sessionCtx) {
1383
1393
  config_key: ctx.configKey,
1384
1394
  session_id: ctx.sessionId,
1385
1395
  customer_id: ctx.customerId,
1396
+ metadata: ctx.metadata,
1397
+ tags: ctx.tags,
1386
1398
  trace_id: traceId,
1387
1399
  span_id: spanId,
1388
1400
  parent_span_id: parentSpanId,
@@ -1633,6 +1645,8 @@ function createGenerateTextWrapper(aiModule, sessionCtx, debug = false) {
1633
1645
  config_key: ctx.configKey,
1634
1646
  session_id: ctx.sessionId,
1635
1647
  customer_id: ctx.customerId,
1648
+ metadata: ctx.metadata,
1649
+ tags: ctx.tags,
1636
1650
  trace_id: traceId,
1637
1651
  span_id: spanId,
1638
1652
  parent_span_id: parentSpanId,
@@ -1659,6 +1673,8 @@ function createGenerateTextWrapper(aiModule, sessionCtx, debug = false) {
1659
1673
  config_key: ctx.configKey,
1660
1674
  session_id: ctx.sessionId,
1661
1675
  customer_id: ctx.customerId,
1676
+ metadata: ctx.metadata,
1677
+ tags: ctx.tags,
1662
1678
  trace_id: traceId,
1663
1679
  span_id: spanId,
1664
1680
  parent_span_id: parentSpanId,
@@ -1934,6 +1950,8 @@ function createStreamTextWrapper(aiModule, sessionCtx, debug = false) {
1934
1950
  config_key: ctx.configKey,
1935
1951
  session_id: ctx.sessionId,
1936
1952
  customer_id: ctx.customerId,
1953
+ metadata: ctx.metadata,
1954
+ tags: ctx.tags,
1937
1955
  trace_id: traceId,
1938
1956
  span_id: spanId,
1939
1957
  parent_span_id: parentSpanId,
@@ -1962,6 +1980,8 @@ function createStreamTextWrapper(aiModule, sessionCtx, debug = false) {
1962
1980
  config_key: ctx.configKey,
1963
1981
  session_id: ctx.sessionId,
1964
1982
  customer_id: ctx.customerId,
1983
+ metadata: ctx.metadata,
1984
+ tags: ctx.tags,
1965
1985
  trace_id: traceId,
1966
1986
  span_id: spanId,
1967
1987
  parent_span_id: parentSpanId,
@@ -2063,6 +2083,8 @@ function createGenerateObjectWrapper(aiModule, sessionCtx, debug = false) {
2063
2083
  config_key: ctx.configKey,
2064
2084
  session_id: ctx.sessionId,
2065
2085
  customer_id: ctx.customerId,
2086
+ metadata: ctx.metadata,
2087
+ tags: ctx.tags,
2066
2088
  trace_id: traceId,
2067
2089
  span_id: spanId,
2068
2090
  parent_span_id: parentSpanId,
@@ -2089,6 +2111,8 @@ function createGenerateObjectWrapper(aiModule, sessionCtx, debug = false) {
2089
2111
  config_key: ctx.configKey,
2090
2112
  session_id: ctx.sessionId,
2091
2113
  customer_id: ctx.customerId,
2114
+ metadata: ctx.metadata,
2115
+ tags: ctx.tags,
2092
2116
  trace_id: traceId,
2093
2117
  span_id: spanId,
2094
2118
  parent_span_id: parentSpanId,
@@ -2178,6 +2202,8 @@ function createStreamObjectWrapper(aiModule, sessionCtx, debug = false) {
2178
2202
  config_key: ctx.configKey,
2179
2203
  session_id: ctx.sessionId,
2180
2204
  customer_id: ctx.customerId,
2205
+ metadata: ctx.metadata,
2206
+ tags: ctx.tags,
2181
2207
  trace_id: traceId,
2182
2208
  span_id: spanId,
2183
2209
  parent_span_id: parentSpanId,
@@ -2203,6 +2229,8 @@ function createStreamObjectWrapper(aiModule, sessionCtx, debug = false) {
2203
2229
  config_key: ctx.configKey,
2204
2230
  session_id: ctx.sessionId,
2205
2231
  customer_id: ctx.customerId,
2232
+ metadata: ctx.metadata,
2233
+ tags: ctx.tags,
2206
2234
  trace_id: traceId,
2207
2235
  span_id: spanId,
2208
2236
  parent_span_id: parentSpanId,
@@ -2269,6 +2297,8 @@ function wrapMastraAgent(agent, sessionCtx) {
2269
2297
  config_key: ctx.configKey,
2270
2298
  session_id: ctx.sessionId,
2271
2299
  customer_id: ctx.customerId,
2300
+ metadata: ctx.metadata,
2301
+ tags: ctx.tags,
2272
2302
  trace_id: traceId,
2273
2303
  span_id: spanId,
2274
2304
  parent_span_id: parentSpanId,
@@ -2288,6 +2318,8 @@ function wrapMastraAgent(agent, sessionCtx) {
2288
2318
  config_key: ctx.configKey,
2289
2319
  session_id: ctx.sessionId,
2290
2320
  customer_id: ctx.customerId,
2321
+ metadata: ctx.metadata,
2322
+ tags: ctx.tags,
2291
2323
  trace_id: traceId,
2292
2324
  span_id: spanId,
2293
2325
  parent_span_id: parentSpanId,
@@ -2317,7 +2349,9 @@ var FallomSession = class {
2317
2349
  this.ctx = {
2318
2350
  configKey: options.configKey,
2319
2351
  sessionId: options.sessionId,
2320
- customerId: options.customerId
2352
+ customerId: options.customerId,
2353
+ metadata: options.metadata,
2354
+ tags: options.tags
2321
2355
  };
2322
2356
  }
2323
2357
  /** Get the session context. */
@@ -2368,6 +2402,8 @@ var FallomSession = class {
2368
2402
  config_key: ctx.configKey,
2369
2403
  session_id: ctx.sessionId,
2370
2404
  customer_id: ctx.customerId,
2405
+ metadata: ctx.metadata,
2406
+ tags: ctx.tags,
2371
2407
  trace_id: traceId,
2372
2408
  span_id: spanId,
2373
2409
  parent_span_id: traceCtx?.parentSpanId,
@@ -2392,6 +2428,8 @@ var FallomSession = class {
2392
2428
  config_key: ctx.configKey,
2393
2429
  session_id: ctx.sessionId,
2394
2430
  customer_id: ctx.customerId,
2431
+ metadata: ctx.metadata,
2432
+ tags: ctx.tags,
2395
2433
  trace_id: traceId,
2396
2434
  span_id: spanId,
2397
2435
  parent_span_id: traceCtx?.parentSpanId,
@@ -2425,6 +2463,8 @@ var FallomSession = class {
2425
2463
  config_key: ctx.configKey,
2426
2464
  session_id: ctx.sessionId,
2427
2465
  customer_id: ctx.customerId,
2466
+ metadata: ctx.metadata,
2467
+ tags: ctx.tags,
2428
2468
  trace_id: traceId,
2429
2469
  span_id: spanId,
2430
2470
  parent_span_id: traceCtx?.parentSpanId,
@@ -2449,6 +2489,8 @@ var FallomSession = class {
2449
2489
  config_key: ctx.configKey,
2450
2490
  session_id: ctx.sessionId,
2451
2491
  customer_id: ctx.customerId,
2492
+ metadata: ctx.metadata,
2493
+ tags: ctx.tags,
2452
2494
  trace_id: traceId,
2453
2495
  span_id: spanId,
2454
2496
  parent_span_id: traceCtx?.parentSpanId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fallom/trace",
3
- "version": "0.2.13",
3
+ "version": "0.2.14",
4
4
  "description": "Model A/B testing and tracing for LLM applications. Zero latency, production-ready.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",