Remove exemplars from parameters for constNativeHistogram function
Signed-off-by: Shivanth <shivanth.metchem@deliveryhero.com>
This commit is contained in:
parent
782f32e1e7
commit
d7d3022799
|
@ -1867,15 +1867,6 @@ func validateCount(sum float64, count uint64, negativeBuckets, positiveBuckets m
|
||||||
return nil
|
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
|
// NewConstNativeHistogram returns a metric representing a Prometheus Nativehistogram with
|
||||||
// fixed values for the count, sum, and positive/negative/zero bucket counts. As those parameters
|
// 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
|
// cannot be changed, the returned value does not implement the Histogram
|
||||||
|
@ -1905,7 +1896,6 @@ func NewConstNativeHistogram(
|
||||||
schema int32,
|
schema int32,
|
||||||
zeroThreshold float64,
|
zeroThreshold float64,
|
||||||
createdTimestamp time.Time,
|
createdTimestamp time.Time,
|
||||||
exemplars []*dto.Exemplar,
|
|
||||||
labelValues ...string,
|
labelValues ...string,
|
||||||
) (Metric, error) {
|
) (Metric, error) {
|
||||||
if desc.err != nil {
|
if desc.err != nil {
|
||||||
|
@ -1920,9 +1910,6 @@ func NewConstNativeHistogram(
|
||||||
if err := validateCount(sum, count, negativeBuckets, positiveBuckets, zeroBucket); err != nil {
|
if err := validateCount(sum, count, negativeBuckets, positiveBuckets, zeroBucket); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if err := validateExemplars(exemplars); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
NegativeSpan, NegativeDelta := makeBucketsFromMap(negativeBuckets)
|
NegativeSpan, NegativeDelta := makeBucketsFromMap(negativeBuckets)
|
||||||
PositiveSpan, PositiveDelta := makeBucketsFromMap(positiveBuckets)
|
PositiveSpan, PositiveDelta := makeBucketsFromMap(positiveBuckets)
|
||||||
|
@ -1932,7 +1919,6 @@ func NewConstNativeHistogram(
|
||||||
CreatedTimestamp: timestamppb.New(createdTimestamp),
|
CreatedTimestamp: timestamppb.New(createdTimestamp),
|
||||||
Schema: &schema,
|
Schema: &schema,
|
||||||
ZeroThreshold: &zeroThreshold,
|
ZeroThreshold: &zeroThreshold,
|
||||||
Exemplars: exemplars,
|
|
||||||
SampleCount: &count,
|
SampleCount: &count,
|
||||||
SampleSum: &sum,
|
SampleSum: &sum,
|
||||||
|
|
||||||
|
@ -1964,7 +1950,6 @@ func MustNewConstNativeHistogram(
|
||||||
nativeHistogramSchema int32,
|
nativeHistogramSchema int32,
|
||||||
nativeHistogramZeroThreshold float64,
|
nativeHistogramZeroThreshold float64,
|
||||||
createdTimestamp time.Time,
|
createdTimestamp time.Time,
|
||||||
exemplars []*dto.Exemplar,
|
|
||||||
labelValues ...string,
|
labelValues ...string,
|
||||||
) Metric {
|
) Metric {
|
||||||
nativehistogram, err := NewConstNativeHistogram(desc,
|
nativehistogram, err := NewConstNativeHistogram(desc,
|
||||||
|
@ -1976,7 +1961,6 @@ func MustNewConstNativeHistogram(
|
||||||
nativeHistogramSchema,
|
nativeHistogramSchema,
|
||||||
nativeHistogramZeroThreshold,
|
nativeHistogramZeroThreshold,
|
||||||
createdTimestamp,
|
createdTimestamp,
|
||||||
exemplars,
|
|
||||||
labelValues...)
|
labelValues...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
|
|
|
@ -1980,7 +1980,6 @@ func TestConstNativeHistogram(t *testing.T) {
|
||||||
cold.nativeHistogramSchema,
|
cold.nativeHistogramSchema,
|
||||||
math.Float64frombits(cold.nativeHistogramZeroThresholdBits),
|
math.Float64frombits(cold.nativeHistogramZeroThresholdBits),
|
||||||
_his.lastResetTime,
|
_his.lastResetTime,
|
||||||
_his.nativeExemplars.exemplars,
|
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal("unexpected error writing metric", err)
|
t.Fatal("unexpected error writing metric", err)
|
||||||
|
|
Loading…
Reference in New Issue