File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ func (f *File) Register(c *sql.Collector) error {
55
55
logx .Debug .Println ("Unregister:" , ok )
56
56
if ! ok {
57
57
// This is a fatal error. If the
58
- return fmt .Errorf ("Failed to unregister %q" , f .Name )
58
+ return fmt .Errorf ("failed to unregister %q" , f .Name )
59
59
}
60
60
f .c = nil
61
61
}
@@ -65,10 +65,10 @@ func (f *File) Register(c *sql.Collector) error {
65
65
// While collector Update could fail transiently, this may be a fatal error.
66
66
return err
67
67
}
68
- logx .Debug .Println ("Register: success: " , f .Name )
68
+ logx .Debug .Println ("Register:" , f .Name , c . RegisterErr )
69
69
// Save the registered collector.
70
70
f .c = c
71
- return nil
71
+ return c . RegisterErr
72
72
}
73
73
74
74
// Update runs the collector query again.
Original file line number Diff line number Diff line change @@ -51,6 +51,9 @@ type Collector struct {
51
51
metrics []Metric
52
52
// mux locks access to types above.
53
53
mux sync.Mutex
54
+
55
+ // RegisterErr contains any error during registration. This should be considered fatal.
56
+ RegisterErr error
54
57
}
55
58
56
59
// NewCollector creates a new BigQuery Collector instance.
@@ -76,6 +79,7 @@ func (col *Collector) Describe(ch chan<- *prometheus.Desc) {
76
79
err := col .Update ()
77
80
if err != nil {
78
81
log .Println (err )
82
+ col .RegisterErr = err
79
83
}
80
84
col .setDesc ()
81
85
}
You can’t perform that action at this time.
0 commit comments