Remove exemplars from parameters for constNativeHistogram function

Signed-off-by: Shivanth <shivanth.metchem@deliveryhero.com>
This commit is contained in:
Shivanth 2024-11-06 08:26:04 +01:00
parent 782f32e1e7
commit d7d3022799
2 changed files with 0 additions and 17 deletions

View File

@ -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
@ -1905,7 +1896,6 @@ func NewConstNativeHistogram(
schema int32,
zeroThreshold float64,
createdTimestamp time.Time,
exemplars []*dto.Exemplar,
labelValues ...string,
) (Metric, error) {
if desc.err != nil {
@ -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)
@ -1932,7 +1919,6 @@ func NewConstNativeHistogram(
CreatedTimestamp: timestamppb.New(createdTimestamp),
Schema: &schema,
ZeroThreshold: &zeroThreshold,
Exemplars: exemplars,
SampleCount: &count,
SampleSum: &sum,
@ -1964,7 +1950,6 @@ func MustNewConstNativeHistogram(
nativeHistogramSchema int32,
nativeHistogramZeroThreshold float64,
createdTimestamp time.Time,
exemplars []*dto.Exemplar,
labelValues ...string,
) Metric {
nativehistogram, err := NewConstNativeHistogram(desc,
@ -1976,7 +1961,6 @@ func MustNewConstNativeHistogram(
nativeHistogramSchema,
nativeHistogramZeroThreshold,
createdTimestamp,
exemplars,
labelValues...)
if err != nil {
panic(err)

View File

@ -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)