使用 Azure Monitor 发出警报和监视数据工厂Alert and monitor data factories by using Azure Monitor

云应用程序比较复杂,包含很多移动部件。Cloud applications are complex and have many moving parts. 监视功能可以提供数据来确保应用程序始终处于正常运行状态。Monitors provide data to help ensure that your applications stay up and running in a healthy state. 监视功能还有助于避免潜在问题,或者排查以往的问题。Monitors also help you avoid potential problems and troubleshoot past ones.

可以使用监视数据深入了解应用程序的情况。You can use monitoring data to gain deep insights about your applications. 了解这些情况有助于改进应用程序的性能或可维护性。This knowledge helps you improve application performance and maintainability. 此外,还有助于实现本来需要手动干预的操作的自动化。It also helps you automate actions that otherwise require manual intervention.

Azure Monitor 针对大多数 Azure 服务提供基本级别的基础结构指标和日志。Azure Monitor provides base-level infrastructure metrics and logs for most Azure services. Azure 诊断日志由资源发出,提供与该资源的操作相关的各种频繁生成的数据。Azure diagnostic logs are emitted by a resource and provide rich, frequent data about the operation of that resource. Azure 数据工厂在 Monitor 中写入诊断日志。And Azure Data Factory writes diagnostic logs in Monitor.

有关详细信息,请参阅 Azure Monitor 概述For details, see Azure Monitor overview.

保留 Azure 数据工厂数据Keeping Azure Data Factory data

数据工厂仅将管道运行数据存储 45 天。Data Factory stores pipeline-run data for only 45 days. 若要将这些数据保留更长时间,请使用 Monitor。Use Monitor if you want to keep that data for a longer time. 使用 Monitor 可以路由诊断日志以进行分析。With Monitor, you can route diagnostic logs for analysis. 此外,还可以将诊断日志保存到存储帐户中,以获得所选持续时间内的工厂信息。You can also keep them in a storage account so that you have factory information for your chosen duration.

诊断日志Diagnostic logs

  • 将诊断日志保存到存储帐户进行审核或手动检查。Save your diagnostic logs to a storage account for auditing or manual inspection. 可以使用诊断设置指定保留时间(天)。You can use the diagnostic settings to specify the retention time in days.
  • 将日志流式传输到 Azure 事件中心。Stream the logs to Azure Event Hubs. 日志可用作合作伙伴服务或自定义分析解决方案(例如 Power BI)的输入。The logs become input to a partner service or to a custom analytics solution like Power BI.
  • 使用 Log Analytics 分析日志。Analyze the logs with Log Analytics.

可以使用与发出日志的资源不同的订阅中的存储帐户或事件中心命名空间。You can use a storage account or event-hub namespace that isn't in the subscription of the resource that emits logs. 配置此设置的用户必须对两个订阅都具有适当的基于角色的访问控制 (RBAC) 访问权限。The user who configures the setting must have appropriate role-based access control (RBAC) access to both subscriptions.

设置诊断日志Set up diagnostic logs

诊断设置Diagnostic settings

可以使用诊断设置来配置非计算资源的诊断日志。Use diagnostic settings to configure diagnostic logs for noncompute resources. 用于资源控制的诊断设置具有以下功能:The settings for a resource control have the following features:

  • 指定要将诊断日志发送到何处。They specify where diagnostic logs are sent. 例如,发送到 Azure 存储帐户、Azure 事件中心或 Monitor 日志。Examples include an Azure storage account, an Azure event hub, or Monitor logs.
  • 指定要发送的日志类别。They specify which log categories are sent.
  • 指定要将每个日志类别保留在存储帐户中多长时间。They specify how long each log category should be kept in a storage account.
  • 保留期为 0 天表示永久保留日志。A retention of zero days means logs are kept forever. 如果不需要永久保留,可将该值设置为 1 到 2,147,483,647 的任意天数。Otherwise, the value can be any number of days from 1 through 2,147,483,647.
  • 如果设置了保留策略,但禁止将日志存储在存储帐户中,则保留策略无效。If retention policies are set but storing logs in a storage account is disabled, the retention policies have no effect. 例如,如果仅选择了“事件中心”或“Monitor 日志”选项,此可能会发生这种情况。For example, this condition can happen when only Event Hubs or Monitor logs options are selected.
  • 保留策略按天应用。Retention policies are applied per day. 一天的结束时间可能出现在协调世界时 (UTC) 的午夜。The boundary between days occurs at midnight Coordinated Universal Time (UTC). 在一天结束时,会删除当天已超过保留策略期限的日志。At the end of a day, logs from days that are beyond the retention policy are deleted. 例如,如果保留策略的期限为一天,则在今天开始时,会删除前天的日志。For example, if you have a retention policy of one day, at the beginning of today the logs from before yesterday are deleted.

通过 Azure Monitor REST API 启用诊断日志Enable diagnostic logs via the Azure Monitor REST API

在 Monitor REST API 中创建或更新诊断设置Create or update a diagnostics setting in the Monitor REST API

请求Request
PUT
https://management.chinacloudapi.cn/{resource-id}/providers/microsoft.insights/diagnosticSettings/service?api-version={api-version}
标头Headers
  • {api-version} 替换为 2016-09-01Replace {api-version} with 2016-09-01.
  • {resource-id} 替换为要编辑其诊断设置的资源的 ID。Replace {resource-id} with the ID of the resource for which you want to edit diagnostic settings. 有关详细信息,请参阅使用资源组管理 Azure 资源For more information, see Using Resource groups to manage your Azure resources.
  • Content-Type 标头设置为 application/jsonSet the Content-Type header to application/json.
  • 将授权标头设置为从 Azure Active Directory (Azure AD) 获取的 JSON Web 令牌。Set the authorization header to the JSON web token that you got from Azure Active Directory (Azure AD). 有关详细信息,请参阅对请求进行身份验证For more information, see Authenticating requests.
正文Body
{
    "properties": {
        "storageAccountId": "/subscriptions/<subID>/resourceGroups/<resourceGroupName>/providers/Microsoft.Storage/storageAccounts/<storageAccountName>",
        "serviceBusRuleId": "/subscriptions/<subID>/resourceGroups/<resourceGroupName>/providers/Microsoft.EventHub/namespaces/<eventHubName>/authorizationrules/RootManageSharedAccessKey",
        "workspaceId": "/subscriptions/<subID>/resourceGroups/<resourceGroupName>/providers/Microsoft.OperationalInsights/workspaces/<LogAnalyticsName>",
        "metrics": [
        ],
        "logs": [
                {
                    "category": "PipelineRuns",
                    "enabled": true,
                    "retentionPolicy": {
                        "enabled": false,
                        "days": 0
                    }
                },
                {
                    "category": "TriggerRuns",
                    "enabled": true,
                    "retentionPolicy": {
                        "enabled": false,
                        "days": 0
                    }
                },
                {
                    "category": "ActivityRuns",
                    "enabled": true,
                    "retentionPolicy": {
                        "enabled": false,
                        "days": 0
                    }
                }
            ]
    },
    "location": ""
}
属性Property 类型Type 说明Description
storageAccountIdstorageAccountId StringString 要将诊断日志发送到的存储帐户的资源 ID。The resource ID of the storage account to which you want to send diagnostic logs.
serviceBusRuleIdserviceBusRuleId StringString 服务总线命名空间的服务总线规则 ID。你要在该服务总线命名空间中创建事件中心,以便流式传输诊断日志。The service-bus rule ID of the service-bus namespace in which you want to have Event Hubs created for streaming diagnostic logs. 规则 ID 的格式为 {service bus resource ID}/authorizationrules/{key name}The rule ID has the format {service bus resource ID}/authorizationrules/{key name}.
workspaceIdworkspaceId 复杂类型Complex Type 指标时间粒度及其保留策略的数组。An array of metric time grains and their retention policies. 此属性的值为空。This property's value is empty.
指标metrics 要传递到被调用管道的管道运行的参数值Parameter values of the pipeline run to be passed to the invoked pipeline 将参数名映射为自变量值的 JSON 对象。A JSON object that maps parameter names to argument values.
logslogs 复杂类型Complex Type 某个资源类型的诊断日志类别的名称。The name of a diagnostic-log category for a resource type. 若要获取资源的诊断日志类别列表,请先执行 GET 诊断设置操作。To get the list of diagnostic-log categories for a resource, perform a GET diagnostic-settings operation.
categorycategory StringString 日志类别及其保留策略的数组。An array of log categories and their retention policies.
timeGraintimeGrain StringString 以 ISO 8601 持续时间格式捕获的指标的粒度。The granularity of metrics, which are captured in ISO 8601 duration format. 该属性值必须为 PT1M(1 分钟)。The property value must be PT1M, which specifies one minute.
enabledenabled 布尔Boolean 指定是否为此资源启用了该指标或日志类别的收集。Specifies whether collection of the metric or log category is enabled for this resource.
retentionPolicyretentionPolicy 复杂类型Complex Type 描述指标或日志类别的保留策略。Describes the retention policy for a metric or log category. 此属性仅用于存储帐户。This property is used for storage accounts only.
daysdays intInt 指标或日志的保留天数。The number of days to keep the metrics or logs. 如果该属性值为 0,则永久保留日志。If the property value is 0, the logs are kept forever. 此属性仅用于存储帐户。This property is used for storage accounts only.
响应Response

200 正常。200 OK.

{
    "id": "/subscriptions/<subID>/resourcegroups/adf/providers/microsoft.datafactory/factories/shloadobetest2/providers/microsoft.insights/diagnosticSettings/service",
    "type": null,
    "name": "service",
    "location": null,
    "kind": null,
    "tags": null,
    "properties": {
        "storageAccountId": "/subscriptions/<subID>/resourceGroups/<resourceGroupName>/providers/Microsoft.Storage/storageAccounts/<storageAccountName>",
        "serviceBusRuleId": "/subscriptions/<subID>/resourceGroups/<resourceGroupName>/providers/Microsoft.EventHub/namespaces/<eventHubName>/authorizationrules/RootManageSharedAccessKey",
        "workspaceId": "/subscriptions/<subID>/resourceGroups/<resourceGroupName>/providers/Microsoft.OperationalInsights/workspaces/<LogAnalyticsName>",
        "eventHubAuthorizationRuleId": null,
        "eventHubName": null,
        "metrics": [],
        "logs": [
            {
                "category": "PipelineRuns",
                "enabled": true,
                "retentionPolicy": {
                    "enabled": false,
                    "days": 0
                }
            },
            {
                "category": "TriggerRuns",
                "enabled": true,
                "retentionPolicy": {
                    "enabled": false,
                    "days": 0
                }
            },
            {
                "category": "ActivityRuns",
                "enabled": true,
                "retentionPolicy": {
                    "enabled": false,
                    "days": 0
                }
            }
        ]
    },
    "identity": null
}

在 Monitor REST API 中获取有关诊断设置的信息Get information about diagnostics settings in the Monitor REST API

请求Request
GET
https://management.chinacloudapi.cn/{resource-id}/providers/microsoft.insights/diagnosticSettings/service?api-version={api-version}
标头Headers
  • {api-version} 替换为 2016-09-01Replace {api-version} with 2016-09-01.
  • {resource-id} 替换为要编辑其诊断设置的资源的 ID。Replace {resource-id} with the ID of the resource for which you want to edit diagnostic settings. 有关详细信息,请参阅使用资源组管理 Azure 资源For more information, see Using Resource groups to manage your Azure resources.
  • Content-Type 标头设置为 application/jsonSet the Content-Type header to application/json.
  • 将授权标头设置为从 Azure AD 获取的 JSON Web 令牌。Set the authorization header to a JSON web token that you got from Azure AD. 有关详细信息,请参阅对请求进行身份验证For more information, see Authenticating requests.
响应Response

200 正常。200 OK.

{
    "id": "/subscriptions/<subID>/resourcegroups/adf/providers/microsoft.datafactory/factories/shloadobetest2/providers/microsoft.insights/diagnosticSettings/service",
    "type": null,
    "name": "service",
    "location": null,
    "kind": null,
    "tags": null,
    "properties": {
        "storageAccountId": "/subscriptions/<subID>/resourceGroups/shloprivate/providers/Microsoft.Storage/storageAccounts/azmonlogs",
        "serviceBusRuleId": "/subscriptions/<subID>/resourceGroups/shloprivate/providers/Microsoft.EventHub/namespaces/shloeventhub/authorizationrules/RootManageSharedAccessKey",
        "workspaceId": "/subscriptions/<subID>/resourceGroups/ADF/providers/Microsoft.OperationalInsights/workspaces/mihaipie",
        "eventHubAuthorizationRuleId": null,
        "eventHubName": null,
        "metrics": [],
        "logs": [
            {
                "category": "PipelineRuns",
                "enabled": true,
                "retentionPolicy": {
                    "enabled": false,
                    "days": 0
                }
            },
            {
                "category": "TriggerRuns",
                "enabled": true,
                "retentionPolicy": {
                    "enabled": false,
                    "days": 0
                }
            },
            {
                "category": "ActivityRuns",
                "enabled": true,
                "retentionPolicy": {
                    "enabled": false,
                    "days": 0
                }
            }
        ]
    },
    "identity": null
}

