Skip to content
Closed
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
4 changes: 3 additions & 1 deletion sdk/metric/internal/aggregate/exponential_histogram.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ type expoHistogramDataPoint[N int64 | float64] struct {
posBuckets expoBuckets
negBuckets expoBuckets
zeroCount uint64
start time.Time
}

func newExpoHistogramDataPoint[N int64 | float64](
Expand All @@ -68,6 +69,7 @@ func newExpoHistogramDataPoint[N int64 | float64](
noMinMax: noMinMax,
noSum: noSum,
scale: maxScale,
start: now(),
}
}

Expand Down Expand Up @@ -446,7 +448,7 @@ func (e *expoHistogram[N]) cumulative(
var i int
for _, val := range e.values {
hDPts[i].Attributes = val.attrs
hDPts[i].StartTime = e.start
hDPts[i].StartTime = val.start
hDPts[i].Time = t
hDPts[i].Count = val.count()
hDPts[i].Scale = val.scale
Expand Down
6 changes: 3 additions & 3 deletions sdk/metric/internal/aggregate/histogram.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ type hotColdHistogramPoint[N int64 | float64] struct {

attrs attribute.Set
res FilteredExemplarReservoir[N]
start time.Time
}

// histogramPointCounters contains only the atomic counter data, and is used by
Expand Down Expand Up @@ -242,7 +243,6 @@ func (s *deltaHistogram[N]) collect(
type cumulativeHistogram[N int64 | float64] struct {
values limitedSyncMap

start time.Time
noMinMax bool
noSum bool
bounds []float64
Expand All @@ -264,7 +264,6 @@ func newCumulativeHistogram[N int64 | float64](
b := slices.Clone(boundaries)
slices.Sort(b)
return &cumulativeHistogram[N]{
start: now(),
noMinMax: noMinMax,
noSum: noSum,
bounds: b,
Expand Down Expand Up @@ -298,6 +297,7 @@ func (s *cumulativeHistogram[N]) measure(
counts: make([]atomic.Uint64, len(s.bounds)+1),
},
},
start: now(),
}
return hPt
}).(*hotColdHistogramPoint[N])
Expand Down Expand Up @@ -348,7 +348,7 @@ func (s *cumulativeHistogram[N]) collect(
count := val.hotColdPoint[readIdx].loadCountsInto(&bucketCounts)
newPt := metricdata.HistogramDataPoint[N]{
Attributes: val.attrs,
StartTime: s.start,
StartTime: val.start,
Time: t,
Count: count,
Bounds: bounds,
Expand Down
6 changes: 3 additions & 3 deletions sdk/metric/internal/aggregate/lastvalue.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ type lastValuePoint[N int64 | float64] struct {
attrs attribute.Set
value atomicN[N]
res FilteredExemplarReservoir[N]
start time.Time
}

// lastValue summarizes a set of measurements as the last one made.
Expand All @@ -34,6 +35,7 @@ func (s *lastValueMap[N]) measure(
return &lastValuePoint[N]{
res: s.newRes(attr),
attrs: attr,
start: now(),
}
}).(*lastValuePoint[N])

Expand Down Expand Up @@ -128,7 +130,6 @@ func (s *deltaLastValue[N]) copyAndClearDpts(
// cumulativeLastValue summarizes a set of measurements as the last one made.
type cumulativeLastValue[N int64 | float64] struct {
lastValueMap[N]
start time.Time
}

func newCumulativeLastValue[N int64 | float64](
Expand All @@ -140,7 +141,6 @@ func newCumulativeLastValue[N int64 | float64](
values: limitedSyncMap{aggLimit: limit},
newRes: r,
},
start: now(),
}
}

Expand All @@ -161,7 +161,7 @@ func (s *cumulativeLastValue[N]) collect(
v := value.(*lastValuePoint[N])
newPt := metricdata.DataPoint[N]{
Attributes: v.attrs,
StartTime: s.start,
StartTime: v.start,
Time: t,
Value: v.value.Load(),
}
Expand Down
6 changes: 3 additions & 3 deletions sdk/metric/internal/aggregate/sum.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ type sumValue[N int64 | float64] struct {
n atomicCounter[N]
res FilteredExemplarReservoir[N]
attrs attribute.Set
start time.Time
}

type sumValueMap[N int64 | float64] struct {
Expand All @@ -32,6 +33,7 @@ func (s *sumValueMap[N]) measure(
return &sumValue[N]{
res: s.newRes(attr),
attrs: attr,
start: now(),
}
}).(*sumValue[N])
sv.n.add(value)
Expand Down Expand Up @@ -129,7 +131,6 @@ func newCumulativeSum[N int64 | float64](
) *cumulativeSum[N] {
return &cumulativeSum[N]{
monotonic: monotonic,
start: now(),
sumValueMap: sumValueMap[N]{
values: limitedSyncMap{aggLimit: limit},
newRes: r,
Expand All @@ -140,7 +141,6 @@ func newCumulativeSum[N int64 | float64](
// deltaSum is the storage for sums which never reset.
type cumulativeSum[N int64 | float64] struct {
monotonic bool
start time.Time

sumValueMap[N]
}
Expand All @@ -165,7 +165,7 @@ func (s *cumulativeSum[N]) collect(
val := value.(*sumValue[N])
newPt := metricdata.DataPoint[N]{
Attributes: val.attrs,
StartTime: s.start,
StartTime: val.start,
Time: t,
Value: val.n.load(),
}
Expand Down
Loading