Skip to content
Advertisement

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. But I use standart helidon handlers too (health and metrics):

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? I use:

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

Advertisement

Answer

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.
  2. Add your own implementation of the MicroProfile OpenAPI OASModelReader interface to your application that adds the health and metrics information programmatically. 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.

Unfortunately, there is not currently any automatic way to add OpenAPI information about health and metrics to your application’s OpenAPI document.

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.

Some relevant documents to get you started:

metrics:

health:

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement