Closed dbuos closed 3 years ago
@aclement Could you please have a look to this one when you have some time?
Sorting out the exact configuration to make it work is a long job. But I have confirmed it works fine if you use the agent to collect the full configuration and build with that.
Let's move that one to 0.9.1.
I tested with 0.9.1. I got the same issue, so I generated the reflect-config.json with mvn spring-boot:run "-Dspring-boot.run.jvmArguments=-agentlib:native-image-agent=config-output-dir=src/main/resources/META-INF/native-image"
.
Got an error type is not available in this platform: org.graalvm.compiler.hotspot.management.AggregatedMemoryPoolBean
.
I delete from reflect-config.json
{
"name":"org.graalvm.compiler.hotspot.management.AggregatedMemoryPoolBean",
"allPublicConstructors":true
},
{
"name":"org.graalvm.nativeimage.ImageInfo",
"methods":[{"name":"inImageCode","parameterTypes":[] }]
},
Now compilation is correct and prometheus endpoint is there. The final (native) artifact was ~30Mb heavier, so I try to do a big clean.
Removed jni-config.json
, native-image/proxy-config.json
, resource-config.json
, serialization-config.json
. The reflect-config.json
trimmed to
[
{
"name":"org.springframework.boot.actuate.metrics.export.prometheus.PrometheusScrapeEndpoint",
"allDeclaredFields":true,
"allDeclaredMethods":true
}
]
Still working, native artifact reduced by the ~30Mb previously added.
Ok we can probably add that hint in 0.9.2 then, thanks for the exploratory work.
I also added heath endpoint and info endpoint. Both are not discovered by default.
I had to add
{
"name":"org.springframework.boot.actuate.health.HealthEndpoint",
"allDeclaredFields":true,
"allDeclaredMethods":true
},
{
"name":"org.springframework.boot.actuate.info.InfoEndpoint",
"allDeclaredFields":true,
"allDeclaredMethods":true
}
Seems that metrics endpoint works only with this configuration
{
"name":"org.springframework.boot.actuate.metrics.MetricsEndpoint",
"allDeclaredFields":true,
"allDeclaredMethods":true
},
{
"name":"org.springframework.boot.actuate.metrics.MetricsEndpoint$MetricResponse",
"allDeclaredFields":true,
"allDeclaredMethods":true
},
{
"name":"org.springframework.boot.actuate.metrics.MetricsEndpoint$Sample",
"allDeclaredFields":true,
"allDeclaredMethods":true
},
{
"name":"org.springframework.boot.actuate.metrics.MetricsEndpoint$AvailableTag",
"allDeclaredFields":true,
"allDeclaredMethods":true
},
{
"name":"org.springframework.boot.actuate.metrics.MetricsEndpoint$ListNamesResponse",
"allDeclaredFields":true,
"allDeclaredMethods":true
}
@GregoireW:
Thanks for trimming down that config. I've added a hint for the PrometheusScrapeEndpoint
and upgraded the actuator-webmvc
sample to verify it is reachable.
I've also added a hint for the info endpoint and upgraded actuator-webmvc
sample.
I did not add a hint for the health endpoint, that's already covered, not quite sure why you had to add it? Let's deal with that in another bug if still a problem. (The actuator-webmvc
hits the health endpoint in its testing)
@prettymama
I've also added those to the metrics endpoint hints we already had (and expanded actuator-webmvc
to test it).
Now with all these changes I am verifying the endpoints are reachable, not verifying all potential data is available for the endpoints. Please raise new issues for further data within these that looks to be missing.
@aclement Out of curiosity, what did you add (and where) to have those hint ? there is no reflect-config.json
in spring aot but in the end there is a generated file. (too lazy to check that today)
anyway I checked, Not sure why I put the health endpoint. It was working from the start.
I check quickly and 0.9.2-SNAPSHOT fixes the issue. Thank you
When I build the app with the "io.micrometer:micrometer-registry-prometheus" dependency, this is supposed to enable prometheus scrapping endpoint, (when I run the jar in JVM it is).
But when I run the binary generated by graalvm native-image feature the prometheus endpoint is not registered and not available.