有关详细信息,请参阅诊断设置For more information, see Diagnostic Settings.

日志和事件的架构Schema of logs and events

监视架构Monitor schema

活动运行日志属性Activity-run log attributes

{
   "Level": "",
   "correlationId":"",
   "time":"",
   "activityRunId":"",
   "pipelineRunId":"",
   "resourceId":"",
   "category":"ActivityRuns",
   "level":"Informational",
   "operationName":"",
   "pipelineName":"",
   "activityName":"",
   "start":"",
   "end":"",
   "properties":
       {
          "Input": "{
              "source": {
                "type": "BlobSource"
              },
              "sink": {
                "type": "BlobSink"
              }
           }",
          "Output": "{"dataRead":121,"dataWritten":121,"copyDuration":5,
               "throughput":0.0236328132,"errors":[]}",
          "Error": "{
              "errorCode": "null",
              "message": "null",
              "failureType": "null",
              "target": "CopyBlobtoBlob"
        }
    }
}
属性Property 类型Type 说明Description 示例Example
级别Level StringString 诊断日志的级别。The level of the diagnostic logs. 对于活动运行日志,请将该属性值设置为 4。For activity-run logs, set the property value to 4. 4
correlationIdcorrelationId StringString 用于跟踪特定请求的唯一 ID。The unique ID for tracking a particular request. 319dc6b4-f348-405e-b8d7-aafc77b73e77
timetime StringString 事件的时间,以时间跨度表示,采用 UTC 格式 YYYY-MM-DDTHH:MM:SS.00000ZThe time of the event in the timespan UTC format YYYY-MM-DDTHH:MM:SS.00000Z. 2017-06-28T21:00:27.3534352Z
activityRunIdactivityRunId StringString 活动运行的 ID。The ID of the activity run. 3a171e1f-b36e-4b80-8a54-5625394f4354
pipelineRunIdpipelineRunId StringString 管道运行的 ID。The ID of the pipeline run. 9f6069d6-e522-4608-9f99-21807bfc3c70
resourceIdresourceId StringString 与数据工厂资源关联的 ID。The ID associated with the data-factory resource. /SUBSCRIPTIONS/<subID>/RESOURCEGROUPS/<resourceGroupName>/PROVIDERS/MICROSOFT.DATAFACTORY/FACTORIES/<dataFactoryName>
categorycategory StringString 诊断日志的类别。The category of the diagnostic logs. 请将该属性值设置为 ActivityRunsSet the property value to ActivityRuns. ActivityRuns
levellevel StringString 诊断日志的级别。The level of the diagnostic logs. 请将该属性值设置为 InformationalSet the property value to Informational. Informational
operationNameoperationName StringString 活动的名称及其状态。The name of the activity with its status. 如果活动是启动检测信号,则属性值为 MyActivity -If the activity is the start heartbeat, the property value is MyActivity -. 如果活动是结束检测信号,则属性值为 MyActivity - SucceededIf the activity is the end heartbeat, the property value is MyActivity - Succeeded. MyActivity - Succeeded
pipelineNamepipelineName StringString 管道的名称。The name of the pipeline. MyPipeline
activityNameactivityName StringString 活动的名称。The name of the activity. MyActivity
startstart StringString 活动运行的开始时间,以时间跨度表示,采用 UTC 格式。The start time of the activity runs in timespan UTC format. 2017-06-26T20:55:29.5007959Z
endend StringString 活动运行的结束时间,以时间跨度表示,采用 UTC 格式。The end time of the activity runs in timespan UTC format. 如果诊断日志显示活动已启动但尚未结束,则该属性值为 1601-01-01T00:00:00ZIf the diagnostic log shows that an activity has started but not yet ended, the property value is 1601-01-01T00:00:00Z. 2017-06-26T20:55:29.5007959Z

管道运行日志属性Pipeline-run log attributes

