mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2026-05-17 00:26:36 +03:00
lib/protoparser/datadogsketches: fixed duplications in datadog sketches aggregations
Previously, due to bug at parsing logic sketches values were duplicated. This commit properly parsers sketches and correctly converts it to time series labels. Related issue: https://github.com/VictoriaMetrics/VictoriaMetrics/issues/8836
This commit is contained in:
@@ -20,6 +20,8 @@ See also [LTS releases](https://docs.victoriametrics.com/victoriametrics/lts-rel
|
||||
|
||||
**Update Note 1:** `latest` and `stable` tags for docker images will no longer be updated. It is required to use specific version tags for docker images to continue receiving updates. See [#7336](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/7336) for details.
|
||||
|
||||
* BUGFIX: [vmsingle](https://docs.victoriametrics.com/single-server-victoriametrics/), `vminsert` in [VictoriaMetrics cluster](https://docs.victoriametrics.com/cluster-victoriametrics/) and [vmagent](https://docs.victoriametrics.com/vmagent/): fixed duplication in Datadog sketches aggregation metrics. See [#8836](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/8836) for details.
|
||||
|
||||
## [v1.117.0](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.117.0)
|
||||
|
||||
Released at 2025-05-09
|
||||
|
||||
@@ -163,6 +163,26 @@ func (s *Sketch) ToSummary() []*Metric {
|
||||
minPoints := make([]Point, 0, len(dogsketches))
|
||||
maxPoints := make([]Point, 0, len(dogsketches))
|
||||
|
||||
for _, d := range dogsketches {
|
||||
timestamp := d.Ts * 1000
|
||||
sumPoints = append(sumPoints, Point{
|
||||
Timestamp: timestamp,
|
||||
Value: d.Sum,
|
||||
})
|
||||
countPoints = append(countPoints, Point{
|
||||
Timestamp: timestamp,
|
||||
Value: float64(d.Cnt),
|
||||
})
|
||||
minPoints = append(minPoints, Point{
|
||||
Timestamp: timestamp,
|
||||
Value: float64(d.Min),
|
||||
})
|
||||
maxPoints = append(maxPoints, Point{
|
||||
Timestamp: timestamp,
|
||||
Value: float64(d.Max),
|
||||
})
|
||||
}
|
||||
|
||||
for i, q := range quantiles {
|
||||
points := make([]Point, 0, len(dogsketches))
|
||||
for _, d := range dogsketches {
|
||||
@@ -171,22 +191,6 @@ func (s *Sketch) ToSummary() []*Metric {
|
||||
Timestamp: timestamp,
|
||||
Value: d.quantile(q),
|
||||
})
|
||||
sumPoints = append(sumPoints, Point{
|
||||
Timestamp: timestamp,
|
||||
Value: d.Sum,
|
||||
})
|
||||
countPoints = append(countPoints, Point{
|
||||
Timestamp: timestamp,
|
||||
Value: float64(d.Cnt),
|
||||
})
|
||||
minPoints = append(minPoints, Point{
|
||||
Timestamp: timestamp,
|
||||
Value: float64(d.Min),
|
||||
})
|
||||
maxPoints = append(maxPoints, Point{
|
||||
Timestamp: timestamp,
|
||||
Value: float64(d.Max),
|
||||
})
|
||||
}
|
||||
metrics[i] = &Metric{
|
||||
Name: s.Metric,
|
||||
|
||||
@@ -29,3 +29,36 @@ func TestDogsketchQuantile(t *testing.T) {
|
||||
f(sketches, 0.99, 20.24)
|
||||
f(sketches, 1, 21)
|
||||
}
|
||||
|
||||
func TestSketchToSummary(t *testing.T) {
|
||||
f := func(s *Sketch) {
|
||||
t.Helper()
|
||||
for _, m := range s.ToSummary() {
|
||||
if len(m.Points) != len(s.Dogsketches) {
|
||||
t.Fatalf("unexpected amount of quantile points; got %d; want %d", len(m.Points), len(s.Dogsketches))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
f(&Sketch{
|
||||
Metric: "test_metric",
|
||||
Host: "host",
|
||||
Tags: []string{"key1:value1", "key2:value2"},
|
||||
Dogsketches: []*Dogsketch{
|
||||
{
|
||||
Min: 8.0,
|
||||
Max: 21.0,
|
||||
Cnt: 17,
|
||||
N: []uint32{0x0, 0x0, 0x1, 0x0, 0x1, 0x4, 0x6, 0x1, 0x2, 0x0, 0x1, 0x0, 0x1},
|
||||
K: []int32{0, 1472, 1473, 1479, 1480, 1503, 1504, 1512, 1513, 1514, 1515, 1531, 1532},
|
||||
},
|
||||
{
|
||||
Min: 8.0,
|
||||
Max: 21.0,
|
||||
Cnt: 17,
|
||||
N: []uint32{0x0, 0x0, 0x1, 0x0, 0x1, 0x4, 0x6, 0x1, 0x2, 0x0, 0x1, 0x0, 0x1},
|
||||
K: []int32{0, 1472, 1473, 1479, 1480, 1503, 1504, 1512, 1513, 1514, 1515, 1531, 1532},
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user