Skip to content
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

Ignore accept header in requests to metrics service #1345

Merged
merged 4 commits into from
Aug 27, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Spotless.
Signed-off-by: Adrian Sutton <[email protected]>
  • Loading branch information
ajsutton committed Aug 27, 2020
commit 1d2dc7e91fb81353f7d693e2758f2f979749026f
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,7 @@ public CompletableFuture<?> start() {
router.route("/").method(HttpMethod.GET).handler(this::handleEmptyRequest);

// Endpoint for Prometheus metrics monitoring.
router
.route("/metrics")
.method(HttpMethod.GET)
.handler(this::metricsRequest);
router.route("/metrics").method(HttpMethod.GET).handler(this::metricsRequest);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe just check for "text/plain" instead of completely dropping Prometheus' very specific version?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given we only have one representation to offer we shouldn't be doing any content negotiation (which is what the Accept header is for). If we had multiple representations, then yes filtering to a particular Accept makes sense but if there's a default version, it should just be returned even if it doesn't match Accept.

For example this works fine:

curl --fail -v -H 'Accept: foo/foo' https://www.google.com/

The caller can then decide if they want to process the response based on the Content-Type header.


final CompletableFuture<?> resultFuture = new CompletableFuture<>();
httpServer
Expand Down