aboutsummaryrefslogtreecommitdiffstats
path: root/library/go/core/metrics/solomon/metrics_opts.go
blob: 624b7434a181fe0eecf0808763874688efb05a47 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package solomon

import "time"

type MetricsOpts struct {
	useNameTag bool
	tags       map[string]string
	timestamp  *time.Time
}

type MetricOpt func(*MetricsOpts)

func WithTags(tags map[string]string) func(*MetricsOpts) {
	return func(m *MetricsOpts) {
		m.tags = tags
	}
}

func WithUseNameTag() func(*MetricsOpts) {
	return func(m *MetricsOpts) {
		m.useNameTag = true
	}
}

func WithTimestamp(t time.Time) func(*MetricsOpts) {
	return func(m *MetricsOpts) {
		m.timestamp = &t
	}
}