Skip to content

Commit

Permalink
trace log the response body json from node
Browse files Browse the repository at this point in the history
  • Loading branch information
yashbhutwala committed Jul 12, 2020
1 parent 7a51ebd commit 2d73c89
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions pkg/df-pv/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -499,20 +499,21 @@ func GetOutputRowPVCFromNodeChan(ctx context.Context, clientset *kubernetes.Clie
request := clientset.CoreV1().RESTClient().Get().Resource("nodes").Name(node.Name).SubResource("proxy").Suffix("stats/summary")
res := request.Do(ctx)

runtimeObj, _ := res.Get()
// if err != nil {
// return errors.Wrapf(err, "failed to get response body")
// }
jsonText, err := json.MarshalIndent(runtimeObj, "", " ")
responseRawArrayOfBytes, err := res.Raw()
if err != nil {
return errors.Wrapf(err, "unable to marshal json (this really shouldn't happen)")
return errors.Wrapf(err, "failed to get stats from node")
}
log.Tracef("response from node: %s\n", jsonText)

responseRawArrayOfBytes, err := res.Raw()
// for trace logging only
var nodeRespBody interface{}
_ = json.Unmarshal(responseRawArrayOfBytes, &nodeRespBody)
// log.Tracef("response from node: %+v\n", nodeRespBody)
jsonText, err := json.MarshalIndent(nodeRespBody, "", " ")
if err != nil {
return errors.Wrapf(err, "failed to get stats from node")
return errors.Wrapf(err, "unable to marshal json (this really shouldn't happen)")
}
log.Tracef("response from node: %s\n", jsonText)

var jsonConvertedIntoStruct ServerResponseStruct
err = json.Unmarshal(responseRawArrayOfBytes, &jsonConvertedIntoStruct)
if err != nil {
Expand Down

0 comments on commit 2d73c89

Please sign in to comment.