【问题标题】:Is there a way to publish custom metrics from AWS Glue jobs?有没有办法从 AWS Glue 作业发布自定义指标?
【发布时间】:2021-06-08 23:54:47
【问题描述】:

我正在使用 AWS Glue 作业在 S3 存储桶之间移动和转换数据,并且我想构建自定义累加器来监控我正在接收和发送的行数以及其他自定义指标。监控这些指标的最佳方法是什么?根据此文档:https://docs.aws.amazon.com/glue/latest/dg/monitoring-awsglue-with-cloudwatch-metrics.html 我可以跟踪胶水作业的一般指标,但似乎没有通过 cloudwatch 发送自定义指标的好方法。

【问题讨论】:

    标签: amazon-web-services amazon-cloudwatch aws-glue


    【解决方案1】:

    在您的 AWS Glue 作业中考虑 enabling continuous logging。这将允许您通过进行自定义日志记录。云观察。自定义日志记录可以包含行数等信息。

    更具体

    1. Enable continuous logging for you Glue Job
    2. 在胶水作业的开头添加logger = glueContext.get_logger()
    3. 在您希望将信息记录到 CloudWatch 的位置添加 logger.info("Custom logging message that will be sent to CloudWatch")。例如,如果我有一个名为 df 的数据框,我可以通过添加 logger.info("Row count of df " + str(df.count())) 将行数记录到 CloudWatch

    您的日志消息将位于名为 glue_run_id -driver 的日志流下的 CloudWatch 日志组 /aws-glue/jobs/logs-v2

    您还可以参考 AWS 文档 Enabling Continuous Logging for AWS Glue Jobs 的“使用自定义脚本记录器记录应用程序特定消息”部分,了解有关应用程序特定日志记录的更多信息。

    【讨论】:

    • OP 明确要求自定义指标。您正在回答有关日志记录的问题。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-09-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-07-17
    • 1970-01-01
    相关资源
    最近更新 更多