quarkusio / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
13.66k stars 2.65k forks source link

amazon-lambda cannot start with micrometer-registry-prometheus #37467

Open rndtavares opened 10 months ago

rndtavares commented 10 months ago

Describe the bug

Quarkus app do not start when adding the quarkus-micrometer-registry-prometheus dependency in an application with the quarkus-amazon-lambda dependency

Expected behavior

I want to use micrometer to create my own metric with gauges https://quarkus.io/guides/telemetry-micrometer#gauges

Actual behavior

Cant't start my quarkus-amazon-lambda app local when the quarkus-micrometer-registry-prometheus is added

How to Reproduce?

simple project with just quarkus-amazon-lambda and quarkus-micrometer-registry-prometheus dependencies https://github.com/rndtavares/lambdatest

Output of uname -a or ver

No response

Output of java -version

No response

Quarkus version or git rev

No response

Build tool (ie. output of mvnw --version or gradlew --version)

No response

Additional information

No response

quarkus-bot[bot] commented 10 months ago

/cc @brunobat (micrometer), @ebullient (micrometer), @matejvasek (amazon-lambda), @patriot1burke (amazon-lambda)

rndtavares commented 10 months ago

the error is (Quarkus Main Thread) Port 8080 seems to be in use by another process. Quarkus may already be running or the port is used by another application. when changing the lambda defaut port to quarkus.http.port=8090 the app starts ok

ebullient commented 10 months ago

You might consider configuring the management port (so prometheus listener moves), rather than changing the lambda port.

Prometheus is a scrape protocol (requires a listener). Lambda's are usually short lived.. is prometheus the best option? Should you be thinking about a push form instead? You can use micrometer and gauges without prometheus.

rndtavares commented 10 months ago

I checked here that I need to implement a custom metric with open telemetry registry (otlp), I am using the dependency:

implementation "io.quarkiverse.micrometer.registry:quarkus-micrometer-registry-otlp:3.2.4"

and the config

quarkus.micrometer.export.otlp.enabled=true quarkus.micrometer.export.otlp.publish=true quarkus.micrometer.export.otlp.url=http://mycollector:4318/v1/metrics but still need to change the lambda port, how can I disable or change the micrometer server port?

rndtavares commented 10 months ago

it works only when I changed the quarkus.lambda.mock-event-server.dev-port and quarkus.lambda.mock-event-server.test-port, just changing the management port don't work and I didn't found a config to disable the micrometer http server or change directly the micrometer otlp default port

brunobat commented 9 months ago

Lambda functions shouldn't use the micrometer-registry-prometheus extension but choose quarkus-micrometer-registry-OTLP. That extension will not publish a scrape endpoint. I'm inclined to close this issue as a won't do.