@openclaw/diagnostics-otel 2026.6.11-beta.2 → 2026.7.1-beta.1
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.js +47 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -265,6 +265,47 @@ function assignModelCallSizeTimingAttrs(attrs, evt) {
|
|
|
265
265
|
assignPositiveNumberAttr(attrs, "openclaw.model_call.response_bytes", evt.responseStreamBytes);
|
|
266
266
|
assignPositiveNumberAttr(attrs, "openclaw.model_call.time_to_first_byte_ms", evt.timeToFirstByteMs);
|
|
267
267
|
}
|
|
268
|
+
function assignNumberAttr(attrs, key, value) {
|
|
269
|
+
if (typeof value === "number" && Number.isFinite(value)) attrs[key] = value;
|
|
270
|
+
}
|
|
271
|
+
function modelCallPromptTokens(usage) {
|
|
272
|
+
if (typeof usage.promptTokens === "number" && Number.isFinite(usage.promptTokens)) return usage.promptTokens;
|
|
273
|
+
const input = usage.input ?? 0;
|
|
274
|
+
const cacheRead = usage.cacheRead ?? 0;
|
|
275
|
+
const cacheWrite = usage.cacheWrite ?? 0;
|
|
276
|
+
const total = input + cacheRead + cacheWrite;
|
|
277
|
+
return total > 0 ? total : void 0;
|
|
278
|
+
}
|
|
279
|
+
function assignModelCallPromptStatsAttrs(attrs, evt) {
|
|
280
|
+
const stats = evt.promptStats;
|
|
281
|
+
if (!stats) return;
|
|
282
|
+
for (const [key, value] of [
|
|
283
|
+
["openclaw.model_call.prompt.input_messages_count", stats.inputMessagesCount],
|
|
284
|
+
["openclaw.model_call.prompt.input_messages_chars", stats.inputMessagesChars],
|
|
285
|
+
["openclaw.model_call.prompt.system_prompt_chars", stats.systemPromptChars],
|
|
286
|
+
["openclaw.model_call.prompt.tool_definitions_count", stats.toolDefinitionsCount],
|
|
287
|
+
["openclaw.model_call.prompt.tool_definitions_chars", stats.toolDefinitionsChars],
|
|
288
|
+
["openclaw.model_call.prompt.total_chars", stats.totalChars]
|
|
289
|
+
]) assignNumberAttr(attrs, key, value);
|
|
290
|
+
}
|
|
291
|
+
function assignModelCallUsageAttrs(attrs, evt) {
|
|
292
|
+
const usage = evt.usage;
|
|
293
|
+
if (!usage) return;
|
|
294
|
+
const promptTokens = modelCallPromptTokens(usage);
|
|
295
|
+
for (const [key, value] of [
|
|
296
|
+
["openclaw.model_call.usage.input_tokens", usage.input],
|
|
297
|
+
["openclaw.model_call.usage.output_tokens", usage.output],
|
|
298
|
+
["openclaw.model_call.usage.cache_read_input_tokens", usage.cacheRead],
|
|
299
|
+
["openclaw.model_call.usage.cache_creation_input_tokens", usage.cacheWrite],
|
|
300
|
+
["openclaw.model_call.usage.reasoning_output_tokens", usage.reasoningTokens],
|
|
301
|
+
["openclaw.model_call.usage.prompt_tokens", promptTokens],
|
|
302
|
+
["openclaw.model_call.usage.total_tokens", usage.total],
|
|
303
|
+
["gen_ai.usage.input_tokens", promptTokens],
|
|
304
|
+
["gen_ai.usage.output_tokens", usage.output],
|
|
305
|
+
["gen_ai.usage.cache_read.input_tokens", usage.cacheRead],
|
|
306
|
+
["gen_ai.usage.cache_creation.input_tokens", usage.cacheWrite]
|
|
307
|
+
]) assignPositiveNumberAttr(attrs, key, value);
|
|
308
|
+
}
|
|
268
309
|
function assignGenAiSpanIdentityAttrs(attrs, input) {
|
|
269
310
|
if (emitLatestGenAiSemconv()) attrs["gen_ai.provider.name"] = lowCardinalityAttr(input.provider);
|
|
270
311
|
else attrs["gen_ai.system"] = lowCardinalityAttr(input.provider);
|
|
@@ -1928,6 +1969,7 @@ function createDiagnosticsOtelService() {
|
|
|
1928
1969
|
assignGenAiModelCallAttrs(spanAttrs, evt);
|
|
1929
1970
|
if (evt.api) spanAttrs["openclaw.api"] = evt.api;
|
|
1930
1971
|
if (evt.transport) spanAttrs["openclaw.transport"] = evt.transport;
|
|
1972
|
+
assignModelCallPromptStatsAttrs(spanAttrs, evt);
|
|
1931
1973
|
trackTrustedSpan(evt, metadata, spanWithDuration(modelCallSpanName(evt), spanAttrs, void 0, {
|
|
1932
1974
|
kind: modelCallSpanKind(),
|
|
1933
1975
|
parentContext: activeTrustedParentContext(evt, metadata),
|
|
@@ -1948,6 +1990,8 @@ function createDiagnosticsOtelService() {
|
|
|
1948
1990
|
if (evt.api) spanAttrs["openclaw.api"] = evt.api;
|
|
1949
1991
|
if (evt.transport) spanAttrs["openclaw.transport"] = evt.transport;
|
|
1950
1992
|
assignModelCallSizeTimingAttrs(spanAttrs, evt);
|
|
1993
|
+
assignModelCallPromptStatsAttrs(spanAttrs, evt);
|
|
1994
|
+
assignModelCallUsageAttrs(spanAttrs, evt);
|
|
1951
1995
|
assignOtelModelContentAttributes(spanAttrs, modelContent, contentCapturePolicy);
|
|
1952
1996
|
const span = takeTrackedTrustedSpan(evt, metadata) ?? spanWithDuration(modelCallSpanName(evt), spanAttrs, evt.durationMs, {
|
|
1953
1997
|
kind: modelCallSpanKind(),
|
|
@@ -1980,6 +2024,8 @@ function createDiagnosticsOtelService() {
|
|
|
1980
2024
|
if (evt.api) spanAttrs["openclaw.api"] = evt.api;
|
|
1981
2025
|
if (evt.transport) spanAttrs["openclaw.transport"] = evt.transport;
|
|
1982
2026
|
assignModelCallSizeTimingAttrs(spanAttrs, evt);
|
|
2027
|
+
assignModelCallPromptStatsAttrs(spanAttrs, evt);
|
|
2028
|
+
assignModelCallUsageAttrs(spanAttrs, evt);
|
|
1983
2029
|
assignOtelModelContentAttributes(spanAttrs, modelContent, contentCapturePolicy);
|
|
1984
2030
|
const span = takeTrackedTrustedSpan(evt, metadata) ?? spanWithDuration(modelCallSpanName(evt), spanAttrs, evt.durationMs, {
|
|
1985
2031
|
kind: modelCallSpanKind(),
|
|
@@ -2305,6 +2351,7 @@ function createDiagnosticsOtelService() {
|
|
|
2305
2351
|
case "exec.process.completed":
|
|
2306
2352
|
recordExecProcessCompleted(evt);
|
|
2307
2353
|
return;
|
|
2354
|
+
case "exec.approval.followup_suppressed": return;
|
|
2308
2355
|
case "log.record":
|
|
2309
2356
|
recordLogRecord?.(evt, metadata);
|
|
2310
2357
|
return;
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/diagnostics-otel",
|
|
3
|
-
"version": "2026.
|
|
3
|
+
"version": "2026.7.1-beta.1",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@openclaw/diagnostics-otel",
|
|
9
|
-
"version": "2026.
|
|
9
|
+
"version": "2026.7.1-beta.1",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@opentelemetry/api": "1.9.1",
|
|
12
12
|
"@opentelemetry/api-logs": "0.219.0",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/diagnostics-otel",
|
|
3
|
-
"version": "2026.
|
|
3
|
+
"version": "2026.7.1-beta.1",
|
|
4
4
|
"description": "OpenClaw diagnostics OpenTelemetry exporter for metrics, traces, and logs.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
"minHostVersion": ">=2026.4.25"
|
|
32
32
|
},
|
|
33
33
|
"compat": {
|
|
34
|
-
"pluginApi": ">=2026.
|
|
34
|
+
"pluginApi": ">=2026.7.1-beta.1"
|
|
35
35
|
},
|
|
36
36
|
"build": {
|
|
37
|
-
"openclawVersion": "2026.
|
|
37
|
+
"openclawVersion": "2026.7.1-beta.1"
|
|
38
38
|
},
|
|
39
39
|
"release": {
|
|
40
40
|
"publishToClawHub": true,
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"README.md"
|
|
52
52
|
],
|
|
53
53
|
"peerDependencies": {
|
|
54
|
-
"openclaw": ">=2026.
|
|
54
|
+
"openclaw": ">=2026.7.1-beta.1"
|
|
55
55
|
},
|
|
56
56
|
"peerDependenciesMeta": {
|
|
57
57
|
"openclaw": {
|