我有一个springboot 2应用程序,我想在AWS Cloudwatch中显示度量指标。
我已经在pom中加入了千分尺云图的依赖性。
这里设置是为各种度量系统记录的,而不是cloudwatch。
我还需要为云手表做哪些配置?
发布于 2019-10-23 13:02:51
首先,您可能需要添加一些额外的依赖项。我需要以下几点:
在我的示例中,除执行器之外,引导无法管理这些依赖项的版本,因此您可能必须为您找到正确的版本。
首先,必须设置一些应用程序属性:
# disable unwanted features to prevent autoconfigure which will produce errors and abort of application startup eventually
# alternatively you can try to configure those features correctly if you intend to use them
cloud.aws.stack.auto=false
# enable micrometer for cloudwatch (only where there is actually access to it)
management.metrics.export.cloudwatch.enabled=true
# set the namespace that will contain the metrics for this application
management.metrics.export.cloudwatch.namespace=test
# set max batch size to the actual maximum (if not a bug in certain versions of micrometer for cloudwatch will send
# batches that are too big)
management.metrics.export.cloudwatch.batchSize=20下一步将是AWS。与EC2实例(或您正在使用的任何内容)关联的角色需要有权限CloudWatch:PutMetricData。
使用此配置将启用CloudWatch-监视您的。
我遇到的一个消息来源说,您应该使用:
cloud.aws.credentials.instanceProfile=false这将阻止Spring自动获取将度量推到CloudWatch所必需的凭据。您也可以通过其他方式提供自己的凭据,但我没有尝试过。
https://stackoverflow.com/questions/50504949
复制相似问题