简体   繁体   English

在 openapi 文件中添加 helidon 对象健康和指标

[英]Add in openapi file helidon objects health and metrics

I was write file openapi.yml wth openapi 3.0 description for services in my helidon project.我正在为我的 helidon 项目中的服务编写带有 openapi 3.0 描述的文件openapi.yml But I use standart helidon handlers too (health and metrics):但我也使用标准的 helidon 处理程序(健康和指标):

return Routing.builder()
   .register(JsonSupport.create())
   .register("/api/files", health)     
   .register("/api/files", metrics)    
   .register("/api/files/storage", fileService)
   .register("/api/files", OpenAPISupport.create(config))
   .build();

How make section for health and metrics in my openapi.yml?如何在我的 openapi.yml 中创建健康和指标部分? I use:我用:

<dependency>
   <groupId>io.helidon.openapi</groupId>
   <artifactId>helidon-openapi</artifactId>
   <version>1.3.1</version>
</dependency>

There are two ways you can do this:有两种方法可以做到这一点:

  1. Simply add the /health and /metrics endpoint information to the openapi.yml file you already created.只需将/health/metrics端点信息添加到您已经创建的openapi.yml文件中。
  2. Add your own implementation of the MicroProfile OpenAPI OASModelReader interface to your application that adds the health and metrics information programmatically.将您自己的 MicroProfile OpenAPI OASModelReader接口实现添加到以编程方式添加运行状况和指标信息的应用程序中。 You also set a configuration value to tell the system about your implementation.您还设置了一个配置值来告诉系统您的实现。 Please see https://helidon.io/docs/latest/index.html#/openapi/01_openapi for the details.有关详细信息,请参阅https://helidon.io/docs/latest/index.html#/openapi/01_openapi

Unfortunately, there is not currently any automatic way to add OpenAPI information about health and metrics to your application's OpenAPI document.不幸的是,目前还没有任何自动方法可以将有关运行状况和指标的 OpenAPI 信息添加到应用程序的 OpenAPI 文档中。

Further information (I seem to have misinterpreted the original question):更多信息(我似乎误解了原始问题):

The /metrics and /health endpoints are implemented by Helidon, but the MicroProfile Metrics and Health specifications dictate the paths for and the behavior of those endpoints. /metrics/health端点由 Helidon实现,但 MicroProfile Metrics 和 Health 规范规定了这些端点的路径和行为。

Some relevant documents to get you started:一些帮助您入门的相关文件:

metrics:指标:

health:健康:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM