标签: spring-boot-actuator

在springboot管理UI中注册Dropwizard(Spring MVC)应用程序

我有一个使用spring MVC和Dropwizard开发的REST API.我使用Dropwizard框架创建了健康检查.现在我看看如何将此API注册到Springboot管理员,以便我可以在管理UI上查看所有指标.

我有其他API使用Springboot开发.因此,将它们注册到Springboot管理员非常简单.但在另一个Dropwizard案例中,我无法注册,也不确定是否需要进行任何额外配置.

期待回应.谢谢

spring-mvc dropwizard spring-boot spring-boot-actuator spring-boot-admin

7
推荐指数
0
解决办法
178
查看次数

将"mean","min"或"百分位数"添加到Spring Boot 2指标中?

我在Spring Boot 2版本中使用了新的MicroMeter指标.2.0.0-RELEASE

通过/actuator/metrics/{metric.name}端点发布指标时,我得到以下内容:

对于DistributionSummary:

"name": "sources.ingestion.rate",
    "measurements": [
        {
           "statistic": "COUNT",
            "value": 5
        },
        {
            "statistic": "TOTAL",
            "value": 72169.44162067816
        },
        {
            "statistic": "MAX",
            "value": 17870.68010661754
        }
    ],
    "availableTags": []
}
Run Code Online (Sandbox Code Playgroud)

对于Timer:

{
    "name": "sources.ingestion",
    "measurements": [
        {
            "statistic": "COUNT",
            "value": 5
        },
        {
            "statistic": "TOTAL_TIME",
            "value": 65.700878648
        },
        {
            "statistic": "MAX",
            "value": 22.661545322
        }
    ],
    "availableTags": []
}
Run Code Online (Sandbox Code Playgroud)

是否可以丰富测量值以增加平均值,最小值百分位数度量? …

java spring-boot spring-boot-actuator micrometer

7
推荐指数
1
解决办法
920
查看次数

执行器普罗米修斯的自定义指标

我已经激活了弹簧执行器prometheus endpont /actuator/prometheus.通过添加千分尺和执行器的依赖关系并启用prometheus endpont.我如何获得自定义指标?

java metrics spring-boot spring-boot-actuator prometheus

7
推荐指数
1
解决办法
4636
查看次数

Spring执行器http.server.requests统计数据的单位是什么

我已经使用 实现了服务spring-boot-starter-2.0.0.RELEASE。我已经为其启用了执行器指标,但是我无法理解指标以什么单位表示。具体来说,我对http.server.requests.

端点的输出示例为:

{
    "name": "http.server.requests",
    "measurements": [
        {
            "statistic": "COUNT",
            "value": 2
        },
        {
            "statistic": "TOTAL_TIME",
            "value": 0.049653001
        },
        {
            "statistic": "MAX",
            "value": 0.040696019
        }
    ],
    "availableTags": [
        {
            "tag": "exception",
            "values": [
                "None"
            ]
        },
        {
            "tag": "method",
            "values": [
                "GET"
            ]
        },
        {
            "tag": "status",
            "values": [
                "200"
            ]
        }
    ]
}
Run Code Online (Sandbox Code Playgroud)

spring metrics spring-boot spring-boot-actuator

6
推荐指数
1
解决办法
3559
查看次数

是否有办法从 AsyncResttemplate 获取 http.client.requests 指标?

我正在尝试通过千分尺和普罗米修斯监控我的 Spring Boot 应用程序的其余模板指标。当我使用 ResttemplateBuilder 构建的 Resttemplate 并用于调用另一个 api 时,它确实获得了预期的 http.client.requests 指标。但是对于 AsyncResttemplate,当我使用 AsyncResttemplate 创建并使用它来调用另一个 api 时,它没有提供任何 http.client.requests 指标。

这是我创建 AsyncResttemplate bean 时的代码

    @Bean
    public AsyncRestTemplate asyncRestTemplate(){
        return new AsyncRestTemplate();
    }
Run Code Online (Sandbox Code Playgroud)

这是我使用异步调用另一个 api 时的代码

    public ListenableFuture async() {
        ListenableFuture<ResponseEntity<AccountResponse>> accountResponseList = asyncRestTemplate.exchange(accountUrl, HttpMethod.GET, new HttpEntity<>(new HttpHeaders()), AccountResponse.class);
        accountResponseList.addCallback(new ListenableFutureCallback<ResponseEntity<AccountResponse>>() {
            @Override
            public void onSuccess(ResponseEntity<AccountResponse> accountResponseResponseEntity) {
                System.out.println("Success");
            }

            @Override
            public void onFailure(Throwable throwable) {
                System.out.println("Failure");
            }
        });
        return accountResponseList;
    }
Run Code Online (Sandbox Code Playgroud)

这些是pom.xml中导入的相关依赖项

<dependency>
      <groupId>io.micrometer</groupId>
      <artifactId>micrometer-registry-prometheus</artifactId>
</dependency>
<dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
Run Code Online (Sandbox Code Playgroud)

这是我期望从微米普罗米修斯指标中获得的结果 …

java spring-boot spring-boot-actuator spring-micrometer

6
推荐指数
1
解决办法
6707
查看次数

Spring Boot执行器健康端点+动态弹性4j断路器

我有一个 Spring Boot 应用程序,它使用基于resilience4j AOP 的@CircuitBreakers。

现在我想在端点中提供断路器的信息/actuator/health,但我没有在 JSON 输出中看到文档中描述的details.circuitBtreakers对象。

我究竟做错了什么?


相比之下,让动态缓存信息出现在/actuator/metrics端点中需要少量的自定义连接,但这是有详细记录的。我想知道是否有类似的技巧可以应用于动态定义的@CircuitBreaker端点注册/actuator/health

MyService.java:

@Service
public class MyService {
    @Autowired
    private CacheManager cacheManager;
    @Autowired
    private CacheMetricsRegistrar cacheMetricsRegistrar;

    @PostConstruct
    public void postConstruct() {
        // On-the-fly defined (annotation-based) caches are not auto-registered with micrometer metrics.
        final Cache cache = cacheManager.getCache("myCache");
        cacheMetricsRegistrar.bindCacheToRegistry(cache);
    }

    @CircuitBreaker(name = "myCB", fallbackMethod = "fallbackCallAnApi")
    public String callAnApi() throws RestClientException {
        // ...
    } …
Run Code Online (Sandbox Code Playgroud)

java spring-boot spring-boot-actuator resilience4j

6
推荐指数
1
解决办法
8366
查看次数

Spring Boot 2执行器缓存指标

我在 sprint boot 2 执行器中找不到缓存指标。我应该如何查询它们或激活或调试?

org.springframework.boot:spring-boot-starter-actuator:2.2.5.RELEASE

我可以在http://localhost:8080/actuator/caches ->下看到两个缓存

{
  "cacheManagers": {
    "cacheManager": {
      "caches": {
        "calendar": {
          "target": "org.ehcache.jsr107.Eh107Cache"
        },
        "foo": {
          "target": "org.ehcache.jsr107.Eh107Cache"
        }
      }
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

ehcache.xml:


<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns="http://www.ehcache.org/v3"
        xmlns:jsr107="http://www.ehcache.org/v3/jsr107"
        xsi:schemaLocation="
            http://www.ehcache.org/v3 http://www.ehcache.org/schema/ehcache-core-3.0.xsd
            http://www.ehcache.org/v3/jsr107 http://www.ehcache.org/schema/ehcache-107-ext-3.0.xsd">
    <cache alias="calendar" >
        <expiry>
            <ttl unit="seconds">60</ttl>
        </expiry>
        <resources>
            <heap unit="entries">2</heap>
            <offheap unit="MB">100</offheap>
        </resources>
    </cache>
    <cache alias="foo" >
        <expiry>
            <ttl unit="seconds">60</ttl>
        </expiry>
        <resources>
            <heap unit="entries">2</heap>
            <offheap unit="MB">100</offheap>
        </resources>
    </cache>
</config>
Run Code Online (Sandbox Code Playgroud)

我在http://localhost:8080/actuator/metrics/下看不到缓存、日历或 foo (其他指标如“jvm.memory.max”可见)

相似地

http://localhost:8080/actuator/metrics/cache.calendar.size

http://localhost:8080/actuator/metrics/cache.calendar.gets

http://localhost:8080//actuator/metrics/cache.gets

不返回任何内容。

如何获取缓存指标?

http://localhost:8080/actuator/metrics/cache?tag=calendar:size也不返回任何内容,在日志中我可以看到: …

spring ehcache spring-boot spring-boot-actuator

6
推荐指数
1
解决办法
2728
查看次数

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

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

contextpath spring-boot spring-boot-actuator

6
推荐指数
1
解决办法
3293
查看次数

Grafana 仪表板的 HTTP 响应状态代码指标

关于 Spring Boot 的问题,以及如何获取 HTTP 响应状态代码并将其显示到 Grafana 中。

设置:2.5.1 版本的 Java Spring Boot 应用程序(与任何 Spring Boot 2.xx 相关)。该应用程序具有执行器和千分尺依赖性。应用程序可以正常生成 Prometheus 指标。

我对这个仪表板非常感兴趣:HTTP 响应状态代码。不是经过的时间,不是计数,只是 HTTP 状态代码响应(以 200、401、503 等响应)。由于依赖性,我看到了这些指标!

http_server_requests_seconds

因此,我首先尝试了这个:

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

这似乎产生了一些东西:

在此输入图像描述

我可以看到一些 HTTP 200,一些 HTTP 503,但由于某种原因,我不仅看到一个 200,而且看到一堆似乎已经过去了一段时间的内容。

这个查询正确吗?为了随着时间的推移获得不同的 HTTP 状态代码响应,最合适的查询是什么?

最重要的是,代表 HTTP 状态代码响应差异的最佳可视化仪表板是什么?

spring-boot grafana spring-boot-actuator prometheus

6
推荐指数
1
解决办法
1万
查看次数

如何使用 Spring Actuator 配置 Kubernetes 启动探针

我已经阅读了一些文档,并弄清楚了如何使用 Actuator 设置就绪和活跃端点,就像这个一样。但我无法弄清楚如何设置“启动”探针的端点。

我的应用程序yml:

management:
  endpoints:
    web:
      exposure:
        include: "*"
  endpoint:
    health:
      show-details: "ALWAYS"
      group:
        readiness.include: readinessProbe, dataStream
        startup.include: readinessProbe, dataStream
Run Code Online (Sandbox Code Playgroud)

我的部署配置:

  livenessProbe:
    httpGet:
      path: "/actuator/health/liveness"
      port: "http"
    initialDelaySeconds: 600
    periodSeconds: 15
  readinessProbe:
    httpGet:
      path: "/actuator/health/readiness"
      port: "http"
    periodSeconds: 30
    failureThreshold: 15
  startupProbe:
    httpGet:
      path: "/actuator/health/startup"
      port: "http"
    initialDelaySeconds: 150
    periodSeconds: 10
    failureThreshold: 30
Run Code Online (Sandbox Code Playgroud)

执行器似乎没有提供“启动”探针的 URL,或者换句话说,http://localhost:8080/actuator/health/startup 不起作用。我该如何设置?

startup spring-boot kubernetes spring-boot-actuator readinessprobe

6
推荐指数
1
解决办法
8478
查看次数