-
Notifications
You must be signed in to change notification settings - Fork 55
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 HealthInfo #327
Added HealthInfo #327
Conversation
efda775
to
90d25f2
Compare
service/api/handler.go
Outdated
resp := h.svc.ApiInfoHealth(c.Request.Context()) | ||
c.JSON(http.StatusOK, resp) | ||
|
||
return // why do we have explicit returns at end of function though? |
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.
oh it's just a convention to make it obvious. nothing too important.
service/api/service.go
Outdated
func (s *serviceImpl) ApiInfoHealth(ctx context.Context) *iwfidl.HealthInfo { | ||
return &iwfidl.HealthInfo{ | ||
Condition: iwfidl.PtrString("OK"), | ||
Hostname: iwfidl.PtrString("will check"), |
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.
It would be nice if you can use os.Hostname()
to get the hostname
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.
Please check
there is a flaky test issue that I just fixed. If rebase to the latest commit the pass should pass for you |
90d25f2
to
0d3edff
Compare
@@ -683,6 +684,18 @@ func (s *serviceImpl) ApiV1WorkflowDumpPost(ctx context.Context, request iwfidl. | |||
}, nil | |||
} | |||
|
|||
func (s *serviceImpl) ApiInfoHealth(ctx context.Context) *iwfidl.HealthInfo { | |||
hostName, err := os.Hostname() | |||
if err != nil { |
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.
Let’s swallow this error here and put a default message like host name not available. Because it’s not worth returning error here
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.
That's what I did 🤔
You mean changing "Hostname Not Available" to "host name not available"?
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.
Ohh sorry i misread it on my phone
@@ -683,6 +684,18 @@ func (s *serviceImpl) ApiV1WorkflowDumpPost(ctx context.Context, request iwfidl. | |||
}, nil | |||
} | |||
|
|||
func (s *serviceImpl) ApiInfoHealth(ctx context.Context) *iwfidl.HealthInfo { | |||
hostName, err := os.Hostname() | |||
if err != nil { |
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.
Ohh sorry i misread it on my phone
No description provided.