Skip to content

Commit

Permalink
feat: add hostname in status
Browse files Browse the repository at this point in the history
  • Loading branch information
moul committed Jun 21, 2020
1 parent a8bacb3 commit 7f581d6
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 18 deletions.
1 change: 1 addition & 0 deletions api/bounce.proto
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@ message Status {
message Request {}
message Response {
int32 uptime = 1;
string hostname = 2;
}
}
5 changes: 4 additions & 1 deletion pkg/bounce/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package bounce

import (
"context"
"os"
"time"

"moul.io/bounce/pkg/bouncepb"
Expand All @@ -12,7 +13,9 @@ func (svc *Service) Ping(context.Context, *bouncepb.Ping_Request) (*bouncepb.Pin
}

func (svc *Service) Status(context.Context, *bouncepb.Status_Request) (*bouncepb.Status_Response, error) {
hostname, _ := os.Hostname()
return &bouncepb.Status_Response{
Uptime: int32(time.Since(svc.startedAt).Seconds()),
Uptime: int32(time.Since(svc.startedAt).Seconds()),
Hostname: hostname,
}, nil
}
44 changes: 27 additions & 17 deletions pkg/bouncepb/bounce.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7f581d6

Please sign in to comment.