问题标签 [actuator]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
3 回答
624 浏览

spring-boot - SpringBoot 将上下文路径添加到 Actuator 端点

我通过将上下文路径设置为 /myservice 来运行我的 springboot 应用程序。这导致附加我在 URL- http://localhost:8080/myservice/actuator/ 上公开的所有执行器端点,而我只想要 http://localhost:8080/actuator/。有没有办法告诉 springboot 忽略附加到执行器端点的上下文路径(通过 DispatcherServlet 或 CXFServlet 或任何东西)请帮助。

0 投票
0 回答
240 浏览

spring - 如何在运行时刷新spring应用上下文?

  1. 如何在运行时刷新 Spring 应用程序上下文。
  2. 如何通过代码/运行时实现执行器/刷新后端点的相同行为?

我们通过实现 ApplicationContextAware 尝试了 applicationContext.refresh()。它在我的 Spring Boot 应用程序中给出了以下错误。

0 投票
1 回答
2598 浏览

spring-boot - SpringBoot - Metrics for HTTP response status code for Grafana dashboard

Small question regarding Spring Boot, and how to get the http response status code and display them into Grafana please.

Setup: a Java SpringBoot application at 2.5.1 (relevant to any SpringBoot 2.x.x). The app has actuator and micrometer dependencies. App generates prometheus metrics fine.

I am very interested in this one dashboard: The https response status code. Not the time elapsed, not the count, just the http status code response (responded with 200, 401, 503, etc). Because of the dependencies, I see those metrics!

http_server_requests_seconds

Hence, I first tried this:

increase(http_server_requests_seconds{_ws_="my_workspace",_ns_="my_namespace",_source_="my_source", _bucket_="+Inf"}[15m])

This seems to yield something:

enter image description here

I am able to see some http 200, some http 503. But for some reason, I am also seeing not only one 200, but bunch of them with what seems to be a time elapsed.

My question is, the query is not correct? What would be the most appropriate query in order to get the different http status code response over time please?

Most of all, what would be the best visualization dashboard to represents the difference HTTP status code response?

Thank you

0 投票
1 回答
1053 浏览

spring-boot - SpringBoot - *_max *_count *_sum 指标的可观察性

关于 Spring Boot 的小问题,一些有用的默认指标,以及如何在 Grafana 中正确使用它们。

目前使用带有 Actuator + Micrometer + Prometheus 依赖项的 Spring Boot 2.5.1+(适用于 2.xx 的问题),有很多非常方便的默认指标开箱即用。

我看到他们中的许多人带有 pattern _max _count _sum

举几个例子:

不幸的是,我不确定如何处理它们,如何正确使用它们,并且觉得我的无知让我错过了一些很棒的应用程序见解。

在网上搜索,我看到一些使用这样的方法来计算 Grafana 的平均值:

但不确定这是否是使用这些的正确方法。

请问有哪些类型的查询是可能的,通常在处理类型指标时使用_max _count _sum

谢谢

0 投票
0 回答
195 浏览

java - Spring Webflux Actuator Micrometer - process_files_open_files VS process_files_max_files

请快速询问有关具有 Actuator 和 Micrometer 依赖项的 Spring Boot Webflux Web 应用程序的问题。

/prometheusor/metrics端点上,我看到了许多有趣的默认开箱即用指标。

我对两个指标特别感兴趣:

我的当前值process_files_open_files类似于 63,一个固定值。它在这个数字附近保持了几天。

令人惊讶的是process_files_max_files,价值约为 100 万(1 100 000)。

这尤其令人惊讶,因为我什至认为容器本身没有那么多文件。它是一个非常轻量级的 java 容器。

因此,我的问题是,这个指标代表什么?为什么这个数字如此之高?

谢谢

0 投票
1 回答
290 浏览

prometheus - Grafana 中的 CPU 指标,用于带有 Actuator Micrometer 和 Prometheus 的 Spring Webflux 应用程序

请关于如何构建 CPU 指标的视觉和洞察力的小问题。

我有一个 Spring Boot Webflux 应用程序,没什么特别的。我引入了 Actuator、Micrometer 和 Prometheus 依赖项。

该应用程序具有开箱即用的 CPU 指标,我认为这非常酷。我也相信这些指标包含大量信息。不幸的是,我认为不了解 Grafana 或指标本身以充分释放其潜力。

指标是:

不知道如何正确使用它们,我使用那些非常基本的菜鸟查询:

有了这些,我确实得到了一些结果。问题是,我得到的只是一些平坦的线条,无法采取进一步的见解或行动。

我在网上看到一些更复杂的查询,例如

或者一些使用delta rate irate. 但不确定他们来这里是为了什么。

使用这些指标的正确方法是什么,以及我当前的查询有什么问题,因为现在和有意义的指标之间存在差距。

谢谢你。

0 投票
1 回答
699 浏览

java - 如何在 Java Spring 中排除某些 HTTP 请求(例如 /health Endpoint)

在我的 Spring Boot 应用程序中,以下设置:

导致记录所有 HTTP 请求,这很酷!

但是,由于不断轮询 /health 端点,这会向日志文件发送垃圾邮件。如何仅为此端点禁用请求日志记录?

0 投票
0 回答
129 浏览

spring-boot - 为 Spring boot 2.5.3 配置管理 HTTP、Server HTTPS 使用相同的动态端口

在您可以使用相同的动态端口Spring boot 2.3.8-RELEASE公开管理执行器HTTP和服务器。HTTPS当我升级到Spring boot 2.5.3时,管理执行器暴露在上面HTTPS。Consul 健康检查失败,因为它使用HTTP而不是HTTPS在主服务器和管理的同一动态端口上。

那么Spring boot 2.5.3,如何配置管理执行器端点以使用HTTP并具有与服务器相同的动态端口?

有什么帮助或想法吗?

此配置禁用执行器端点 HTTP 或 HTTPS

此配置通过 HTTPS 而不是 HTTP 启用执行器

0 投票
0 回答
61 浏览

spring - 当 spring Vault 更新令牌不起作用时重新启动 pod

我正在使用 spring cloud vault 来处理与数据库的连接。当令牌更新大于最大 ttl 数据库角色时存在一个已知问题,我们收到错误 org.springframework.vault.client.VaultException: Cannot renew lease: Status 403

如果我们遇到这个问题,是否可以使用 spring actuator 和 kubernetes liveness probe 来拦截这个错误并重新启动 pod?spring Vault 执行器标志是否足以处理这种情况,还是我需要使用另一个执行器端点?

谢谢

0 投票
1 回答
154 浏览

java - 一个类的多个 bean 实例填充了 application.properties 中的值

我打算使用spring-boot-actuatorHealtCheckContributors为 Spring Boot 应用程序编写一些内容。因此,我实现了其中两个。当然,它们旨在检查不同应用程序的运行状况,但具有几乎相同的结构,除了配置属性,...

SonarQube 对此抱怨,我想知道是否可以有一个单一的健康检查类,但实例化的次数与application.properties. 一个例子:

application.properties

HealthCheckContributor对于应用程序1:

...并且此代码HealthCheckContributor仅在其appXProperties中有所不同。

不可能有某种基类,如:

并让 Spring Boot 负责实例化两个HealthCheckContributors(在我们的例子中App1HealthCheckContributorApp2HealthCheckContributor)?这将消除代码重复。

属性类文件的示例:

我怎样才能做到这一点以及application.properties文件看起来如何才能实现我打算做的事情?

最后一个问题:如何测试一个类的 bean 的多个实例创建,其中填充了 application.properties 中的值?