reverted NewSolanaCollector name + more of Jeff's nits

This commit is contained in:
Matt Johnstone 2024-06-11 20:11:12 +02:00
parent 8601796d18
commit 05a5c6d710
No known key found for this signature in database
GPG Key ID: BE985FBB9BE7D3BB
3 changed files with 10 additions and 7 deletions

6
.gitignore vendored
View File

@ -0,0 +1,6 @@
# for prometheus configs:
.prometheus
# builds:
.builds
solana_exporter

View File

@ -35,7 +35,7 @@ type solanaCollector struct {
solanaVersion *prometheus.Desc solanaVersion *prometheus.Desc
} }
func newSolanaCollector(rpcAddr string) *solanaCollector { func NewSolanaCollector(rpcAddr string) *solanaCollector {
return &solanaCollector{ return &solanaCollector{
rpcClient: rpc.NewRPCClient(rpcAddr), rpcClient: rpc.NewRPCClient(rpcAddr),
totalValidatorsDesc: prometheus.NewDesc( totalValidatorsDesc: prometheus.NewDesc(
@ -132,7 +132,7 @@ func main() {
httpTimeout = time.Duration(*httpTimeoutSecs) * time.Second httpTimeout = time.Duration(*httpTimeoutSecs) * time.Second
collector := newSolanaCollector(*rpcAddr) collector := NewSolanaCollector(*rpcAddr)
go collector.WatchSlots() go collector.WatchSlots()

View File

@ -87,11 +87,8 @@ func (c *Client) rpcRequest(ctx context.Context, data io.Reader) ([]byte, error)
if err != nil { if err != nil {
return nil, err return nil, err
} }
defer func() { //goland:noinspection GoUnhandledErrorResult
if err := resp.Body.Close(); err != nil { defer resp.Body.Close()
klog.Errorf("could not close response body: %v", err)
}
}()
body, err := io.ReadAll(resp.Body) body, err := io.ReadAll(resp.Body)
if err != nil { if err != nil {