自带容器的 CloudWatch 指标
如果 publish_cloudwatch_metrics 值为 /opt/ml/processing/processingjobconfig.json 文件中 Environment 映射中的 Enabled,则容器代码将在此位置发出 Amazon CloudWatch 指标:/opt/ml/output/metrics/cloudwatch。
此文件的架构在很大程度上基于 CloudWatch PutMetrics API。此处未指定命名空间。它默认为以下内容:
-
For real-time endpoints: /aws/sagemaker/Endpoint/data-metrics -
For batch transform jobs: /aws/sagemaker/ModelMonitoring/data-metrics
不过,您可以指定维度。建议您至少添加以下维度:
-
Endpoint和MonitoringSchedule(对于实时端点) -
MonitoringSchedule(对于批量转换作业)
以下 JSON 片段展示了如何设置维度。
对于实时端点,请参阅以下 JSON 片段,其中包含 Endpoint 和 MonitoringSchedule 维度:
{ "MetricName": "", # Required "Timestamp": "2019-11-26T03:00:00Z", # Required "Dimensions" : [{"Name":"Endpoint","Value":"endpoint_0"},{"Name":"MonitoringSchedule","Value":"schedule_0"}] "Value": Float, # Either the Value or the StatisticValues field can be populated and not both. "StatisticValues": { "SampleCount": Float, "Sum": Float, "Minimum": Float, "Maximum": Float }, "Unit": "Count", # Optional }
对于批量转换作业,请参阅以下 JSON 片段,其中包含 MonitoringSchedule 维度:
{ "MetricName": "", # Required "Timestamp": "2019-11-26T03:00:00Z", # Required "Dimensions" : [{"Name":"MonitoringSchedule","Value":"schedule_0"}] "Value": Float, # Either the Value or the StatisticValues field can be populated and not both. "StatisticValues": { "SampleCount": Float, "Sum": Float, "Minimum": Float, "Maximum": Float }, "Unit": "Count", # Optional }