@runtypelabs/flue-otel 0.2.1 → 0.2.2
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/README.md +6 -6
- package/dist/index.cjs +15 -3
- package/dist/index.d.cts +9 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.mjs +15 -3
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -175,12 +175,12 @@ backends.
|
|
|
175
175
|
|
|
176
176
|
## What it emits
|
|
177
177
|
|
|
178
|
-
| Span | When | Carries
|
|
179
|
-
| -------------------------------------------------------------- | --------------------------------------- |
|
|
180
|
-
| `invoke_agent <agent>` | once per agent invocation | `gen_ai.agent.name`, `gen_ai.conversation.id`, the run's request/response model, summed token usage across every turn (`gen_ai.usage.*`), `runtype.stop_reason`, `runtype.tools.reported`, the highest loop iteration (`runtype.iteration`), `runtype.execution.id`, and `runtype.agent.id` when `agents` names the agent
|
|
181
|
-
| `chat <model>` | once per model turn | `gen_ai.provider.name`, request/response model, response id, finish reason, per-turn usage, request parameters (`max_tokens`, `temperature`, reasoning level, server address),
|
|
182
|
-
| `execute_tool <tool>` | once per model-requested tool call | `gen_ai.tool.name`, `gen_ai.tool.call.id`, the loop position it belongs to, `gen_ai.tool.type` (`function`) for every tool except a sub-agent delegation, and `runtype.tool.type` when the tool's class is known
|
|
183
|
-
| `flue.task <agent>`, `flue.compaction`, `flue.operation shell` | delegation, compaction, host shell call | correlation ids only; framework structure, not agent invocations
|
|
178
|
+
| Span | When | Carries |
|
|
179
|
+
| -------------------------------------------------------------- | --------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
180
|
+
| `invoke_agent <agent>` | once per agent invocation | `gen_ai.agent.name`, `gen_ai.conversation.id`, the run's request/response model, summed token usage across every turn (`gen_ai.usage.*`), `runtype.stop_reason`, `runtype.tools.reported`, the highest loop iteration (`runtype.iteration`), `runtype.execution.id`, and `runtype.agent.id` when `agents` names the agent |
|
|
181
|
+
| `chat <model>` | once per model turn | `gen_ai.provider.name`, request/response model, response id, finish reason, per-turn usage, request parameters (`max_tokens`, `temperature`, reasoning level, server address), `runtype.turn.id` / `runtype.turn.index` / `runtype.iteration`, and `runtype.provider.finish_reason` / `runtype.gateway.log_id` when the provider records them (Workers AI attaches both — the gateway log id is a pointer to that exact request in your AI Gateway dashboard) |
|
|
182
|
+
| `execute_tool <tool>` | once per model-requested tool call | `gen_ai.tool.name`, `gen_ai.tool.call.id`, the loop position it belongs to, `gen_ai.tool.type` (`function`) for every tool except a sub-agent delegation, and `runtype.tool.type` when the tool's class is known |
|
|
183
|
+
| `flue.task <agent>`, `flue.compaction`, `flue.operation shell` | delegation, compaction, host shell call | correlation ids only; framework structure, not agent invocations |
|
|
184
184
|
|
|
185
185
|
Every span also carries Flue's own `flue.*` correlation attributes
|
|
186
186
|
(`flue.instance.id`, `flue.submission.id`, `flue.agent.name`,
|
package/dist/index.cjs
CHANGED
|
@@ -76,7 +76,7 @@ function mapSettlementOutcome(outcome) {
|
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
// package.json
|
|
79
|
-
var version = "0.2.
|
|
79
|
+
var version = "0.2.2";
|
|
80
80
|
|
|
81
81
|
// src/semconv.ts
|
|
82
82
|
var GEN_AI = {
|
|
@@ -118,7 +118,9 @@ var RUNTYPE = {
|
|
|
118
118
|
toolsReported: "runtype.tools.reported",
|
|
119
119
|
toolType: "runtype.tool.type",
|
|
120
120
|
turnId: "runtype.turn.id",
|
|
121
|
-
turnIndex: "runtype.turn.index"
|
|
121
|
+
turnIndex: "runtype.turn.index",
|
|
122
|
+
providerFinishReason: "runtype.provider.finish_reason",
|
|
123
|
+
gatewayLogId: "runtype.gateway.log_id"
|
|
122
124
|
};
|
|
123
125
|
var FLUE = {
|
|
124
126
|
instanceId: "flue.instance.id",
|
|
@@ -459,7 +461,17 @@ function createFlueProjection(options = {}) {
|
|
|
459
461
|
...response.responseModel ? { [GEN_AI.responseModel]: response.responseModel } : {},
|
|
460
462
|
...response.responseId ? { [GEN_AI.responseId]: response.responseId } : {},
|
|
461
463
|
...response.finishReason ? { [GEN_AI.finishReasons]: [response.finishReason] } : {},
|
|
462
|
-
...usageAttributes(response.usage)
|
|
464
|
+
...usageAttributes(response.usage),
|
|
465
|
+
// Provider-diagnostic pointers, emitted only when Flue actually provides
|
|
466
|
+
// them. Both are optional and provider-dependent (Workers AI attaches
|
|
467
|
+
// both today); an absent value costs one column, a synthesized one would
|
|
468
|
+
// render as a measurement. `gatewayLogId` is a pointer to the content
|
|
469
|
+
// without shipping the content — a customer can click through to that
|
|
470
|
+
// exact request in their own AI Gateway dashboard. `providerFinishReason`
|
|
471
|
+
// is the provider's exact finish value before normalization, which our
|
|
472
|
+
// `GEN_AI.finishReasons` above deliberately hides.
|
|
473
|
+
...response.providerFinishReason ? { [RUNTYPE.providerFinishReason]: response.providerFinishReason } : {},
|
|
474
|
+
...response.gatewayLogId ? { [RUNTYPE.gatewayLogId]: response.gatewayLogId } : {}
|
|
463
475
|
};
|
|
464
476
|
const intents = [];
|
|
465
477
|
if (Object.keys(attributes).length > 0) intents.push({ kind: "update", ref, attributes });
|
package/dist/index.d.cts
CHANGED
|
@@ -100,6 +100,13 @@ interface FlueModelResponse {
|
|
|
100
100
|
finishReason?: string;
|
|
101
101
|
/** 2.x only. The provider's raw finish value before normalization. */
|
|
102
102
|
providerFinishReason?: string;
|
|
103
|
+
/**
|
|
104
|
+
* The response's own gateway log id (e.g. Cloudflare AI Gateway's
|
|
105
|
+
* `cf-aig-log-id`), for correlating a specific turn with its entry in the
|
|
106
|
+
* gateway dashboard. Telemetry only — present only when the provider records
|
|
107
|
+
* one. The Workers AI provider attaches it today.
|
|
108
|
+
*/
|
|
109
|
+
gatewayLogId?: string;
|
|
103
110
|
error?: FlueErrorInfo;
|
|
104
111
|
}
|
|
105
112
|
/**
|
|
@@ -475,6 +482,8 @@ declare const RUNTYPE: {
|
|
|
475
482
|
readonly toolType: "runtype.tool.type";
|
|
476
483
|
readonly turnId: "runtype.turn.id";
|
|
477
484
|
readonly turnIndex: "runtype.turn.index";
|
|
485
|
+
readonly providerFinishReason: "runtype.provider.finish_reason";
|
|
486
|
+
readonly gatewayLogId: "runtype.gateway.log_id";
|
|
478
487
|
};
|
|
479
488
|
/**
|
|
480
489
|
* `runtype.tool.type` values — the closed domain that drives display and
|
package/dist/index.d.ts
CHANGED
|
@@ -100,6 +100,13 @@ interface FlueModelResponse {
|
|
|
100
100
|
finishReason?: string;
|
|
101
101
|
/** 2.x only. The provider's raw finish value before normalization. */
|
|
102
102
|
providerFinishReason?: string;
|
|
103
|
+
/**
|
|
104
|
+
* The response's own gateway log id (e.g. Cloudflare AI Gateway's
|
|
105
|
+
* `cf-aig-log-id`), for correlating a specific turn with its entry in the
|
|
106
|
+
* gateway dashboard. Telemetry only — present only when the provider records
|
|
107
|
+
* one. The Workers AI provider attaches it today.
|
|
108
|
+
*/
|
|
109
|
+
gatewayLogId?: string;
|
|
103
110
|
error?: FlueErrorInfo;
|
|
104
111
|
}
|
|
105
112
|
/**
|
|
@@ -475,6 +482,8 @@ declare const RUNTYPE: {
|
|
|
475
482
|
readonly toolType: "runtype.tool.type";
|
|
476
483
|
readonly turnId: "runtype.turn.id";
|
|
477
484
|
readonly turnIndex: "runtype.turn.index";
|
|
485
|
+
readonly providerFinishReason: "runtype.provider.finish_reason";
|
|
486
|
+
readonly gatewayLogId: "runtype.gateway.log_id";
|
|
478
487
|
};
|
|
479
488
|
/**
|
|
480
489
|
* `runtype.tool.type` values — the closed domain that drives display and
|
package/dist/index.mjs
CHANGED
|
@@ -43,7 +43,7 @@ function mapSettlementOutcome(outcome) {
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
// package.json
|
|
46
|
-
var version = "0.2.
|
|
46
|
+
var version = "0.2.2";
|
|
47
47
|
|
|
48
48
|
// src/semconv.ts
|
|
49
49
|
var GEN_AI = {
|
|
@@ -85,7 +85,9 @@ var RUNTYPE = {
|
|
|
85
85
|
toolsReported: "runtype.tools.reported",
|
|
86
86
|
toolType: "runtype.tool.type",
|
|
87
87
|
turnId: "runtype.turn.id",
|
|
88
|
-
turnIndex: "runtype.turn.index"
|
|
88
|
+
turnIndex: "runtype.turn.index",
|
|
89
|
+
providerFinishReason: "runtype.provider.finish_reason",
|
|
90
|
+
gatewayLogId: "runtype.gateway.log_id"
|
|
89
91
|
};
|
|
90
92
|
var FLUE = {
|
|
91
93
|
instanceId: "flue.instance.id",
|
|
@@ -426,7 +428,17 @@ function createFlueProjection(options = {}) {
|
|
|
426
428
|
...response.responseModel ? { [GEN_AI.responseModel]: response.responseModel } : {},
|
|
427
429
|
...response.responseId ? { [GEN_AI.responseId]: response.responseId } : {},
|
|
428
430
|
...response.finishReason ? { [GEN_AI.finishReasons]: [response.finishReason] } : {},
|
|
429
|
-
...usageAttributes(response.usage)
|
|
431
|
+
...usageAttributes(response.usage),
|
|
432
|
+
// Provider-diagnostic pointers, emitted only when Flue actually provides
|
|
433
|
+
// them. Both are optional and provider-dependent (Workers AI attaches
|
|
434
|
+
// both today); an absent value costs one column, a synthesized one would
|
|
435
|
+
// render as a measurement. `gatewayLogId` is a pointer to the content
|
|
436
|
+
// without shipping the content — a customer can click through to that
|
|
437
|
+
// exact request in their own AI Gateway dashboard. `providerFinishReason`
|
|
438
|
+
// is the provider's exact finish value before normalization, which our
|
|
439
|
+
// `GEN_AI.finishReasons` above deliberately hides.
|
|
440
|
+
...response.providerFinishReason ? { [RUNTYPE.providerFinishReason]: response.providerFinishReason } : {},
|
|
441
|
+
...response.gatewayLogId ? { [RUNTYPE.gatewayLogId]: response.gatewayLogId } : {}
|
|
430
442
|
};
|
|
431
443
|
const intents = [];
|
|
432
444
|
if (Object.keys(attributes).length > 0) intents.push({ kind: "update", ref, attributes });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@runtypelabs/flue-otel",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "OpenTelemetry instrumentation for Flue agents that emits GenAI semconv spans plus Runtype's runtype.* extension vocabulary, so a Flue run lands in Runtype at full fidelity.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"tsup": "^8.0.2",
|
|
35
35
|
"typescript": "^6.0.3",
|
|
36
36
|
"vitest": "^4.1.0",
|
|
37
|
-
"@runtypelabs/shared": "3.
|
|
37
|
+
"@runtypelabs/shared": "3.28.0"
|
|
38
38
|
},
|
|
39
39
|
"publishConfig": {
|
|
40
40
|
"access": "public"
|