@openclaw/diagnostics-otel 2026.7.2-beta.1 → 2026.7.2-beta.3
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
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as createDiagnosticsOtelService } from "./runtime-api-
|
|
1
|
+
import { t as createDiagnosticsOtelService } from "./runtime-api-DIKLPu2g.js";
|
|
2
2
|
import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
|
|
3
3
|
//#region extensions/diagnostics-otel/index.ts
|
|
4
4
|
var diagnostics_otel_default = definePluginEntry({
|
|
@@ -15,7 +15,7 @@ import nodePath from "node:path";
|
|
|
15
15
|
import { createNodeProxyAgent } from "openclaw/plugin-sdk/fetch-runtime";
|
|
16
16
|
import { OTLPLogExporter } from "@opentelemetry/exporter-logs-otlp-proto";
|
|
17
17
|
import { BatchLogRecordProcessor, LoggerProvider } from "@opentelemetry/sdk-logs";
|
|
18
|
-
import { ATTR_GEN_AI_INPUT_MESSAGES, ATTR_GEN_AI_OUTPUT_MESSAGES, ATTR_GEN_AI_SYSTEM_INSTRUCTIONS, ATTR_GEN_AI_TOOL_CALL_ARGUMENTS, ATTR_GEN_AI_TOOL_CALL_ID, ATTR_GEN_AI_TOOL_CALL_RESULT, ATTR_GEN_AI_TOOL_DEFINITIONS, GEN_AI_OPERATION_NAME_VALUE_EXECUTE_TOOL } from "@opentelemetry/semantic-conventions/incubating";
|
|
18
|
+
import { ATTR_GEN_AI_INPUT_MESSAGES, ATTR_GEN_AI_OUTPUT_MESSAGES, ATTR_GEN_AI_SYSTEM_INSTRUCTIONS, ATTR_GEN_AI_TOOL_CALL_ARGUMENTS, ATTR_GEN_AI_TOOL_CALL_ID, ATTR_GEN_AI_TOOL_CALL_RESULT, ATTR_GEN_AI_TOOL_DEFINITIONS, GEN_AI_OPERATION_NAME_VALUE_EXECUTE_TOOL, GEN_AI_OPERATION_NAME_VALUE_INVOKE_AGENT } from "@opentelemetry/semantic-conventions/incubating";
|
|
19
19
|
import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
20
20
|
const DROPPED_OTEL_ATTRIBUTE_KEYS = /* @__PURE__ */ new Set([
|
|
21
21
|
"openclaw.callId",
|
|
@@ -662,6 +662,7 @@ function createDiagnosticsEventHandler(params) {
|
|
|
662
662
|
recordRunAttempt(evt);
|
|
663
663
|
break;
|
|
664
664
|
case "run.progress": break;
|
|
665
|
+
case "run.execution_phase": break;
|
|
665
666
|
case "diagnostic.heartbeat":
|
|
666
667
|
recordHeartbeat(evt);
|
|
667
668
|
return;
|
|
@@ -1309,7 +1310,8 @@ function hasOtelSemconvOptIn(value, optIn) {
|
|
|
1309
1310
|
function emitLatestGenAiSemconv() {
|
|
1310
1311
|
return hasOtelSemconvOptIn(process.env[OTEL_SEMCONV_STABILITY_OPT_IN_ENV], GEN_AI_LATEST_EXPERIMENTAL_OPT_IN);
|
|
1311
1312
|
}
|
|
1312
|
-
function genAiOperationName(api) {
|
|
1313
|
+
function genAiOperationName(api, observationUnit) {
|
|
1314
|
+
if (observationUnit === "turn") return GEN_AI_OPERATION_NAME_VALUE_INVOKE_AGENT;
|
|
1313
1315
|
const normalized = api?.trim().toLowerCase();
|
|
1314
1316
|
if (!normalized) return "chat";
|
|
1315
1317
|
if (normalized === "completions" || normalized.endsWith("-completions")) return "text_completion";
|
|
@@ -1373,14 +1375,19 @@ function assignGenAiSpanIdentityAttrs(attrs, input) {
|
|
|
1373
1375
|
if (emitLatestGenAiSemconv()) attrs["gen_ai.provider.name"] = lowCardinalityAttr(input.provider);
|
|
1374
1376
|
else attrs["gen_ai.system"] = lowCardinalityAttr(input.provider);
|
|
1375
1377
|
if (input.model) attrs["gen_ai.request.model"] = redactSensitiveText(input.model.trim());
|
|
1376
|
-
attrs["gen_ai.operation.name"] = genAiOperationName(input.api);
|
|
1378
|
+
attrs["gen_ai.operation.name"] = genAiOperationName(input.api, input.observationUnit);
|
|
1377
1379
|
}
|
|
1378
1380
|
function assignGenAiModelCallAttrs(attrs, evt) {
|
|
1379
1381
|
assignGenAiSpanIdentityAttrs(attrs, evt);
|
|
1382
|
+
attrs["openclaw.model_call.observation_unit"] = modelCallObservationUnit(evt);
|
|
1383
|
+
}
|
|
1384
|
+
function modelCallObservationUnit(evt) {
|
|
1385
|
+
return evt.observationUnit ?? "request";
|
|
1380
1386
|
}
|
|
1381
1387
|
function modelCallSpanName(evt) {
|
|
1382
1388
|
if (!emitLatestGenAiSemconv()) return "openclaw.model.call";
|
|
1383
|
-
|
|
1389
|
+
const operationName = genAiOperationName(evt.api, evt.observationUnit);
|
|
1390
|
+
return operationName === GEN_AI_OPERATION_NAME_VALUE_INVOKE_AGENT ? operationName : `${operationName} ${lowCardinalityAttr(evt.model)}`;
|
|
1384
1391
|
}
|
|
1385
1392
|
function modelCallSpanKind() {
|
|
1386
1393
|
return emitLatestGenAiSemconv() ? SpanKind.CLIENT : void 0;
|
|
@@ -1591,14 +1598,18 @@ function createModelRecorders(runtime) {
|
|
|
1591
1598
|
"openclaw.provider": evt.provider,
|
|
1592
1599
|
"openclaw.model": evt.model,
|
|
1593
1600
|
"openclaw.api": lowCardinalityAttr(evt.api),
|
|
1594
|
-
"openclaw.transport": lowCardinalityAttr(evt.transport)
|
|
1601
|
+
"openclaw.transport": lowCardinalityAttr(evt.transport),
|
|
1602
|
+
"openclaw.model_call.observation_unit": modelCallObservationUnit(evt)
|
|
1595
1603
|
});
|
|
1596
1604
|
const genAiModelCallMetricAttrs = (evt, errorType) => ({
|
|
1597
|
-
"gen_ai.operation.name": genAiOperationName(evt.api),
|
|
1605
|
+
"gen_ai.operation.name": genAiOperationName(evt.api, evt.observationUnit),
|
|
1598
1606
|
"gen_ai.provider.name": lowCardinalityAttr(evt.provider),
|
|
1599
1607
|
"gen_ai.request.model": lowCardinalityAttr(evt.model),
|
|
1600
1608
|
...errorType ? { "error.type": errorType } : {}
|
|
1601
1609
|
});
|
|
1610
|
+
const recordGenAiModelCallDuration = (evt, errorType) => {
|
|
1611
|
+
genAiOperationDurationHistogram.record(evt.durationMs / 1e3, genAiModelCallMetricAttrs(evt, errorType));
|
|
1612
|
+
};
|
|
1602
1613
|
const recordModelCallSizeTimingMetrics = (evt, attrs) => {
|
|
1603
1614
|
const requestPayloadBytes = positiveFiniteNumber(evt.requestPayloadBytes);
|
|
1604
1615
|
if (requestPayloadBytes !== void 0) modelCallRequestBytesHistogram.record(requestPayloadBytes, attrs);
|
|
@@ -1627,7 +1638,7 @@ function createModelRecorders(runtime) {
|
|
|
1627
1638
|
const metricAttrs = modelCallMetricAttrs(evt);
|
|
1628
1639
|
modelCallDurationHistogram.record(evt.durationMs, metricAttrs);
|
|
1629
1640
|
recordModelCallSizeTimingMetrics(evt, metricAttrs);
|
|
1630
|
-
|
|
1641
|
+
recordGenAiModelCallDuration(evt);
|
|
1631
1642
|
if (!tracesEnabled) return;
|
|
1632
1643
|
const spanAttrs = {
|
|
1633
1644
|
"openclaw.provider": evt.provider,
|
|
@@ -1658,7 +1669,7 @@ function createModelRecorders(runtime) {
|
|
|
1658
1669
|
};
|
|
1659
1670
|
modelCallDurationHistogram.record(evt.durationMs, metricAttrs);
|
|
1660
1671
|
recordModelCallSizeTimingMetrics(evt, metricAttrs);
|
|
1661
|
-
|
|
1672
|
+
recordGenAiModelCallDuration(evt, errorType);
|
|
1662
1673
|
if (!tracesEnabled) return;
|
|
1663
1674
|
const spanAttrs = {
|
|
1664
1675
|
"openclaw.provider": evt.provider,
|
package/dist/runtime-api.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as createDiagnosticsOtelService } from "./runtime-api-
|
|
1
|
+
import { t as createDiagnosticsOtelService } from "./runtime-api-DIKLPu2g.js";
|
|
2
2
|
export { createDiagnosticsOtelService };
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/diagnostics-otel",
|
|
3
|
-
"version": "2026.7.2-beta.
|
|
3
|
+
"version": "2026.7.2-beta.3",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@openclaw/diagnostics-otel",
|
|
9
|
-
"version": "2026.7.2-beta.
|
|
9
|
+
"version": "2026.7.2-beta.3",
|
|
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.7.2-beta.
|
|
3
|
+
"version": "2026.7.2-beta.3",
|
|
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.7.2-beta.
|
|
34
|
+
"pluginApi": ">=2026.7.2-beta.3"
|
|
35
35
|
},
|
|
36
36
|
"build": {
|
|
37
|
-
"openclawVersion": "2026.7.2-beta.
|
|
37
|
+
"openclawVersion": "2026.7.2-beta.3"
|
|
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.7.2-beta.
|
|
54
|
+
"openclaw": ">=2026.7.2-beta.3"
|
|
55
55
|
},
|
|
56
56
|
"peerDependenciesMeta": {
|
|
57
57
|
"openclaw": {
|