{
   "Level": "",
   "correlationId":"",
   "time":"",
   "runId":"",
   "resourceId":"",
   "category":"PipelineRuns",
   "level":"Informational",
   "operationName":"",
   "pipelineName":"",
   "start":"",
   "end":"",
   "status":"",
   "properties":
    {
      "Parameters": {
        "<parameter1Name>": "<parameter1Value>"
      },
      "SystemParameters": {
        "ExecutionStart": "",
        "TriggerId": "",
        "SubscriptionId": ""
      }
    }
}
属性Property 类型Type 说明Description 示例Example
级别Level StringString 诊断日志的级别。The level of the diagnostic logs. 对于活动运行日志,请将该属性值设置为 4。For activity-run logs, set the property value to 4. 4
correlationIdcorrelationId StringString 用于跟踪特定请求的唯一 ID。The unique ID for tracking a particular request. 319dc6b4-f348-405e-b8d7-aafc77b73e77
timetime StringString 事件的时间,以时间跨度表示,采用 UTC 格式 YYYY-MM-DDTHH:MM:SS.00000ZThe time of the event in the timespan UTC format YYYY-MM-DDTHH:MM:SS.00000Z. 2017-06-28T21:00:27.3534352Z
runIdrunId StringString 管道运行的 ID。The ID of the pipeline run. 9f6069d6-e522-4608-9f99-21807bfc3c70
resourceIdresourceId StringString 与数据工厂资源关联的 ID。The ID associated with the data-factory resource. /SUBSCRIPTIONS/<subID>/RESOURCEGROUPS/<resourceGroupName>/PROVIDERS/MICROSOFT.DATAFACTORY/FACTORIES/<dataFactoryName>
categorycategory StringString 诊断日志的类别。The category of the diagnostic logs. 请将该属性值设置为 PipelineRunsSet the property value to PipelineRuns. PipelineRuns
levellevel StringString 诊断日志的级别。The level of the diagnostic logs. 请将该属性值设置为 InformationalSet the property value to Informational. Informational
operationNameoperationName StringString 管道的名称及其状态。The name of the pipeline along with its status. 管道运行完成后,该属性值为 Pipeline - SucceededAfter the pipeline run is finished, the property value is Pipeline - Succeeded. MyPipeline - SucceededMyPipeline - Succeeded.
pipelineNamepipelineName StringString 管道的名称。The name of the pipeline. MyPipeline
startstart StringString 活动运行的开始时间,以时间跨度表示,采用 UTC 格式。The start time of the activity runs in timespan UTC format. 2017-06-26T20:55:29.5007959Z2017-06-26T20:55:29.5007959Z.
endend StringString 活动运行的结束时间,以时间跨度表示,采用 UTC 格式。The end time of the activity runs in timespan UTC format. 如果诊断日志显示活动已启动但尚未结束,则该属性值为 1601-01-01T00:00:00ZIf the diagnostic log shows an activity has started but not yet ended, the property value is 1601-01-01T00:00:00Z. 2017-06-26T20:55:29.5007959Z
statusstatus StringString 管道运行的最终状态。The final status of the pipeline run. 可能的属性值为 SucceededFailedPossible property values are Succeeded and Failed. Succeeded

触发器运行日志属性Trigger-run log attributes

{
   "Level": "",
   "correlationId":"",
   "time":"",
   "triggerId":"",
   "resourceId":"",
   "category":"TriggerRuns",
   "level":"Informational",
   "operationName":"",
   "triggerName":"",
   "triggerType":"",
   "triggerEvent":"",
   "start":"",
   "status":"",
   "properties":
   {
      "Parameters": {
        "TriggerTime": "",
       "ScheduleTime": ""
      },
      "SystemParameters": {}
    }
}

