Skip to content

Commit

Permalink
Log contents of target objects in loadbalancer
Browse files Browse the repository at this point in the history
  • Loading branch information
Lars Ekman committed Feb 7, 2023
1 parent 6538230 commit 3b129ed
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/loadbalancer/stream/loadbalancer.go
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ func (lb *LoadBalancer) removeFromPendingTarget(target types.Target) {
if !exists {
return
}
lb.logger.Info("remove pending target", "target", target)
lb.logger.Info("remove pending target", "target")
delete(lb.pendingTargets, target.GetIdentifier())
}

Expand Down
12 changes: 12 additions & 0 deletions pkg/loadbalancer/stream/target.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
package stream

import (
"encoding/json"
"errors"
"fmt"
"strconv"
Expand Down Expand Up @@ -114,3 +115,14 @@ func (t *Target) getIdentifier() int {
}
return identifier
}

func (t *Target) MarshalJSON() ([]byte, error) {
ts := struct {
Identifier int `json:"identifier"`
IPs []string `json:"ips"`
}{
t.getIdentifier(),
t.nspTarget.GetIps(),
}
return json.Marshal(&ts)
}

0 comments on commit 3b129ed

Please sign in to comment.