|
4 | 4 | "database/sql"
|
5 | 5 | "fmt"
|
6 | 6 | "sort"
|
| 7 | + "strconv" |
7 | 8 | "sync"
|
8 | 9 | "time"
|
9 | 10 |
|
@@ -49,37 +50,42 @@ func NewWriter(conf *config) (*promWriter, error) {
|
49 | 50 |
|
50 | 51 | w.tx = prometheus.NewCounter(
|
51 | 52 | prometheus.CounterOpts{
|
52 |
| - Name: "sent_samples_total", |
53 |
| - Help: "Total number of processed samples sent to remote storage.", |
| 53 | + Name: "sent_samples_total", |
| 54 | + Help: "Total number of processed samples sent to remote storage.", |
| 55 | + ConstLabels: map[string]string{"host": conf.Host, "port": strconv.Itoa(conf.Port)}, |
54 | 56 | },
|
55 | 57 | )
|
56 | 58 |
|
57 | 59 | w.ko = prometheus.NewCounter(
|
58 | 60 | prometheus.CounterOpts{
|
59 |
| - Name: "failed_samples_total", |
60 |
| - Help: "Total number of processed samples which failed on send to remote storage.", |
| 61 | + Name: "failed_samples_total", |
| 62 | + Help: "Total number of processed samples which failed on send to remote storage.", |
| 63 | + ConstLabels: map[string]string{"host": conf.Host, "port": strconv.Itoa(conf.Port)}, |
61 | 64 | },
|
62 | 65 | )
|
63 | 66 |
|
64 | 67 | w.test = prometheus.NewCounter(
|
65 | 68 | prometheus.CounterOpts{
|
66 |
| - Name: "prometheus_remote_storage_sent_batch_duration_seconds_bucket_test", |
67 |
| - Help: "Test metric to ensure backfilled metrics are readable via prometheus.", |
| 69 | + Name: "prometheus_remote_storage_sent_batch_duration_seconds_bucket_test", |
| 70 | + Help: "Test metric to ensure backfilled metrics are readable via prometheus.", |
| 71 | + ConstLabels: map[string]string{"host": conf.Host, "port": strconv.Itoa(conf.Port)}, |
68 | 72 | },
|
69 | 73 | )
|
70 | 74 |
|
71 | 75 | w.timings = prometheus.NewHistogram(
|
72 | 76 | prometheus.HistogramOpts{
|
73 |
| - Name: "sent_batch_duration_seconds", |
74 |
| - Help: "Duration of sample batch send calls to the remote storage.", |
75 |
| - Buckets: prometheus.DefBuckets, |
| 77 | + Name: "sent_batch_duration_seconds", |
| 78 | + Help: "Duration of sample batch send calls to the remote storage.", |
| 79 | + Buckets: prometheus.DefBuckets, |
| 80 | + ConstLabels: map[string]string{"host": conf.Host, "port": strconv.Itoa(conf.Port)}, |
76 | 81 | },
|
77 | 82 | )
|
78 | 83 |
|
79 | 84 | w.rx = prometheus.NewCounter(
|
80 | 85 | prometheus.CounterOpts{
|
81 |
| - Name: "received_samples_total", |
82 |
| - Help: "Total number of received samples.", |
| 86 | + Name: "received_samples_total", |
| 87 | + Help: "Total number of received samples.", |
| 88 | + ConstLabels: map[string]string{"host": conf.Host, "port": strconv.Itoa(conf.Port)}, |
83 | 89 | },
|
84 | 90 | )
|
85 | 91 |
|
|
0 commit comments