Skip to content
This repository was archived by the owner on Dec 3, 2024. It is now read-only.

Commit de9a6c4

Browse files
committed
configurable sample metric bucket ranges
1 parent 2c12eb8 commit de9a6c4

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

stackdriver.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,17 @@ func DefaultBucketer(name string) []float64 {
7979
// NewSink creates a Sink to flush metrics to stackdriver every interval. The
8080
// interval should be greater than 1 minute.
8181
func NewSink(interval time.Duration, taskInfo *TaskInfo, client *monitoring.MetricClient) *Sink {
82+
return NewSinkCustomBucket(interval, taskInfo, client, DefaultBucketer)
83+
}
84+
85+
// NewSinkCustomBucket creates a Sink to flush metrics to stackdriver every
86+
// interval. The bucketer is used to determine histogram bucket thresholds
87+
// for the sampled metrics.
88+
func NewSinkCustomBucket(interval time.Duration, taskInfo *TaskInfo, client *monitoring.MetricClient, bucketer BucketFn) *Sink {
8289
s := &Sink{
8390
client: client,
8491
interval: interval,
85-
bucketer: DefaultBucketer,
92+
bucketer: bucketer,
8693
taskInfo: taskInfo,
8794
}
8895
s.reset()

0 commit comments

Comments
 (0)