属性Property 类型Type 说明Description 示例Example
级别Level StringString 诊断日志的级别。The level of the diagnostic logs. 对于活动运行日志,请将该属性值设置为 4。For activity-run logs, set the property value to 4. 4
correlationIdcorrelationId StringString 用于跟踪特定请求的唯一 ID。The unique ID for tracking a particular request. 319dc6b4-f348-405e-b8d7-aafc77b73e77
timetime StringString 事件的时间,以时间跨度表示,采用 UTC 格式 YYYY-MM-DDTHH:MM:SS.00000ZThe time of the event in the timespan UTC format YYYY-MM-DDTHH:MM:SS.00000Z. 2017-06-28T21:00:27.3534352Z
triggerIdtriggerId StringString 触发器运行的 ID。The ID of the trigger run. 08587023010602533858661257311
resourceIdresourceId StringString 与数据工厂资源关联的 ID。The ID associated with the data-factory resource. /SUBSCRIPTIONS/<subID>/RESOURCEGROUPS/<resourceGroupName>/PROVIDERS/MICROSOFT.DATAFACTORY/FACTORIES/<dataFactoryName>
categorycategory StringString 诊断日志的类别。The category of the diagnostic logs. 请将该属性值设置为 PipelineRunsSet the property value to PipelineRuns. PipelineRuns
levellevel StringString 诊断日志的级别。The level of the diagnostic logs. 请将该属性值设置为 InformationalSet the property value to Informational. Informational
operationNameoperationName StringString 触发器的名称及其最终状态(指示是否已成功激发该触发器)。The name of the trigger with its final status, which indicates whether the trigger successfully fired. 如果检测信号成功,则该属性值为 MyTrigger - SucceededIf the heartbeat was successful, the property value is MyTrigger - Succeeded. MyTrigger - Succeeded
triggerNametriggerName StringString 触发器的名称。The name of the trigger. MyTrigger
triggerTypetriggerType StringString 触发器的类型。The type of the trigger. 可能的属性值为 Manual TriggerSchedule TriggerPossible property values are Manual Trigger and Schedule Trigger. ScheduleTrigger
triggerEventtriggerEvent StringString 触发器的事件。The event of the trigger. ScheduleTime - 2017-07-06T01:50:25Z
startstart StringString 激发触发器的开始时间,以时间跨度表示,采用 UTC 格式。The start time of the trigger firing in timespan UTC format. 2017-06-26T20:55:29.5007959Z
statusstatus StringString 最终状态(指示是否已成功激发该触发器)。The final status showing whether the trigger successfully fired. 可能的属性值为 SucceededFailedPossible property values are Succeeded and Failed. Succeeded

Log Analytics 架构Log Analytics schema

Log Analytics 从 Monitor 继承架构,但存在以下例外情况:Log Analytics inherits the schema from Monitor with the following exceptions:

  • 每个列名中的第一个字母会大写。The first letter in each column name is capitalized. 例如,Monitor 中的列名“correlationId”在 Log Analytics 中为“CorrelationId”。For example, the column name "correlationId" in Monitor is "CorrelationId" in Log Analytics.

  • 没有“Level”列。There's no "Level" column.

  • 动态“properties”列保留为以下动态 JSON Blob 类型。The dynamic "properties" column is preserved as the following dynamic JSON blob type.

    Azure Monitor 列Azure Monitor column Log Analytics 列Log Analytics column 类型Type
    $.properties.UserProperties$.properties.UserProperties UserPropertiesUserProperties 动态Dynamic
    $.properties.Annotations$.properties.Annotations 批注Annotations 动态Dynamic
    $.properties.Input$.properties.Input 输入Input 动态Dynamic
    $.properties.Output$.properties.Output 输出Output 动态Dynamic
    $.properties.Error.errorCode$.properties.Error.errorCode ErrorCodeErrorCode intint
    $.properties.Error.message$.properties.Error.message ErrorMessageErrorMessage stringstring
    $.properties.Error$.properties.Error 错误Error 动态Dynamic
    $.properties.Predecessors$.properties.Predecessors PredecessorsPredecessors 动态Dynamic
    $.properties.Parameters$.properties.Parameters parametersParameters 动态Dynamic
    $.properties.SystemParameters$.properties.SystemParameters SystemParametersSystemParameters 动态Dynamic
    $.properties.Tags$.properties.Tags TagsTags 动态Dynamic

指标Metrics

使用 Monitor 可以洞察 Azure 工作负荷的性能与运行状况。With Monitor, you can gain visibility into the performance and health of your Azure workloads. 最重要的 Monitor 数据类型是指标(也称为性能计数器)。The most important type of Monitor data is the metric, which is also called the performance counter. 大多数 Azure 资源都会发出指标。Metrics are emitted by most Azure resources. Monitor 提供多种方式来配置和使用这些指标,以便进行监视与故障排除。Monitor provides several ways to configure and consume these metrics for monitoring and troubleshooting.

Azure 数据工厂版本 2 发出以下指标。Azure Data Factory version 2 emits the following metrics.

