Skip to content
This repository has been archived by the owner on Feb 23, 2023. It is now read-only.

Actuator prometheus endpoint not get registered #423

Closed
dbuos opened this issue Dec 20, 2020 · 9 comments
Closed

Actuator prometheus endpoint not get registered #423

dbuos opened this issue Dec 20, 2020 · 9 comments
Assignees
Labels
type: compatibility Native image compatibility issue
Milestone

Comments

@dbuos
Copy link

dbuos commented Dec 20, 2020

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.

@sdeleuze sdeleuze added this to the 0.9.0 milestone Jan 5, 2021
@sdeleuze
Copy link
Contributor

sdeleuze commented Jan 5, 2021

@aclement Could you please have a look to this one when you have some time?

@sdeleuze sdeleuze added the type: compatibility Native image compatibility issue label Jan 8, 2021
@aclement
Copy link
Contributor

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.

@sdeleuze
Copy link
Contributor

sdeleuze commented Feb 3, 2021

Let's move that one to 0.9.1.

@sdeleuze sdeleuze modified the milestones: 0.9.0, 0.9.1 Feb 3, 2021
@sdeleuze sdeleuze modified the milestones: 0.9.1, 0.10.0 Mar 10, 2021
@GregoireW
Copy link
Contributor

GregoireW commented Mar 31, 2021

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.

@sdeleuze sdeleuze modified the milestones: 0.11.0, 0.9.2 Apr 1, 2021
@sdeleuze
Copy link
Contributor

sdeleuze commented Apr 1, 2021

Ok we can probably add that hint in 0.9.2 then, thanks for the exploratory work.

@GregoireW
Copy link
Contributor

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
  }

@sdeleuze sdeleuze assigned sdeleuze and unassigned aclement Apr 1, 2021
@prettymama
Copy link

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
}

@aclement
Copy link
Contributor

aclement commented Apr 5, 2021

@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 aclement closed this as completed Apr 5, 2021
@aclement aclement assigned aclement and unassigned sdeleuze Apr 5, 2021
@GregoireW
Copy link
Contributor

@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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: compatibility Native image compatibility issue
Development

No branches or pull requests

5 participants