本页内容
Sommatic 文档
打开控制台

Vectry Log

向 Vectry Operational Intelligence Platform 发出一个结构化因果事件。

以 Markdown 查看
在以下应用中打开
运维 实验性 vectry.log 版本 1.0.0 执行方式: fire-and-forget

设计用途是向 Vectry 摄取 API(POST <endpoint>/v1/ingest)发送一个事件。在当前运行时中,它会在发出请求前以 logger.debug is not a function 从 error 输出,因此不会发送任何事件。

Vectry 利用这些事件构建系统的因果图(Causal Graph),从而支持高级 XAI(可解释 AI)、异常检测和根因分析。与普通日志不同,Vectry 事件通过实体和操作相互关联,以建模因果关系。

核心概念:

  • Entity: 名词(例如“Order”“User”)。
  • Operation: 动词(例如“Created”“Updated”)。
  • Context: 有助于解释该事件的载荷数据。

适用场景:

  • 上报重要业务里程碑(例如“LoanApproved”)。
  • 记录 AI 内部推理步骤(SpikingBrain 集成)。
  • 跟踪分布式系统之间的交互。

工作原理

  1. 将输入项与解析后的配置合并(配置优先)。
  2. 没有可用的 API 密钥时以 Missing 'api_key' for Vectry 从 error 输出;operation 为空时以 Missing 'operation' 输出。
  3. 构建事件名 <system_domain>.<system_entity>.<operation>(两者默认均为 default)以及请求体 { dataset, event, level, timestamp, data, tags, source: "sommatic-orchestrator" },其中 data 为 payload 加上 entity_id 和 operation。
  4. 调用 logger.debug() 时抛错;worker 捕获后从 error 输出。下面的步骤目前不会执行。
  5. 携带 Authorization: Bearer <api_key> 发送请求体,并返回 { port: "success", success: true }。

在工作流中

节点在工作流文件(draft_nodes[])中的写法,以及一次成功运行的 envelope。

{
  "node_id": "node-log-order-shipped",
  "label": "Log order shipped",
  "operator_slug": "vectry.log",
  "operator_version": "1.0.0",
  "config": {
    "api_key": "<vectry_api_key>",
    "endpoint": "https://api.example.com",
    "system_domain": "sales",
    "system_entity": "order",
    "operation": "shipped",
    "system_entity_id": "{{ $json.order_id }}",
    "severity": "info"
  }
}

配置

api_key string 必填
endpoint string 可选

默认值: https://api.vectry.io

system_domain string 可选
system_entity string 可选

配置中会显示通用执行设置,但该节点目前不执行重试(retryOnFail、maxTries)。所有节点均未实现 continueOnFail。

代码中的行为

除 schema 描述之外,实现代码对这些键的实际处理。

api_key
字面量密钥:该节点没有 connection_id,因此密钥会保存在流程、版本历史和 Git 中。
endpoint
基础 URL,会在其后追加 /v1/ingest。
operation
不在配置 schema 中(仅出现在输入契约中),但会从节点配置读取;节点上未设置时从输入项读取:operation、system_entity_id、severity(默认 info)、tags(默认 [])和 payload。
payload
使用配置的 payload;未配置时使用节点输入项。其键会展开到 data 中。

输出端口

success 默认

在当前运行时中不会到达:logger.debug() 调用会先失败。此处展示代码构建的数据结构。

数据
{
  "port": "success",
  "success": true
}
error

目前每次运行都会如此。输出为整个返回对象 { port, success, error }。

数据
{
  "port": "error",
  "success": false,
  "error": "logger.debug is not a function"
}

在表达式中

后续节点可通过 $("Vectry Log").item.json.<路径> 读取此节点输出中的内容(请把 Vectry Log 换成你的节点标签)。Editor 标记工作流编辑器在 Previous Nodes 中提示的路径(输出契约);Worker 标记 worker 实际通过 success 返回的路径,依据“端口”一节所示的输出。

表达式EditorWorker
$("Vectry Log").item.json.successboolean= true
$("Vectry Log").item.json.portstring编辑器不提示= "success"—

— Worker: worker 会返回它,但编辑器不会提示:请手动输入。对象内部的键可能取决于你的数据或配置(例如每个标签一个键)。

错误

消息 端口 原因与处理
logger.debug is not a function error Worker 调用了运行时 logger 不提供的 logger.debug()。每次运行都会发生,任何配置都无法避免。
Missing 'api_key' for Vectry error 调用没有可用的 API 密钥。请设置 api_key。
Missing 'operation' error 节点和输入项中都没有设置 operation。
Request failed with status code <status> error 目前不会到达。它表示 Vectry 拒绝了该事件(例如密钥或端点错误)。

输入契约

operation string 必填

事件名称

system_entity_id string 可选

唯一实体 ID

severity string 可选

可选值: infowarnerrordebug

payload object 可选

事件上下文

tags array<string> 可选

输出契约

success boolean 可选

契约(JSON Schema)

与编排器声明完全一致的定义。All 是完整的 *.definition.js;可与上方各节对照,找出文档与 schema 之间的差异。发布前可用它校验节点。

