def put_cloudwatch_metric()

in batch_pipeline/pipelines/postprocess_monitor_script.py [0:0]


def put_cloudwatch_metric(pipeline_name: str, metrics: list):
    for m in metrics:
        logger.info(f'Putting metric: {m["metric_name"]} value: {m["metric_value"]}')
        response = cloudwatch.put_metric_data(
            Namespace="aws/sagemaker/ModelBuildingPipeline/data-metrics",
            MetricData=[
                {
                    "MetricName": m["metric_name"],
                    "Dimensions": [{"Name": "PipelineName", "Value": pipeline_name}],
                    "Timestamp": datetime.now(),
                    "Value": m["metric_value"],
                    "Unit": "None",
                },
            ],
        )
        logger.debug(response)