指标Metric 指标显示名称Metric display name 单位Unit 聚合类型Aggregation type 说明Description
PipelineSucceededRunsPipelineSucceededRuns 成功的管道运行数指标Succeeded pipeline runs metrics 计数Count 总计Total 在一分钟时段内成功的管道运行总数。The total number of pipeline runs that succeeded within a minute window.
PipelineFailedRunsPipelineFailedRuns 失败的管道运行数指标Failed pipeline runs metrics 计数Count 总计Total 在一分钟时段内失败的管道运行总数。The total number of pipeline runs that failed within a minute window.
ActivitySucceededRunsActivitySucceededRuns 成功的活动运行数指标Succeeded activity runs metrics 计数Count 总计Total 在一分钟时段内成功的活动运行总数。The total number of activity runs that succeeded within a minute window.
ActivityFailedRunsActivityFailedRuns 失败的活动运行数指标Failed activity runs metrics 计数Count 总计Total 在一分钟时段内失败的活动运行总数。The total number of activity runs that failed within a minute window.
TriggerSucceededRunsTriggerSucceededRuns 成功的触发器运行数指标Succeeded trigger runs metrics 计数Count 总计Total 在一分钟时段内成功的触发器运行总数。The total number of trigger runs that succeeded within a minute window.
TriggerFailedRunsTriggerFailedRuns 失败的触发器运行数指标Failed trigger runs metrics 计数Count 总计Total 在一分钟时段内失败的触发器运行总数。The total number of trigger runs that failed within a minute window.

若要访问指标,请参阅 Azure Monitor 数据平台中的说明。To access the metrics, complete the instructions in Azure Monitor data platform.

使用 Azure Monitor 监视数据工厂指标Monitor Data Factory metrics with Azure Monitor

可以使用 Azure 数据工厂与 Monitor 的集成将数据路由到 Monitor。You can use Data Factory integration with Monitor to route data to Monitor. 此集成在以下情况下非常有用:This integration is useful in the following scenarios:

  • 可以针对由数据工厂发布到 Monitor 的丰富指标集编写复杂查询。You want to write complex queries on a rich set of metrics that is published by Data Factory to Monitor. 可以通过 Monitor 创建针对这些查询的自定义警报。You can create custom alerts on these queries via Monitor.

  • 你希望跨数据工厂进行监视。You want to monitor across data factories. 可将来自多个数据工厂的数据路由到单个 Monitor 工作区。You can route data from multiple data factories to a single Monitor workspace.

有关此功能的 7 分钟介绍和演示,请观看以下视频:For a seven-minute introduction and demonstration of this feature, watch the following video:

配置诊断设置和工作区Configure Diagnostic Settings and Workspace

为数据工厂启用诊断设置。Enable Diagnostic Settings for your data factory.

  1. 选择“Azure Monitor” -> “诊断设置”-> 选择数据工厂 -> 启用诊断。 Select Azure Monitor -> Diagnostics settings -> Select the data factory -> Turn on diagnostics.

    monitor-oms-image1.png

  2. 提供包括工作区配置在内的诊断设置。Provide diagnostic settings including configuration of the workspace.

    monitor-oms-image2.png

警报Alerts

登录到 Azure 门户,选择“Monitor” > “警报”以创建警报。 Sign in to the Azure portal and select Monitor > Alerts to create alerts.

门户菜单中的警报

创建警报Create Alerts

  1. 选择“+ 创建新的预警规则”,创建新的警报 。Select + New Alert rule to create a new alert.

    新建警报规则

  2. 定义警报条件。Define the alert condition.

    Note

    请务必在“按资源类型筛选”下拉列表中选择“所有”。 Make sure to select All in the Filter by resource type drop-down list.

    “定义警报条件”>“选择目标”,此时会打开“选择资源”窗格"Define alert condition" > "Select target", which opens the "Select a resource" pane

    “定义警报条件”>“添加条件”,此时会打开“配置信号逻辑”窗格

    “配置信号类型”窗格

  3. 定义警报详细信息。Define the alert details.

    警报详细信息

  4. 定义操作组。Define the action group.

    创建规则的屏幕截图,其中突出显示了“新建操作组”

    创建新的操作组

    配置电子邮件、短信、推送和语音

    删除操作组

后续步骤Next steps

以编程方式监视和管理管道Monitor and manage pipelines programmatically