Skip to content

Commit d7d3022

Browse files
committed
Remove exemplars from parameters for constNativeHistogram function
Signed-off-by: Shivanth <[email protected]>
1 parent 782f32e commit d7d3022

File tree

2 files changed

+0
-17
lines changed

2 files changed

+0
-17
lines changed

Diff for: prometheus/histogram.go

-16
Original file line numberDiff line numberDiff line change
@@ -1867,15 +1867,6 @@ func validateCount(sum float64, count uint64, negativeBuckets, positiveBuckets m
18671867
return nil
18681868
}
18691869

1870-
func validateExemplars(exemplars []*dto.Exemplar) error {
1871-
for _, e := range exemplars {
1872-
if !e.GetTimestamp().IsValid() {
1873-
return fmt.Errorf("invalid timestamp found in exemplars")
1874-
}
1875-
}
1876-
return nil
1877-
}
1878-
18791870
// NewConstNativeHistogram returns a metric representing a Prometheus Nativehistogram with
18801871
// fixed values for the count, sum, and positive/negative/zero bucket counts. As those parameters
18811872
// cannot be changed, the returned value does not implement the Histogram
@@ -1905,7 +1896,6 @@ func NewConstNativeHistogram(
19051896
schema int32,
19061897
zeroThreshold float64,
19071898
createdTimestamp time.Time,
1908-
exemplars []*dto.Exemplar,
19091899
labelValues ...string,
19101900
) (Metric, error) {
19111901
if desc.err != nil {
@@ -1920,9 +1910,6 @@ func NewConstNativeHistogram(
19201910
if err := validateCount(sum, count, negativeBuckets, positiveBuckets, zeroBucket); err != nil {
19211911
return nil, err
19221912
}
1923-
if err := validateExemplars(exemplars); err != nil {
1924-
return nil, err
1925-
}
19261913

19271914
NegativeSpan, NegativeDelta := makeBucketsFromMap(negativeBuckets)
19281915
PositiveSpan, PositiveDelta := makeBucketsFromMap(positiveBuckets)
@@ -1932,7 +1919,6 @@ func NewConstNativeHistogram(
19321919
CreatedTimestamp: timestamppb.New(createdTimestamp),
19331920
Schema: &schema,
19341921
ZeroThreshold: &zeroThreshold,
1935-
Exemplars: exemplars,
19361922
SampleCount: &count,
19371923
SampleSum: &sum,
19381924

@@ -1964,7 +1950,6 @@ func MustNewConstNativeHistogram(
19641950
nativeHistogramSchema int32,
19651951
nativeHistogramZeroThreshold float64,
19661952
createdTimestamp time.Time,
1967-
exemplars []*dto.Exemplar,
19681953
labelValues ...string,
19691954
) Metric {
19701955
nativehistogram, err := NewConstNativeHistogram(desc,
@@ -1976,7 +1961,6 @@ func MustNewConstNativeHistogram(
19761961
nativeHistogramSchema,
19771962
nativeHistogramZeroThreshold,
19781963
createdTimestamp,
1979-
exemplars,
19801964
labelValues...)
19811965
if err != nil {
19821966
panic(err)

Diff for: prometheus/histogram_test.go

-1
Original file line numberDiff line numberDiff line change
@@ -1980,7 +1980,6 @@ func TestConstNativeHistogram(t *testing.T) {
19801980
cold.nativeHistogramSchema,
19811981
math.Float64frombits(cold.nativeHistogramZeroThresholdBits),
19821982
_his.lastResetTime,
1983-
_his.nativeExemplars.exemplars,
19841983
)
19851984
if err != nil {
19861985
t.Fatal("unexpected error writing metric", err)

0 commit comments

Comments
 (0)