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
}
func newSolanaCollector(rpcAddr string) *solanaCollector {
func NewSolanaCollector(rpcAddr string) *solanaCollector {
return &solanaCollector{
rpcClient: rpc.NewRPCClient(rpcAddr),
totalValidatorsDesc: prometheus.NewDesc(
@ -132,7 +132,7 @@ func main() {
httpTimeout = time.Duration(*httpTimeoutSecs) * time.Second
collector := newSolanaCollector(*rpcAddr)
collector := NewSolanaCollector(*rpcAddr)
go collector.WatchSlots()

View File

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