Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions opentelemetry-app/cmd/deltaaccbench/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -635,12 +635,12 @@ func benchHLL(mode string, deltaOn bool) sketchResult {
if mode == "batch" {
cur = hll.NewHyperLogLog()
for _, v := range vals {
cur.Insert(v)
cur.UpdateValue(v)
seenValues[v] = struct{}{}
}
} else {
for _, v := range vals {
winSketch.Insert(v)
winSketch.UpdateValue(v)
seenValues[v] = struct{}{}
}
cur = cloneHLL(winSketch)
Expand Down Expand Up @@ -811,11 +811,11 @@ func benchDD(mode string, deltaOn bool) sketchResult {
if mode == "batch" {
cur = dd.New(alpha)
for _, v := range vals {
cur.Add(v)
cur.Update(v)
}
} else {
for _, v := range vals {
winSketch.Add(v)
winSketch.Update(v)
}
cur = winSketch.Clone()
}
Expand Down Expand Up @@ -890,7 +890,7 @@ func benchDD(mode string, deltaOn bool) sketchResult {
var sumRel, maxRel float64
for _, q := range quantiles {
trueQ := trueQuantile(sortedVals, q)
estQ, ok := reconSketch.GetValueAtQuantile(q)
estQ, ok := reconSketch.Quantile(q)
if !ok || trueQ == 0 {
continue
}
Expand Down Expand Up @@ -940,8 +940,8 @@ func ddSketchesCompatible(a, b *dd.DDSketch, quantiles []float64) bool {
return false
}
for _, q := range quantiles {
av, aok := a.GetValueAtQuantile(q)
bv, bok := b.GetValueAtQuantile(q)
av, aok := a.Quantile(q)
bv, bok := b.Quantile(q)
if aok != bok {
return false
}
Expand Down Expand Up @@ -999,11 +999,11 @@ func benchKLL(mode string) sketchResult {
if mode == "batch" {
cur = kll.InitKLL(k)
for _, v := range vals {
cur.Insert(v)
cur.Update(v)
}
} else {
for _, v := range vals {
winSketch.Insert(v)
winSketch.Update(v)
}
// KLL doesn't have Clone; serialize/deserialize for snapshot.
curBytes, err := winSketch.SerializeProtoBytes()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ func (p *ddsketchProcessor) buildQuantileMetric(src pmetric.Metric, series map[s
continue
}
for _, q := range p.cfg.Quantiles {
val, ok := s.sketch.GetValueAtQuantile(q)
val, ok := s.sketch.Quantile(q)
if !ok {
// sketchlib-go returns (0, false) for empty sketch
// or an out-of-range quantile; skip silently to
Expand Down Expand Up @@ -425,9 +425,9 @@ func (p *ddsketchProcessor) consumeGaugeDataPoints(dps pmetric.NumberDataPointSl
}
switch dp.ValueType() {
case pmetric.NumberDataPointValueTypeDouble:
sk.Add(dp.DoubleValue())
sk.Update(dp.DoubleValue())
case pmetric.NumberDataPointValueTypeInt:
sk.Add(float64(dp.IntValue()))
sk.Update(float64(dp.IntValue()))
default:
if p.logger != nil {
p.logger.Error("unsupported gauge data point type", zap.Any("type", dp.ValueType()))
Expand Down Expand Up @@ -784,9 +784,9 @@ func (p *ddsketchProcessor) accumulateGaugeMetric(sw *scopeWindow, metric pmetri

switch dp.ValueType() {
case pmetric.NumberDataPointValueTypeDouble:
sk.Add(dp.DoubleValue())
sk.Update(dp.DoubleValue())
case pmetric.NumberDataPointValueTypeInt:
sk.Add(float64(dp.IntValue()))
sk.Update(float64(dp.IntValue()))
default:
if p.logger != nil {
p.logger.Error("unsupported gauge data point type in window mode", zap.Any("type", dp.ValueType()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ func (p *hllProcessor) processBatch(md pmetric.Metrics) error {
continue
}
bs := getOrCreate(metric.Name(), metric.Unit(), dp.Attributes())
bs.sketch.InsertValue(dp.DoubleValue())
bs.sketch.UpdateValue(dp.DoubleValue())
bs.count++
}
case pmetric.MetricTypeHLLSketch:
Expand Down Expand Up @@ -320,7 +320,7 @@ func (p *hllProcessor) processBatch(md pmetric.Metrics) error {
bs.attrs.CopyTo(dp.Attributes())
dp.SetTimestamp(now)
dp.SetCount(bs.count)
dp.SetCardinality(uint64(bs.sketch.EstimateCardinality()))
dp.SetCardinality(uint64(bs.sketch.Estimate()))
dp.SetSketch(payload)
dp.SetEncoding(encodingTag)
dp.SetPrecision(uint32(hll.HLLPrecision))
Expand All @@ -335,7 +335,7 @@ func (p *hllProcessor) processBatch(md pmetric.Metrics) error {
dp := m.Gauge().DataPoints().AppendEmpty()
bs.attrs.CopyTo(dp.Attributes())
dp.SetTimestamp(now)
dp.SetDoubleValue(float64(bs.sketch.EstimateCardinality()))
dp.SetDoubleValue(float64(bs.sketch.Estimate()))
}
}
return nil
Expand Down Expand Up @@ -500,7 +500,7 @@ func (p *hllProcessor) accumulateGaugeMetric(sw *scopeWindow, metric pmetric.Met
}
mw.series[attrKey] = series
}
series.sketch.InsertValue(dp.DoubleValue())
series.sketch.UpdateValue(dp.DoubleValue())
}
}

Expand Down Expand Up @@ -594,7 +594,7 @@ func (p *hllProcessor) flushWindow(ctx context.Context) error {
series.attrs.CopyTo(dp.Attributes())
dp.SetTimestamp(now)
dp.SetCount(0)
dp.SetCardinality(uint64(series.sketch.EstimateCardinality()))
dp.SetCardinality(uint64(series.sketch.Estimate()))
dp.SetSketch(payload)
dp.SetEncoding(pmetric.HLLSketchEncodingDelta)
dp.SetPrecision(uint32(hll.HLLPrecision))
Expand All @@ -610,7 +610,7 @@ func (p *hllProcessor) flushWindow(ctx context.Context) error {
series.attrs.CopyTo(dp.Attributes())
dp.SetTimestamp(now)
dp.SetCount(0)
dp.SetCardinality(uint64(series.sketch.EstimateCardinality()))
dp.SetCardinality(uint64(series.sketch.Estimate()))
dp.SetSketch(payload)
dp.SetEncoding(pmetric.HLLSketchEncodingProto)
dp.SetPrecision(uint32(hll.HLLPrecision))
Expand All @@ -631,7 +631,7 @@ func (p *hllProcessor) flushWindow(ctx context.Context) error {
series.attrs.CopyTo(dp.Attributes())
dp.SetTimestamp(now)
dp.SetCount(0)
dp.SetCardinality(uint64(series.sketch.EstimateCardinality()))
dp.SetCardinality(uint64(series.sketch.Estimate()))
dp.SetSketch(payload)
dp.SetEncoding(encodingTag)
dp.SetPrecision(uint32(hll.HLLPrecision))
Expand All @@ -657,7 +657,7 @@ func (p *hllProcessor) flushWindow(ctx context.Context) error {
dps = append(dps, struct {
attrs pcommon.Map
val float64
}{series.attrs, float64(series.sketch.EstimateCardinality())})
}{series.attrs, float64(series.sketch.Estimate())})
series.attrs = pcommon.Map{}
p.seriesPool.Put(series)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ func (p *kllProcessor) processBatch(md pmetric.Metrics) error {
}
bs := getOrCreate(metric.Name(), metric.Unit(), dp.Attributes())
if bs.sketch != nil {
bs.sketch.Insert(val)
bs.sketch.Update(val)
}
}
case pmetric.MetricTypeKLLSketch:
Expand Down Expand Up @@ -431,7 +431,7 @@ func (p *kllProcessor) accumulateGaugeMetric(sw *scopeWindow, metric pmetric.Met
val = dp.DoubleValue()
}
if series.sketch != nil {
series.sketch.Insert(val)
series.sketch.Update(val)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func (d *hllSketchValues[N]) measure(
}
}

series.sketch.InsertValue(float64(value))
series.sketch.UpdateValue(float64(value))
series.count++
series.measuredSince = true
}
Expand Down Expand Up @@ -281,7 +281,7 @@ func (d *hllSketch[N]) exportDataPoint(
encoding metricdata.HLLSketchEncoding,
dest *metricdata.HLLSketchDataPoint,
) bool {
cardinality := uint64(series.sketch.EstimateCardinality())
cardinality := uint64(series.sketch.Estimate())

dp := dest
if series.seriesID != 0 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func (d *kllSketchValues[N]) measure(
}
}

series.sketch.Insert(float64(value))
series.sketch.Update(float64(value))
series.count++
series.measuredSince = true
fv := float64(value)
Expand Down
4 changes: 2 additions & 2 deletions otel_collector_benchmark/cardinality_crossover/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ func evalCountSketch(n int, tuples []tuple, gt map[uint64]int64, topKKeys []uint

t0 := time.Now()
for _, in := range inputs {
cs.Insert(in)
cs.Update(in)
}
insertSec := time.Since(t0).Seconds()

Expand Down Expand Up @@ -322,7 +322,7 @@ func evalCountMinSketch(n int, tuples []tuple, gt map[uint64]int64, topKKeys []u

t0 := time.Now()
for _, in := range inputs {
cms.Insert(in)
cms.Update(in)
}
insertSec := time.Since(t0).Seconds()

Expand Down
6 changes: 3 additions & 3 deletions otel_collector_benchmark/matched_accuracy/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ func runDDSketch(stream []float64) (float64, int64, int, func(float64) float64)
d := ddsketch.NewDDSketch(0.01)
t0 := time.Now()
for _, v := range stream {
d.Add(v)
d.Update(v)
}
insertNs := float64(time.Since(t0).Nanoseconds()) / float64(len(stream))

Expand All @@ -154,7 +154,7 @@ func runDDSketch(stream []float64) (float64, int64, int, func(float64) float64)
}

q := func(p float64) float64 {
v, _ := d.GetValueAtQuantile(p)
v, _ := d.Quantile(p)
return v
}
return insertNs, heap, len(wire), q
Expand All @@ -172,7 +172,7 @@ func runKLL(stream []float64) (float64, int64, int, func(float64) float64) {
k := kll.InitKLL(200)
t0 := time.Now()
for _, v := range stream {
k.Insert(v)
k.Update(v)
}
insertNs := float64(time.Since(t0).Nanoseconds()) / float64(len(stream))

Expand Down