Skip to content

Commit

Permalink
Remove exemplars from parameters for constNativeHistogram function
Browse files Browse the repository at this point in the history
Signed-off-by: Shivanth <[email protected]>
  • Loading branch information
shivanthzen committed Nov 6, 2024
1 parent 782f32e commit d7d3022
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 17 deletions.
16 changes: 0 additions & 16 deletions prometheus/histogram.go
Original file line number Diff line number Diff line change
Expand Up @@ -1867,15 +1867,6 @@ func validateCount(sum float64, count uint64, negativeBuckets, positiveBuckets m
return nil
}

func validateExemplars(exemplars []*dto.Exemplar) error {
for _, e := range exemplars {
if !e.GetTimestamp().IsValid() {
return fmt.Errorf("invalid timestamp found in exemplars")
}
}
return nil
}

// NewConstNativeHistogram returns a metric representing a Prometheus Nativehistogram with
// fixed values for the count, sum, and positive/negative/zero bucket counts. As those parameters
// cannot be changed, the returned value does not implement the Histogram
Expand Down Expand Up @@ -1905,7 +1896,6 @@ func NewConstNativeHistogram(
schema int32,
zeroThreshold float64,
createdTimestamp time.Time,
exemplars []*dto.Exemplar,
labelValues ...string,
) (Metric, error) {
if desc.err != nil {
Expand All @@ -1920,9 +1910,6 @@ func NewConstNativeHistogram(
if err := validateCount(sum, count, negativeBuckets, positiveBuckets, zeroBucket); err != nil {
return nil, err
}
if err := validateExemplars(exemplars); err != nil {
return nil, err
}

NegativeSpan, NegativeDelta := makeBucketsFromMap(negativeBuckets)
PositiveSpan, PositiveDelta := makeBucketsFromMap(positiveBuckets)
Expand All @@ -1932,7 +1919,6 @@ func NewConstNativeHistogram(
CreatedTimestamp: timestamppb.New(createdTimestamp),
Schema: &schema,
ZeroThreshold: &zeroThreshold,
Exemplars: exemplars,
SampleCount: &count,
SampleSum: &sum,

Expand Down Expand Up @@ -1964,7 +1950,6 @@ func MustNewConstNativeHistogram(
nativeHistogramSchema int32,
nativeHistogramZeroThreshold float64,
createdTimestamp time.Time,
exemplars []*dto.Exemplar,
labelValues ...string,
) Metric {
nativehistogram, err := NewConstNativeHistogram(desc,
Expand All @@ -1976,7 +1961,6 @@ func MustNewConstNativeHistogram(
nativeHistogramSchema,
nativeHistogramZeroThreshold,
createdTimestamp,
exemplars,
labelValues...)
if err != nil {
panic(err)
Expand Down
1 change: 0 additions & 1 deletion prometheus/histogram_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1980,7 +1980,6 @@ func TestConstNativeHistogram(t *testing.T) {
cold.nativeHistogramSchema,
math.Float64frombits(cold.nativeHistogramZeroThresholdBits),
_his.lastResetTime,
_his.nativeExemplars.exemplars,
)
if err != nil {
t.Fatal("unexpected error writing metric", err)
Expand Down

0 comments on commit d7d3022

Please sign in to comment.