{
  "slug": "vectry.log",
  "name": "Vectry Log",
  "category": "ops",
  "version": "1.0.0",
  "description": "Emits a structured causal event to the Vectry Operational Intelligence Platform.\n\n  Vectry uses these events to construct a Causal Graph of your system, enabling advanced XAI (Explainable AI), anomaly detection, and root cause analysis. Unlike standard logs, Vectry events are linked by entities and operations to model *cause and effect*.\n\n  **Key Concepts:**\n  - **Entity:** The noun (e.g., \"Order\", \"User\").\n  - **Operation:** The verb (e.g., \"Created\", \"Updated\").\n  - **Context:** Payload data that helps explain the event.\n\n  **Use Cases:**\n  - Reporting significant business milestones (e.g., \"LoanApproved\").\n  - Logging internal AI reasoning steps (SpikingBrain integration).\n  - Tracking distributed system interactions.",
  "capabilities": [
    "observability",
    "causal-ai",
    "vectry",
    "xai"
  ],
  "config_schema": {
    "type": "object",
    "required": [
      "api_key"
    ],
    "properties": {
      "api_key": {
        "type": "string",
        "title": "Vectry API Key",
        "format": "password"
      },
      "endpoint": {
        "type": "string",
        "default": "https://api.vectry.io",
        "title": "API Endpoint"
      },
      "system_domain": {
        "type": "string",
        "title": "Domain (e.g. Sales)"
      },
      "system_entity": {
        "type": "string",
        "title": "Entity Type (e.g. Order)"
      },
      "execution": {
        "type": "object",
        "title": "Execution Settings",
        "properties": {
          "alwaysOutputData": {
            "type": "boolean",
            "title": "Always Output Data",
            "description": "Always output data, even on error (if configured).",
            "default": false
          },
          "retryOnFail": {
            "type": "boolean",
            "title": "Retry On Fail",
            "description": "Retry the execution if it fails.",
            "default": false
          },
          "maxTries": {
            "type": "integer",
            "title": "Max Retries",
            "description": "Number of retries.",
            "default": 3,
            "displayOptions": {
              "show": {
                "retryOnFail": [
                  true
                ]
              }
            }
          },
          "waitBetweenTries": {
            "type": "integer",
            "title": "Wait Between Retries (ms)",
            "default": 1000,
            "displayOptions": {
              "show": {
                "retryOnFail": [
                  true
                ]
              }
            }
          },
          "continueOnFail": {
            "type": "boolean",
            "title": "Continue On Fail",
            "description": "Do not crash workflow on error.",
            "default": false
          },
          "timeout_ms": {
            "type": "integer",
            "title": "Timeout (ms)",
            "description": "Max execution time for this node before it is killed, in milliseconds. Honored by long-running operators (e.g. OCR/extraction, inline code). Default 300000 (5 min).",
            "default": 300000
          }
        }
      }
    }
  },
  "input_contract_schema": {
    "type": "object",
    "properties": {
      "operation": {
        "type": "string",
        "description": "Event Name"
      },
      "system_entity_id": {
        "type": "string",
        "description": "Unique Entity ID"
      },
      "severity": {
        "type": "string",
        "enum": [
          "info",
          "warn",
          "error",
          "debug"
        ]
      },
      "payload": {
        "type": "object",
        "description": "Event Context"
      },
      "tags": {
        "type": "array",
        "items": {
          "type": "string"
        }
      }
    },
    "required": [
      "operation"
    ]
  },
  "output_contract_schema": {
    "type": "object",
    "properties": {
      "success": {
        "type": "boolean"
      }
    }
  },
  "ports": [
    {
      "port_id": "success",
      "label": "Logged",
      "is_default": true
    },
    {
      "port_id": "error",
      "label": "Error"
    }
  ],
  "execution_mode": "fire-and-forget",
  "tags": [
    "observability",
    "vectry",
    "ai"
  ],
  "is_stateful": false,
  "publisher": {
    "identity": "org_vectry",
    "profile": {
      "name": "Vectry Analytics",
      "verified": true,
      "url": "https://me.veripass.com/vectry",
      "logo_url": null
    }
  }
}

执行

执行方式
fire-and-forget
有状态
否
重试(retryOnFail)
否
能力
observabilitycausal-aivectryxai
标签
observabilityvectryai

说明与限制

  • Worker 调用了 logger.debug(),而运行时 logger 没有该方法(只提供 info、warning、error、log 和 success)。每次运行该调用都会抛错。
  • 修复之前,请使用 io.http 以相同的请求体发送到同一摄取端点。
  • 从 error 端口输出不会使运行失败:引擎沿 error 上的连线继续;若没有连线,该分支直接结束。
  • execution 设置(retryOnFail、maxTries、waitBetweenTries、continueOnFail、timeout_ms)可以填写,但本 worker 和引擎都不会应用。

已对照编排器代码核实 · 31e874b · 2026-11-26

安装智能体工具

为你的编程智能体接入 Sommatic AI 官方文档:技能包、文档 MCP 服务器与 Markdown 页面,无需再抓取网页。

安装 Sommatic AI CLI,并为检测到的智能体配置合适的插件。

npx @sommatic/cli agent setup
智能体如何读取本文档