@@ -20,6 +20,7 @@ import (
2020 "k8s.io/apimachinery/pkg/types"
2121 "k8s.io/client-go/rest"
2222 "k8s.io/client-go/transport"
23+ "k8s.io/klog/v2"
2324 "sigs.k8s.io/controller-runtime/pkg/client/apiutil"
2425
2526 "github.com/jetstack/preflight/api"
@@ -154,18 +155,23 @@ func (c *VenConnClient) PostDataReadingsWithOptions(ctx context.Context, reading
154155 DataGatherTime : time .Now ().UTC (),
155156 DataReadings : readings ,
156157 }
157-
158- encodedBody := & bytes.Buffer {}
159-
160- err = json .NewEncoder (encodedBody ).Encode (payload )
158+ data , err := json .Marshal (payload )
161159 if err != nil {
162160 return err
163161 }
164162
163+ klog .FromContext (ctx ).V (2 ).Info (
164+ "uploading data readings" ,
165+ "url" , fullURL (details .VCP .URL , "/v1/tlspk/upload/clusterdata/no" ),
166+ "cluster_name" , opts .ClusterName ,
167+ "data_readings_count" , len (readings ),
168+ "data_size_bytes" , len (data ),
169+ )
170+
165171 // The path parameter "no" is a dummy parameter to make the Venafi Cloud
166172 // backend happy. This parameter, named `uploaderID` in the backend, is not
167173 // actually used by the backend.
168- req , err := http .NewRequestWithContext (ctx , http .MethodPost , fullURL (details .VCP .URL , "/v1/tlspk/upload/clusterdata/no" ), encodedBody )
174+ req , err := http .NewRequestWithContext (ctx , http .MethodPost , fullURL (details .VCP .URL , "/v1/tlspk/upload/clusterdata/no" ), bytes . NewReader ( data ) )
169175 if err != nil {
170176 return err
171177 }
0 commit comments