aboutsummaryrefslogtreecommitdiffstats
path: root/library/go/core/metrics/solomon/metrics_opts.go
blob: d9ade67966919cf82ff9bde16099d49252ace1b7 (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 metricOpts 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
	}
}