Skip to content
This repository has been archived by the owner on Oct 3, 2023. It is now read-only.

Commit

Permalink
rename functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
rghetia committed Feb 27, 2019
1 parent 7f986e6 commit 36e81b3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -475,13 +475,13 @@ func protoToMetricPoint(value interface{}) (*monitoringpb.TypedValue, error) {
// The first bucket bound should be 0.0 because the Metrics first bucket is
// [0, first_bound) but Stackdriver monitoring bucket bounds begin with -infinity
// (first bucket is (-infinity, 0))
Bounds: addZeroBound(insertZeroBound, bexp.Explicit.Bounds...),
Bounds: addZeroBoundOnCondition(insertZeroBound, bexp.Explicit.Bounds...),
},
},
}
}
}
mv.DistributionValue.BucketCounts = addZeroBucketCount(insertZeroBound, bucketCounts(dv.Buckets)...)
mv.DistributionValue.BucketCounts = addZeroBucketCountOnCondition(insertZeroBound, bucketCounts(dv.Buckets)...)

}
tval = &monitoringpb.TypedValue{Value: mv}
Expand Down
8 changes: 4 additions & 4 deletions stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -437,11 +437,11 @@ func newTypedValue(vd *view.View, r *view.Row) *monitoringpb.TypedValue {
BucketOptions: &distributionpb.Distribution_BucketOptions{
Options: &distributionpb.Distribution_BucketOptions_ExplicitBuckets{
ExplicitBuckets: &distributionpb.Distribution_BucketOptions_Explicit{
Bounds: addZeroBound(insertZeroBound, vd.Aggregation.Buckets...),
Bounds: addZeroBoundOnCondition(insertZeroBound, vd.Aggregation.Buckets...),
},
},
},
BucketCounts: addZeroBucketCount(insertZeroBound, v.CountPerBucket...),
BucketCounts: addZeroBucketCountOnCondition(insertZeroBound, v.CountPerBucket...),
},
}}
case *view.LastValueData:
Expand All @@ -466,14 +466,14 @@ func shouldInsertZeroBound(bounds ...float64) bool {
return false
}

func addZeroBucketCount(insert bool, counts ...int64) []int64 {
func addZeroBucketCountOnCondition(insert bool, counts ...int64) []int64 {
if insert {
return append([]int64{0}, counts...)
}
return counts
}

func addZeroBound(insert bool, bounds ...float64) []float64 {
func addZeroBoundOnCondition(insert bool, bounds ...float64) []float64 {
if insert {
return append([]float64{0.0}, bounds...)
}
Expand Down

0 comments on commit 36e81b3

Please sign in to comment.