创建用于监视 Azure 逻辑应用中的端到端工作流的自定义跟踪架构Create custom tracking schemas that monitor end-to-end workflows in Azure Logic A

Azure 逻辑应用提供内置跟踪功能,你可以为工作流的各个部分启用该功能。Azure Logic Apps has built-in tracking that you can enable for parts of your workflow. 但是,你可以设置自定义跟踪,用以记录工作流从头到尾的事件,例如,包含逻辑应用程序、BizTalk Server、SQL Server 或任何其他层的工作流。However, you can set up custom tracking that logs events from the beginning to the end of workflows, for example, workflows that include a logic app, BizTalk Server, SQL Server, or any other layer. 本文提供的自定义代码可以用于逻辑应用外部的层。This article provides custom code that you can use in the layers outside of your logic app.

自定义跟踪架构Custom tracking schema

{
   "sourceType": "",
   "source": {
      "workflow": {
         "systemId": ""
      },
      "runInstance": {
         "runId": ""
      },
      "operation": {
         "operationName": "",
         "repeatItemScopeName": "",
         "repeatItemIndex": ,
         "trackingId": "",
         "correlationId": "",
         "clientRequestId": ""
      }
   },
   "events": [
      {
         "eventLevel": "",
         "eventTime": "",
         "recordType": "",
         "record": {}
      }
   ]
}
属性Property 必须Required 类型Type 说明Description
sourceTypesourceType Yes StringString 运行源的类型,允许的值如下:Microsoft.Logic/workflowscustomType of the run source with these permitted values: Microsoft.Logic/workflows, custom
sourcesource Yes 字符串或 JTokenString or JToken 如果源类型为 Microsoft.Logic/workflows,则源信息必须遵循此架构。If the source type is Microsoft.Logic/workflows, the source information needs to follow this schema. 如果源类型为 custom,则架构为 JToken。If the source type is custom, the schema is a JToken.
systemIdsystemId Yes StringString 逻辑应用系统 IDLogic app system ID
runIdrunId Yes StringString 逻辑应用运行 IDLogic app run ID
operationNameoperationName Yes StringString 操作(例如操作或触发器)的名称Name of the operation, for example, action or trigger
repeatItemScopeNamerepeatItemScopeName Yes StringString 如果操作处于 foreachuntil 循环内,则重复项名称Repeat item name if the action is inside a foreachor until loop
repeatItemIndexrepeatItemIndex Yes IntegerInteger 表示操作处于 foreachuntil 循环内,并且是重复的项索引编号。Indicates that the action is inside a foreach or until loop and is the repeated item index number.
trackingIdtrackingId No StringString 用来关联消息的跟踪 IDTracking ID to correlate the messages
correlationIdcorrelationId No StringString 用来关联消息的相关性 IDCorrelation ID to correlate the messages
ClientRequestIdclientRequestId No StringString 客户端可以填充此属性来关联消息Client can populate this property to correlate messages
EventLeveleventLevel Yes StringString 事件的级别Level of the event
EventTimeeventTime Yes DateTimeDateTime 事件的时间,采用 UTC 格式:YYYY-MM-DDTHH:MM:SS.00000ZTime of the event in UTC format: YYYY-MM-DDTHH:MM:SS.00000Z
recordTyperecordType Yes StringString 跟踪记录的类型,仅允许以下值:customType of the track record with this permitted value only: custom
记录 (record)record Yes JTokenJToken 仅采用 JToken 格式的自定义记录类型Custom record type with JToken format only

B2B 协议跟踪架构B2B protocol tracking schemas

有关 B2B 协议跟踪架构的信息,请参阅:For information about B2B protocol tracking schemas, see: