UiPath Documentation
functions
latest
false
函数用户指南
  • 概述
    • 关于函数
  • Python 函数
    • 入门指南
    • 构建 Python 函数
    • 访问平台服务
    • 资源绑定
    • 声明资源绑定
    • 调用 Integration Service 活动
    • 追踪和可观察性
    • 测试和调试
  • 部署并运行

追踪和可观察性

@traced 修饰符使单个执行步骤在作业追踪和 Maestro 仪表板中可见。使用它来批注执行有意义的工作的帮助程序函数,以便您可以查看时间花费在哪些位置以及运行失败。

from uipath.tracing import traced


@traced(name="fetch_document", run_type="uipath")
def fetch_document(document_id: str) -> bytes:
    # implementation
    ...


def main(input: Input) -> Output:  # do not trace the entry point
    content = fetch_document(input.document_id)
    return Output(result_id="123")
from uipath.tracing import traced


@traced(name="fetch_document", run_type="uipath")
def fetch_document(document_id: str) -> bytes:
    # implementation
    ...


def main(input: Input) -> Output:  # do not trace the entry point
    content = fetch_document(input.document_id)
    return Output(result_id="123")
重要提示:

请勿将 @traced 应用于入口点函数。运行时已将整个作业包含在自己的跨度中;追踪入口点会生成重复的嵌套跨度。

捕获的内容

每个追踪的步骤都记录其名称、运行类型、开始和结束时间以及状态。追踪记录已链接到 Orchestrator 作业,因此您可以从 Maestro 流程实例导航到运行的单个功能步骤。

指南

  • 追踪表示不同工作单元的步骤 - 外部调用、提取、转换。
  • 在每个步骤中使用清晰稳定的 name,以便在运行期间轻松读取追踪记录。
  • 保留平台步骤的 run_type="uipath"

后续步骤

  • 捕获的内容
  • 指南
  • 后续步骤

此页面有帮助吗?

连接

需要帮助? 支持

想要了解详细内容? UiPath Academy

有问题? UiPath 论坛

保持更新