Skip to content

Commit

Permalink
Add debug logging
Browse files Browse the repository at this point in the history
  • Loading branch information
dehort committed Jan 18, 2024
1 parent b3b3ab8 commit 642cb1c
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion internal/api/controllers/private/highlevelConnectionStatus.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ func (this *controllers) ApiInternalHighlevelConnectionStatus(ctx echo.Context)
this.config.GetInt("inventory.connector.offset"),
)

utils.GetLogFromEcho(ctx).Infow("returned from inventory", "data", hostConnectorDetails, "error", err)

if err != nil {
utils.GetLogFromEcho(ctx).Error(err)
return ctx.NoContent(http.StatusBadRequest)
Expand All @@ -55,12 +57,15 @@ func (this *controllers) ApiInternalHighlevelConnectionStatus(ctx echo.Context)
}

if satellite == nil && directConnected == nil {
utils.GetLogFromEcho(ctx).Infow("no satellite or direct connected systems", "data", noRHCResponses)
return ctx.JSON(http.StatusOK, noRHCResponses)
}

if len(satellite) > 0 {
satelliteResponses, err = getSatelliteStatus(ctx, this.cloudConnectorClient, this.sourcesConnectorClient, input.OrgId, satellite)

utils.GetLogFromEcho(ctx).Infow("satellite status", "data", satelliteResponses, "error", err)

if err != nil {
utils.GetLogFromEcho(ctx).Errorf("Error retrieving Satellite status: %s", err)
}
Expand All @@ -69,12 +74,18 @@ func (this *controllers) ApiInternalHighlevelConnectionStatus(ctx echo.Context)
if len(directConnected) > 0 {
directConnectedResponses, err = getDirectConnectStatus(ctx, this.cloudConnectorClient, input.OrgId, directConnected)

utils.GetLogFromEcho(ctx).Infow("direct connect status", "data", directConnectedResponses, "error", err)

if err != nil {
utils.GetLogFromEcho(ctx).Errorf("Error retrieving Direct Connect status: %s", err)
}
}

return ctx.JSON(http.StatusOK, HighLevelRecipientStatus(concatResponses(satelliteResponses, directConnectedResponses, noRHCResponses)))
highLevelStatus := HighLevelRecipientStatus(concatResponses(satelliteResponses, directConnectedResponses, noRHCResponses))
utils.GetLogFromEcho(ctx).Infow("returning high level status", "data", highLevelStatus)
return ctx.JSON(http.StatusOK, highLevelStatus)

//return ctx.JSON(http.StatusOK, HighLevelRecipientStatus(concatResponses(satelliteResponses, directConnectedResponses, noRHCResponses)))
}

func sortHostsByRecipient(details []inventory.HostDetails) (satelliteDetails []inventory.HostDetails, directConnectedDetails []inventory.HostDetails, noRhc []inventory.HostDetails) {
Expand Down

0 comments on commit 642cb1c

Please sign in to comment.