@@ -1844,37 +1844,41 @@ type constNativeHistogram struct {
1844
1844
nativeHistogramSchema int32
1845
1845
nativeHistogramZeroThreshold float64
1846
1846
nativeHistogramMaxZeroThreshold float64
1847
- createdTimestamp time.Time
1847
+ createdTimestamp time.Time
1848
1848
nativeExemplars []* dto.Exemplar
1849
1849
1850
1850
positiveBuckets map [int ]int64
1851
1851
negativeBuckets map [int ]int64
1852
1852
zeroBucket uint64
1853
1853
}
1854
1854
1855
- func NewconstNativeHistogram (desc * Desc , count uint64 , sum float64 , postiveBuckets , negativeBuckets map [int ]int64 , zeroBucket uint64 ,
1856
- labelPairs []* dto.LabelPair , nativeHistogramSchema int32 , nativeHistogramZeroThreshold float64 ,
1857
- nativeHistogramMaxZeroThreshold float64 , nativeHistogramMaxBuckets uint32 ,
1858
- nativeHistogramMinResetDuration time.Duration ,
1855
+ func NewConstNativeHistogram (desc * Desc , count uint64 , sum float64 , postiveBuckets , negativeBuckets map [int ]int64 , zeroBucket uint64 ,
1856
+ nativeHistogramSchema int32 , nativeHistogramZeroThreshold float64 ,
1857
+ nativeHistogramMaxZeroThreshold float64 ,
1859
1858
createdTimestamp time.Time ,
1860
1859
nativeExemplars []* dto.Exemplar ,
1861
- ) (constNativeHistogram , error ) {
1862
- return constNativeHistogram {
1860
+ labelValues ... string ,
1861
+ ) (Metric , error ) {
1862
+ if desc .err != nil {
1863
+ return nil , desc .err
1864
+ }
1865
+ if err := validateLabelValues (labelValues , len (desc .variableLabels .names )); err != nil {
1866
+ return nil , err
1867
+ }
1868
+ return & constNativeHistogram {
1863
1869
desc : desc ,
1864
1870
count : count ,
1865
1871
sum : sum ,
1866
1872
positiveBuckets : postiveBuckets ,
1867
1873
negativeBuckets : negativeBuckets ,
1868
1874
zeroBucket : zeroBucket ,
1869
- labelPairs : labelPairs ,
1875
+ labelPairs : MakeLabelPairs ( desc , labelValues ) ,
1870
1876
nativeHistogramSchema : nativeHistogramSchema ,
1871
1877
nativeHistogramZeroThreshold : nativeHistogramZeroThreshold ,
1872
1878
nativeHistogramMaxZeroThreshold : nativeHistogramMaxZeroThreshold ,
1873
- nativeHistogramMaxBuckets : nativeHistogramMaxBuckets ,
1874
- nativeHistogramMinResetDuration : nativeHistogramMinResetDuration ,
1875
- timeStamp : timeStamp ,
1879
+ createdTimestamp : createdTimestamp ,
1876
1880
nativeExemplars : nativeExemplars ,
1877
- }
1881
+ }, nil
1878
1882
}
1879
1883
1880
1884
func (h * constNativeHistogram ) Desc () * Desc {
@@ -1883,7 +1887,7 @@ func (h *constNativeHistogram) Desc() *Desc {
1883
1887
1884
1888
func (h * constNativeHistogram ) Write (out * dto.Metric ) error {
1885
1889
his := & dto.Histogram {
1886
- CreatedTimestamp : timestamppb .New (h .timeStamp ),
1890
+ CreatedTimestamp : timestamppb .New (h .createdTimestamp ),
1887
1891
Schema : & h .nativeHistogramSchema ,
1888
1892
ZeroThreshold : & h .nativeHistogramZeroThreshold ,
1889
1893
Exemplars : h .nativeExemplars ,
0 commit comments