Skip to content

Commit

Permalink
rename Histogram to HistogramReservoir
Browse files Browse the repository at this point in the history
  • Loading branch information
dashpole committed Sep 20, 2024
1 parent ad1a91b commit e0a5837
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
7 changes: 4 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
### Added

- Add `go.opentelemetry.io/otel/sdk/metric/exemplar` package which includes
`Exemplar`, `Filter`, `SampledFilter`, `AlwaysOnFilter`, `Histogram`,
`FixedSizeReservoir`, `Reservoir`, `Value` and `ValueType` types. These will be used
for configuring the exemplar reservoir for the metrics sdk. (#5747)
`Exemplar`, `Filter`, `SampledFilter`, `AlwaysOnFilter`,
`HistogramReservoir`, `FixedSizeReservoir`, `Reservoir`, `Value` and
`ValueType` types. These will be used for configuring the exemplar reservoir
for the metrics sdk. (#5747)

### Changed

Expand Down
2 changes: 1 addition & 1 deletion sdk/metric/exemplar.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func reservoirFunc[N int64 | float64](agg Aggregation) func() aggregate.Filtered
cp := slices.Clone(a.Boundaries)
return func() aggregate.FilteredExemplarReservoir[N] {
bounds := cp
return aggregate.NewFilteredExemplarReservoir[N](filter, exemplar.Histogram(bounds))
return aggregate.NewFilteredExemplarReservoir[N](filter, exemplar.HistogramReservoir(bounds))
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ import (
"go.opentelemetry.io/otel/attribute"
)

// Histogram returns a [Reservoir] that samples the last measurement that falls
// HistogramReservoir returns a [Reservoir] that samples the last measurement that falls
// within a histogram bucket. The histogram bucket upper-boundaries are define
// by bounds.
//
// The passed bounds will be sorted by this function.
func Histogram(bounds []float64) Reservoir {
func HistogramReservoir(bounds []float64) Reservoir {
slices.Sort(bounds)
return &histRes{
bounds: bounds,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import "testing"
func TestHist(t *testing.T) {
bounds := []float64{0, 100}
t.Run("Int64", ReservoirTest[int64](func(int) (Reservoir, int) {
return Histogram(bounds), len(bounds)
return HistogramReservoir(bounds), len(bounds)
}))

t.Run("Float64", ReservoirTest[float64](func(int) (Reservoir, int) {
return Histogram(bounds), len(bounds)
return HistogramReservoir(bounds), len(bounds)
}))
}

0 comments on commit e0a5837

Please sign in to comment.