-
Notifications
You must be signed in to change notification settings - Fork 129
Set metrics address and port for EPR container #885
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🌐 Coverage report
|
|
/test |
| PROFILE: "${PROFILE_NAME}" | ||
| healthcheck: | ||
| test: ["CMD", "curl", "--cacert", "/etc/ssl/package-registry/ca-cert.pem", "-f", "https://localhost:8080"] | ||
| test: ["CMD", "curl", "--cacert", "/etc/ssl/package-registry/ca-cert.pem", "-f", "https://localhost:8080/health"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see there is a /health endpoint available in package-registry:
https://github.com/elastic/package-registry/blob/3fb8bf5ab9b2d4dfc681f5059d21eb4c79f480c5/main.go#L291
It's an empty handler, would it be ok to replace here the healthcheck ? Would it return 200 even when the app is still loading ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, definitely a good idea. I think that you can expand the healthcheck logic to return HTTP 200 if packages.Get returns a positive number of packages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even if the package-registry (indexer) returns zero packages, it could be a valid scenario, couldn't it ? It would be the case where there are no packages to be served, but the service is running without errors
And if the indexer fails, IIRC the service exits.
Regarding this endpoint, I've performed some quick tests, and this health endpoint fails (as requests to / do) until the service has loaded all the packages:
$ curl -k -v https://localhost:8080/health
* Trying 127.0.0.1:8080...
* Connected to localhost (127.0.0.1) port 8080 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
* CAfile: /etc/ssl/cert.pem
* CApath: none
* (304) (OUT), TLS handshake, Client hello (1):
* LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to localhost:8080
* Closing connection 0
curl: (35) LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to localhost:8080
The server starts running after all the packages have been read/validated and loaded. So IIRC if the service is live, then it is also ready, isn't it?
For now, I will revert this change and in this PR I will just set the ports and environment variables needed to enable/use Prometheus metrics.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even if the package-registry (indexer) returns zero packages, it could be a valid scenario, couldn't it ? It would be the case where there are no packages to be served, but the service is running without errors
And if the indexer fails, IIRC the service exits.
Well, yes and no. We perform a dry-run validation to make sure that there are any packages, so I would say that we should expect from healthcheck a similar behavior.
and this health endpoint fails (as requests to / do) until the service has loaded all the packages:
I think that the HTTP server starts after loading packages.
|
/test |
Relates elastic/package-registry#797
Blocked by elastic/package-registry#827 , elastic/package-registry#842
Set the required settings (URL and port) to be able to scrape metrics from the Package Registry.