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:
- Simply add the
/health
and/metrics
endpoint information to theopenapi.yml
file you already created. - 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:
- architecture: https://github.com/eclipse/microprofile-metrics/blob/2.3.2/spec/src/main/asciidoc/architecture.adoc
- REST endpoints: https://github.com/eclipse/microprofile-metrics/blob/2.3.2/spec/src/main/asciidoc/rest-endpoints.adoc
health: