Skip to content

Commit

Permalink
add last seen
Browse files Browse the repository at this point in the history
Signed-off-by: SammyOina <sammyoina@gmail.com>
  • Loading branch information
SammyOina committed Mar 27, 2023
1 parent 19c5592 commit 71b01d2
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions internal/homing/homing.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ func (hs *homingService) CallHome(ctx context.Context) {
var err error
data.Service = hs.serviceName
data.Version = hs.version
data.LastSeen = time.Now()
for _, endpoint := range ipEndpoints {
data.IpAddress, err = getIP(endpoint)
if err != nil {
Expand Down Expand Up @@ -79,9 +80,10 @@ func (hs *homingService) Stop() {
}

type telemetryData struct {
Service string `json:"service"`
IpAddress string `json:"ip_address"`
Version string `json:"mainflux_version"`
Service string `json:"service"`
IpAddress string `json:"ip_address"`
Version string `json:"mainflux_version"`
LastSeen time.Time `json:"last_seen"`
}

func getIP(endpoint string) (string, error) {
Expand Down

0 comments on commit 71b01d2

Please sign in to comment.