spring-boot-actuator 相关问题

Spring Boot Actuator是Spring Boot的子项目。它为您的应用程序添加了多种生产级服务,而您只需付出很少的努力。

执行器刷新为 springboot 2.2.7 提供 404 错误

我正在尝试使用 springboot 2.2.7 来使用执行器刷新端点。但我面临 404 错误。 我的端点是 POST 调用 http://localhost:8080/执行器/刷新 回复: { “时间戳”...

回答 2 投票 0

Spring Boot 3.0.X 中 http.client.requests 指标的 URI 标记为 NONE

从 Spring Boot 2.7.5 迁移到 Spring Boot 3.0.1 后。 在所有情况下,指标 http.client.requests 上的标记 URI 的值均为 none。 我们构建restTemplate 的URI,如下所示 URI uri =

回答 2 投票 0

禁用 Spring 应用程序指标

我的 Spring Boot 应用程序自动推送 spring_data_repository_invocates_percentile 指标。随着时间的推移,应用程序变得非常大,并且有很多存储库类,这很......

回答 1 投票 0

Spring Boot 应用程序中每个端点 uri 的 HTTP 指标

我已经为我的项目启用了执行器。我对应用程序中每个端点 uri 的指标感兴趣。 我有两个端点 / 和 /hello。当我访问 /actuator/metrics/http.server.requests 时,我得到

回答 1 投票 0

如果 Guava 缓存绑定到 MeterRegistry,EhCache 指标不会出现在 Prometheus 中

隐式创建的EhCache缓存 我有一个 Spring 组件,它使用具有以下配置的文件 ehcache.xml 声明一些缓存: 隐式创建的EhCache缓存 我有一个 Spring 组件,它使用具有以下配置的文件 ehcache.xml 声明一些缓存: <?xml version="1.0" encoding="UTF-8"?> <eh:config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:eh="http://www.ehcache.org/v3" xsi:schemaLocation="http://www.ehcache.org/v3 http://www.ehcache.org/schema/ehcache-core-3.3.xsd"> <eh:cache alias="Cache1"> <eh:expiry> <eh:ttl unit="minutes">1</eh:ttl> </eh:expiry> <eh:resources> <eh:heap>10000</eh:heap> </eh:resources> </eh:cache> <!-- [...] --> </eh:config> 然后使用类似于以下内容: import org.springframework.cache.annotation.Cacheable; public class ThingDoer { @Cacheable("Cache1") public Integer doSomethingCached(int value) { return value + 3; } // ... } 这样,我可以看到 Prometheus 中出现不同的缓存指标: bash> 2>&1 curl -v --silent 'http://localhost:9000/actuator/prometheus' | grep cache_gets | sort cache_gets_total{cache="Cache1",cache_manager="cacheManager",hostname="localhost",name="Cache1",result="hit",} 0.0 cache_gets_total{cache="Cache1",cache_manager="cacheManager",hostname="localhost",name="Cache1",result="miss",} 0.0 cache_gets_total{cache="Cache2",cache_manager="cacheManager",hostname="localhost",name="Cache2",result="hit",} 0.0 cache_gets_total{cache="Cache2",cache_manager="cacheManager",hostname="localhost",name="Cache2",result="miss",} 0.0 cache_gets_total{cache="Cache3",cache_manager="cacheManager",hostname="localhost",name="Cache3",result="hit",} 0.0 cache_gets_total{cache="Cache3",cache_manager="cacheManager",hostname="localhost",name="Cache3",result="miss",} 0.0 [...] 我在文件中定义的所有缓存ehcache.xml都会自动公开它们的指标。 添加自制缓存 现在,我创建了一个自制的缓存,它在查询时执行复杂的操作,并为此使用了 com.google.common.cache.LoadingCache 接口,因为它的目的是替换此类缓存的另一个实例,并对其余代码进行尽可能少的更改。因此,我创建了一个自定义缓存,具有以下签名: import com.google.common.cache.AbstractLoadingCache; public class CustomCache extends AbstractLoadingCache<String, Object> { public CustomCache(Function<String, Object> valueLoader) { // ... } // ... } 它正确声明了一个 stats() 方法,该方法返回包含缓存统计信息的 com.google.common.cache.CacheStats。其构造函数的参数 valueLoader 用于在缓存中缺少新值时加载新值。 现在,这是如何使用此缓存的草图: import java.util.Optional; import java.util.concurrent.ExecutionException; import java.util.function.Function; public class CustomThingDoer { private final CustomCache customCache; public CustomThingDoer() { this.customCache = new CustomCache(this::loadNewObject); } public Optional<Object> doSomethingCached(String value) { try { return Optional.of(customCache.get(value)); } catch (ExecutionException e) { System.out.println("Something wrong happened"); return Optional.empty(); } } private Object loadNewObject(String value) { // Do something non-static } } 由于缓存旨在直接调用其方法的地方使用(即没有 @Cacheable 注释来使用此缓存,而是使用对 get 的调用),并且由于加载缺失值的方法取决于在定义它的类的实例上(即,所讨论的方法是提取数据库,其代码取决于CustomThingDoer实例中定义的内容),我希望将其手动注册到MeterRegistry中。 为此,我将 MeterRegistry 的 bean 传递给构造函数中的 CustomThingDoer,并执行以下操作: GuavaCacheMetrics.monitor(meterRegistry, this.customCache, "MyCustomCache"); 消失的缓存指标 但是现在这已经完成了,这就是我在 Prometheus 中获得的缓存指标: bash> 2>&1 curl -v --silent 'http://localhost:9000/actuator/prometheus' | grep cache_gets | sort cache_gets_total{cache="MyCustomCache",hostname="localhost",result="hit",} 0.0 cache_gets_total{cache="MyCustomCache",hostname="localhost",result="miss",} 0.0 现在,仅显示我的自定义缓存的指标。此外,字段 cache_manager 不存在。 我的怀疑是,由于我手动注册缓存,一些谓词被 automagic 破坏了,并且它永远不会将自动生成的 EhCache 缓存添加到 MeterRegistry。 我想要同时拥有自定义缓存的指标以及隐式创建的 EhCache 缓存的指标。如果可能的话,我希望不必更改所使用的接口(即`com.google.common.cache.LoadingCache),以便对代码(并且老实说,对单元测试)进行最少的更改。有人知道问题可能是什么,或者我可能有什么解决方案吗? 这似乎与 Micrometer 中的一个长期错误有关:https://github.com/micrometer-metrics/micrometer/issues/877。 它在几年前就被修复了,但它仍然有副作用,其中每个指标名称必须具有相同的标签键集,否则有些不被考虑在内。 https://github.com/micrometer-metrics/micrometer/issues/877#issuecomment-944894069

回答 1 投票 0

java.lang.ClassNotFoundException:org.springframework.boot.actuate.health.HealthAggregator 将 spring-boot 版本从 2.3.12 RE 升级到 2.7.18

这是我无法加载应用程序的错误 引起原因:java.lang.NoClassDefFoundError:org/springframework/boot/actuate/health/HealthAggregator` 引起的:java.lang.

回答 1 投票 0

如何防止SqsListener发送垃圾邮件错误日志

我有一个使用 io.awspring.cloud.sqs SQS 侦听器的 Spring Boot 应用程序 @SqsListener(value = "${spring.cloud.aws.sqs.queue-name}",) 公共字符串 processSesEvent(EmailSqsMessage

回答 1 投票 0

无法使用执行器刷新来更新值配置服务器

当我尝试使用执行器/刷新刷新 git 上的配置服务器时遇到问题 这是我在配置客户端中使用的依赖项 依赖项{ 实现 'org.springframework.boot:sprin...

回答 1 投票 0

Spring-Boot-Actuator 端点 Prometheus 未正确显示

我想结合使用千分尺普罗米修斯和 spring-boot-actuator 来展示一些指标。我的项目完全基于 spring-boot,并且启用了执行器功能并映射到

回答 6 投票 0

Spring Boot 执行器/Swagger

我正在开发 Spring Boot 应用程序,我使用 Swagger 作为文档。 我已经在我的应用程序中添加了 Spring Boot Actuator,但现在我想添加由执行器创建的新服务 (/...

回答 6 投票 0

Actuator Spring Boot 的安全配置

最近我将 Spring Boot 版本从 2.5.2 更新到 3.1.5 ,之前我有这个安全配置 @豆 public SecurityFilterChain securityFilterChain(HttpSecurity http) 抛出 Exc...

回答 2 投票 0

Java Spring Boot 获取公开的执行器端点列表

我有一个在不同环境中运行的 Spring Boot 2.7 应用程序。根据环境的不同,会暴露不同的执行器端点(开发环境都暴露)。 实际...

回答 1 投票 0

RefreshScope 在重写 PropertySourcesPlaceholderConfigurer 时不起作用

根据我的要求,我想在创建 bean 之前更新配置属性。为此,我正在扩展 PropertySourcesPlaceholderConfigurer 并覆盖 loadProperties ...

回答 1 投票 0

按异常类型划分的 4xx/5xx 计数指标

我们已经设置了一个 spring-boot 服务,并且我们想按异常类型绘制 4xx/5xx 的量。 以下是我们正在使用的 Prom-QL :- 按(异常、uri、状态)求和(增加(

回答 1 投票 0

SpringBoot Actuator 版本 1.X 就绪性和活性探针

我正在探索激活 SpringBoot 1.X 的就绪性和活性探测器的选项。必须启用两个端点才能实现无缝 Kubernetes 部署。关于实现这一目标有什么见解吗? /

回答 1 投票 0

Spring Boot 3 - 执行器中缺少dispatcherServletRegistration bean

当我启动 Spring Boot 3.2.0 应用程序并调用运行状况端点时,我收到错误消息: java.lang.IllegalArgumentException:无法在

回答 2 投票 0

Spring 启动云 kubernetes - java.lang.IllegalArgumentException:未启用重新启动端点

我有一个带有 kubernetes 依赖项的 Spring Boot 微服务,用于配置映射和秘密支持。当前的 Spring Boot 版本是 2.3.9.RELEASE 。并且 kubernetes 依赖版本是 1.1.0.REL...

回答 1 投票 0

如何在 Swagger UI 中公开 Actuator 端点?

如何在 Swagger UI 中公开 Actuator 端点?我希望我能翻转表演执行器标志 弹簧文档: 招摇用户界面: 启用:真 路径:/swagger-ui 配置网址:/swagger-ui/confi...

回答 2 投票 0

尝试在根级别更改记录器级别

当我尝试通过根级别的执行器动态更改记录器时。通过这个curl -i -X POST -H 'Content-Type: application/json' -d '{"configuredLevel": "TRACE"}' http://

回答 1 投票 0

Spring Boot Prometheus 指标中无法解释的“root”uri

在 Spring Boot API 的 Prometheus 指标中,有一个非常神秘的根“端点”,有时似乎会被调用。这看起来像是有人在探测我们的 API,但端点却没有......

回答 3 投票 0

© www.soinside.com 2019 - 2024. All rights reserved.