@@ -152,7 +152,7 @@ impl DdApi {
152
152
pub async fn ship_series ( & self , series : & Series ) -> Result < Response , ShippingError > {
153
153
let url = format ! ( "{}/api/v2/series" , & self . metrics_intake_url_prefix) ;
154
154
let safe_body = serde_json:: to_vec ( & series)
155
- . map_err ( |_ | ShippingError :: Payload ( "Failed to serialize series" . to_string ( ) ) ) ?;
155
+ . map_err ( |e | ShippingError :: Payload ( format ! ( "Failed to serialize series: {e}" ) ) ) ?;
156
156
debug ! ( "Sending body: {:?}" , & series) ;
157
157
self . ship_data ( url, safe_body, "application/json" ) . await
158
158
}
@@ -162,15 +162,12 @@ impl DdApi {
162
162
sketches : & SketchPayload ,
163
163
) -> Result < Response , ShippingError > {
164
164
let url = format ! ( "{}/api/beta/sketches" , & self . metrics_intake_url_prefix) ;
165
- if let Ok ( safe_body) = sketches. write_to_bytes ( ) {
166
- debug ! ( "Sending distributions: {:?}" , & sketches) ;
167
- self . ship_data ( url, safe_body, "application/x-protobuf" )
168
- . await
169
- } else {
170
- Err ( ShippingError :: Payload (
171
- "Failed to serialize sketches" . to_string ( ) ,
172
- ) )
173
- }
165
+ let safe_body = sketches
166
+ . write_to_bytes ( )
167
+ . map_err ( |e| ShippingError :: Payload ( format ! ( "Failed to serialize series: {e}" ) ) ) ?;
168
+ debug ! ( "Sending distributions: {:?}" , & sketches) ;
169
+ self . ship_data ( url, safe_body, "application/x-protobuf" )
170
+ . await
174
171
// TODO maybe go to coded output stream if we incrementally
175
172
// add sketch payloads to the buffer
176
173
// something like this, but fix the utf-8 encoding issue
0 commit comments