floatHistogramSamplesV2 encodes exponential float histogram samples and splits off custom-bucket float histogram samples to be encoded later.
(histograms []RefFloatHistogramSample, b []byte)
| 1269 | // floatHistogramSamplesV2 encodes exponential float histogram samples and |
| 1270 | // splits off custom-bucket float histogram samples to be encoded later. |
| 1271 | func (*Encoder) floatHistogramSamplesV2(histograms []RefFloatHistogramSample, b []byte) []byte { |
| 1272 | buf := encoding.Encbuf{B: b} |
| 1273 | buf.PutByte(byte(FloatHistogramSamplesV2)) |
| 1274 | |
| 1275 | if len(histograms) == 0 { |
| 1276 | return buf.Get() |
| 1277 | } |
| 1278 | |
| 1279 | var first, prev *RefFloatHistogramSample |
| 1280 | for _, fh := range histograms { |
| 1281 | if first == nil { |
| 1282 | first = &fh |
| 1283 | buf.PutVarint64(int64(first.Ref)) |
| 1284 | buf.PutVarint64(first.T) |
| 1285 | buf.PutVarint64(first.ST) |
| 1286 | prev = first |
| 1287 | EncodeFloatHistogram(&buf, fh.FH) |
| 1288 | continue |
| 1289 | } |
| 1290 | |
| 1291 | buf.PutVarint64(int64(fh.Ref) - int64(prev.Ref)) |
| 1292 | buf.PutVarint64(fh.T - first.T) |
| 1293 | |
| 1294 | writeSTMarker(&buf, fh.ST, first.ST, prev.ST) |
| 1295 | EncodeFloatHistogram(&buf, fh.FH) |
| 1296 | prev = &fh |
| 1297 | } |
| 1298 | |
| 1299 | return buf.Get() |
| 1300 | } |
| 1301 | |
| 1302 | // CustomBucketsFloatHistogramSamples appends the encoded custom-bucket float |
| 1303 | // histogram samples to b and returns the resulting slice. |
no test coverage detected