首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >为AWS配置千分尺的SpringBoot 2应用程序

为AWS配置千分尺的SpringBoot 2应用程序
EN

Stack Overflow用户
提问于 2018-05-24 08:49:43
回答 1查看 2.2K关注 0票数 8

我有一个springboot 2应用程序,我想在AWS Cloudwatch中显示度量指标。

我已经在pom中加入了千分尺云图的依赖性。

这里设置是为各种度量系统记录的,而不是cloudwatch。

我还需要为云手表做哪些配置?

EN

回答 1

Stack Overflow用户

发布于 2019-10-23 13:02:51

首先,您可能需要添加一些额外的依赖项。我需要以下几点:

  • org.springframework.boot -弹簧-启动-启动器-驱动器
  • org.springframework.cloud -弹簧-云-启动器-aws
  • io.micrometer -千分尺芯
  • io.micrometer -千分尺-注册表-云表

在我的示例中,除执行器之外,引导无法管理这些依赖项的版本,因此您可能必须为您找到正确的版本。

首先,必须设置一些应用程序属性:

代码语言:javascript
复制
# 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-监视您的。

我遇到的一个消息来源说,您应该使用:

代码语言:javascript
复制
cloud.aws.credentials.instanceProfile=false

这将阻止Spring自动获取将度量推到CloudWatch所必需的凭据。您也可以通过其他方式提供自己的凭据,但我没有尝试过。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50504949

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档