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

Added param options to /healthz endpoint #3326

Merged
merged 1 commit into from
Aug 9, 2022

Conversation

mfaizanse
Copy link
Contributor

@mfaizanse mfaizanse commented Aug 3, 2022

  • Link to issue, e.g. Resolves #NNN
  • Documentation added (if applicable)
  • Tests added
  • Branch rebased on top of current main (git pull --rebase origin main)
  • Changes squashed to a single commit (described here)
  • Build is green in Travis CI
  • You have certified that the contribution is your original work and that you license the work to the project under the Apache 2 license

Related to # nats-io/k8s#541
Resolves # The JetStream portion of #2687

Changes proposed in this pull request:

  • Added /healthz?js-enabled=true to return error if JetStream is disabled.
  • Added /healthz?js-server-only=true to skip checking of JetStream accounts, streams and consumers.

/cc @nats-io/core

Copy link
Member

@kozlovic kozlovic left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution. Would you mind adding a test for the Healthz system changes, probably in test TestServerEventsPingMonitorz()? Also asking @matthiashanel for help reviewing the system event change. It looks ok to me, but would want to make sure.

server/monitor.go Outdated Show resolved Hide resolved
@kozlovic kozlovic requested a review from matthiashanel August 4, 2022 15:22
@mfaizanse mfaizanse force-pushed the health_endpoint_params branch from d5ae6c0 to 0134fff Compare August 5, 2022 12:54
server/jetstream_helpers_test.go Outdated Show resolved Hide resolved
server/jetstream_helpers_test.go Outdated Show resolved Hide resolved
server/jetstream_test.go Outdated Show resolved Hide resolved
server/jetstream_test.go Outdated Show resolved Hide resolved
server/monitor.go Show resolved Hide resolved
server/monitor.go Show resolved Hide resolved
@mfaizanse mfaizanse force-pushed the health_endpoint_params branch 2 times, most recently from 07bbc22 to 467a9a2 Compare August 8, 2022 14:38
Copy link
Member

@kozlovic kozlovic left a comment

Choose a reason for hiding this comment

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

A little typo and some tweak to the test and we should be good to go. Thanks!

defer s.Shutdown()

if s.JetStreamEnabled() {
t.Fatalf("Expected JetStream to be disbaled")
Copy link
Member

Choose a reason for hiding this comment

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

Typo here that causes our checks to fail:

./server/jetstream_test.go:17518:37: "disbaled" is a misspelling of "disabled"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

@@ -17508,6 +17508,25 @@ func TestJetStreamWorkQueueSourceNamingRestart(t *testing.T) {
}
}

func TestJetStreamDisabledHealthz(t *testing.T) {
s := RunRandClientPortServer()
if config := s.JetStreamConfig(); config != nil {
Copy link
Member

Choose a reason for hiding this comment

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

Not necessary since you are not configuring a server with JetStream.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed

Copy link
Member

@kozlovic kozlovic left a comment

Choose a reason for hiding this comment

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

LGTM

@kozlovic kozlovic merged commit a4bf4e8 into nats-io:main Aug 9, 2022
@mfaizanse mfaizanse deleted the health_endpoint_params branch August 10, 2022 13:29
derekcollison added a commit that referenced this pull request Sep 1, 2023
Follow up from #4437 content-type fix for v2.9.22, some fixes to the
response from `/healthz` for dev:

- In #[3326](#4097) it was
changed to return 500 status when before we used to return 503 so this
changes it back.
- Also as part of #3326 we started to return `status_code` in the
healthz response (e.g `{"status":"ok","status_code":200}`) so this
removes it for http responses just relying on the http header.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants