diff --git a/.github/workflows/go-test.yaml b/.github/workflows/go-test.yaml index cb24379..67e0e0f 100644 --- a/.github/workflows/go-test.yaml +++ b/.github/workflows/go-test.yaml @@ -25,8 +25,8 @@ jobs: - name: Test rpc package run: go test -v ./pkg/rpc - - name: Test solana_exporter - run: go test -v ./cmd/solana_exporter + - name: Test solana-exporter + run: go test -v ./cmd/solana-exporter - name: Run all tests with coverage run: go test -v -coverprofile=coverage.out ./... diff --git a/.gitignore b/.gitignore index 2fd556a..618bd01 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,4 @@ # builds: .builds -/solana_exporter \ No newline at end of file +/solana-exporter \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index d63ccd2..41e8c09 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,7 @@ FROM golang:1.22 as builder COPY . /opt WORKDIR /opt -RUN CGO_ENABLED=0 go build -o /opt/bin/app github.com/asymmetric-research/solana_exporter/cmd/solana_exporter +RUN CGO_ENABLED=0 go build -o /opt/bin/app github.com/asymmetric-research/solana-exporter/cmd/solana-exporter FROM scratch diff --git a/README.md b/README.md index 921643f..c64d150 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ To use the Solana Exporter, simply run the program with the desired [command line configuration](#Command-Line-Arguments), e.g., ```shell -solana_exporter \ +solana-exporter \ -nodekey -nodekey \ -balance-address -balance-address \ -comprehensive-slot-tracking \ @@ -20,13 +20,13 @@ solana_exporter \ ## Installation ### Build -Assuming you already have [Go installed](https://go.dev/doc/install), the `solana_exporter` can be installed by +Assuming you already have [Go installed](https://go.dev/doc/install), the `solana-exporter` can be installed by cloning this repository and building the binary: ```shell -git clone https://github.com/asymmetric-research/solana_exporter.git -cd solana_exporter -CGO_ENABLED=0 go build ./cmd/solana_exporter +git clone https://github.com/asymmetric-research/solana-exporter.git +cd solana-exporter +CGO_ENABLED=0 go build ./cmd/solana-exporter ``` ## Configuration @@ -56,13 +56,10 @@ The exporter is configured via the following command line arguments: * Configuring `-monitor-block-sizes` with many `-nodekey`'s can potentially strain the node - every block produced by a configured `-nodekey` is fetched, and a typical block can be as large as 5MB. -If you want verbose logs, specify `-v=`. Higher verbosity means more debug output. For most users, the default -verbosity level is fine. If you want detailed log output for missed blocks, run with `-v=1`. - ## Metrics ### Overview -The table below describes all the metrics collected by the `solana_exporter`: +The table below describes all the metrics collected by the `solana-exporter`: | Metric | Description | Labels | |-------------------------------------|------------------------------------------------------------------------------------------|-------------------------------| diff --git a/cmd/solana_exporter/config.go b/cmd/solana-exporter/config.go similarity index 92% rename from cmd/solana_exporter/config.go rename to cmd/solana-exporter/config.go index 1faf621..ba9128b 100644 --- a/cmd/solana_exporter/config.go +++ b/cmd/solana-exporter/config.go @@ -4,8 +4,8 @@ import ( "context" "flag" "fmt" - "github.com/asymmetric-research/solana_exporter/pkg/rpc" - "github.com/asymmetric-research/solana_exporter/pkg/slog" + "github.com/asymmetric-research/solana-exporter/pkg/rpc" + "github.com/asymmetric-research/solana-exporter/pkg/slog" "time" ) @@ -61,19 +61,19 @@ func NewExporterConfig( ) if lightMode { if comprehensiveSlotTracking { - return nil, fmt.Errorf("'-light-mode' is imcompatible with `-comprehensive-slot-tracking`") + return nil, fmt.Errorf("'-light-mode' is incompatible with `-comprehensive-slot-tracking`") } if monitorBlockSizes { - return nil, fmt.Errorf("'-light-mode' is imcompatible with `-monitor-block-sizes`") + return nil, fmt.Errorf("'-light-mode' is incompatible with `-monitor-block-sizes`") } if len(nodeKeys) > 0 { - return nil, fmt.Errorf("'-light-mode' is imcompatible with `-nodekey`") + return nil, fmt.Errorf("'-light-mode' is incompatible with `-nodekey`") } if len(balanceAddresses) > 0 { - return nil, fmt.Errorf("'-light-mode' is imcompatible with `-balance-addresses`") + return nil, fmt.Errorf("'-light-mode' is incompatible with `-balance-addresses`") } } diff --git a/cmd/solana_exporter/config_test.go b/cmd/solana-exporter/config_test.go similarity index 100% rename from cmd/solana_exporter/config_test.go rename to cmd/solana-exporter/config_test.go diff --git a/cmd/solana_exporter/desc.go b/cmd/solana-exporter/desc.go similarity index 94% rename from cmd/solana_exporter/desc.go rename to cmd/solana-exporter/desc.go index adbe36d..5798de4 100644 --- a/cmd/solana_exporter/desc.go +++ b/cmd/solana-exporter/desc.go @@ -1,7 +1,7 @@ package main import ( - "github.com/asymmetric-research/solana_exporter/pkg/slog" + "github.com/asymmetric-research/solana-exporter/pkg/slog" "github.com/prometheus/client_golang/prometheus" ) diff --git a/cmd/solana_exporter/desc_test.go b/cmd/solana-exporter/desc_test.go similarity index 100% rename from cmd/solana_exporter/desc_test.go rename to cmd/solana-exporter/desc_test.go diff --git a/cmd/solana_exporter/exporter.go b/cmd/solana-exporter/exporter.go similarity index 98% rename from cmd/solana_exporter/exporter.go rename to cmd/solana-exporter/exporter.go index a5cc070..d7fa7c6 100644 --- a/cmd/solana_exporter/exporter.go +++ b/cmd/solana-exporter/exporter.go @@ -4,8 +4,8 @@ import ( "context" "errors" "fmt" - "github.com/asymmetric-research/solana_exporter/pkg/rpc" - "github.com/asymmetric-research/solana_exporter/pkg/slog" + "github.com/asymmetric-research/solana-exporter/pkg/rpc" + "github.com/asymmetric-research/solana-exporter/pkg/slog" "github.com/prometheus/client_golang/prometheus" "go.uber.org/zap" ) diff --git a/cmd/solana_exporter/exporter_test.go b/cmd/solana-exporter/exporter_test.go similarity index 99% rename from cmd/solana_exporter/exporter_test.go rename to cmd/solana-exporter/exporter_test.go index 66b2fa5..d7e2f08 100644 --- a/cmd/solana_exporter/exporter_test.go +++ b/cmd/solana-exporter/exporter_test.go @@ -4,7 +4,7 @@ import ( "bytes" "context" "fmt" - "github.com/asymmetric-research/solana_exporter/pkg/rpc" + "github.com/asymmetric-research/solana-exporter/pkg/rpc" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/testutil" "github.com/stretchr/testify/assert" diff --git a/cmd/solana_exporter/main.go b/cmd/solana-exporter/main.go similarity index 89% rename from cmd/solana_exporter/main.go rename to cmd/solana-exporter/main.go index 5330980..3012b94 100644 --- a/cmd/solana_exporter/main.go +++ b/cmd/solana-exporter/main.go @@ -2,8 +2,8 @@ package main import ( "context" - "github.com/asymmetric-research/solana_exporter/pkg/rpc" - "github.com/asymmetric-research/solana_exporter/pkg/slog" + "github.com/asymmetric-research/solana-exporter/pkg/rpc" + "github.com/asymmetric-research/solana-exporter/pkg/slog" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promhttp" "net/http" diff --git a/cmd/solana_exporter/main_test.go b/cmd/solana-exporter/main_test.go similarity index 67% rename from cmd/solana_exporter/main_test.go rename to cmd/solana-exporter/main_test.go index b3f39d6..48258f6 100644 --- a/cmd/solana_exporter/main_test.go +++ b/cmd/solana-exporter/main_test.go @@ -1,7 +1,7 @@ package main import ( - "github.com/asymmetric-research/solana_exporter/pkg/slog" + "github.com/asymmetric-research/solana-exporter/pkg/slog" "os" "testing" ) diff --git a/cmd/solana_exporter/slots.go b/cmd/solana-exporter/slots.go similarity index 99% rename from cmd/solana_exporter/slots.go rename to cmd/solana-exporter/slots.go index 1a628d4..69ccd64 100644 --- a/cmd/solana_exporter/slots.go +++ b/cmd/solana-exporter/slots.go @@ -4,13 +4,13 @@ import ( "context" "errors" "fmt" - "github.com/asymmetric-research/solana_exporter/pkg/slog" + "github.com/asymmetric-research/solana-exporter/pkg/slog" "go.uber.org/zap" "slices" "strings" "time" - "github.com/asymmetric-research/solana_exporter/pkg/rpc" + "github.com/asymmetric-research/solana-exporter/pkg/rpc" "github.com/prometheus/client_golang/prometheus" ) diff --git a/cmd/solana_exporter/slots_test.go b/cmd/solana-exporter/slots_test.go similarity index 99% rename from cmd/solana_exporter/slots_test.go rename to cmd/solana-exporter/slots_test.go index f65629f..6c1e563 100644 --- a/cmd/solana_exporter/slots_test.go +++ b/cmd/solana-exporter/slots_test.go @@ -3,7 +3,7 @@ package main import ( "context" "fmt" - "github.com/asymmetric-research/solana_exporter/pkg/rpc" + "github.com/asymmetric-research/solana-exporter/pkg/rpc" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/testutil" "github.com/stretchr/testify/assert" diff --git a/cmd/solana_exporter/testdata/block-297609329.json b/cmd/solana-exporter/testdata/block-297609329.json similarity index 100% rename from cmd/solana_exporter/testdata/block-297609329.json rename to cmd/solana-exporter/testdata/block-297609329.json diff --git a/cmd/solana_exporter/utils.go b/cmd/solana-exporter/utils.go similarity index 97% rename from cmd/solana_exporter/utils.go rename to cmd/solana-exporter/utils.go index 12c7ca2..3578cd4 100644 --- a/cmd/solana_exporter/utils.go +++ b/cmd/solana-exporter/utils.go @@ -4,8 +4,8 @@ import ( "context" "encoding/json" "fmt" - "github.com/asymmetric-research/solana_exporter/pkg/rpc" - "github.com/asymmetric-research/solana_exporter/pkg/slog" + "github.com/asymmetric-research/solana-exporter/pkg/rpc" + "github.com/asymmetric-research/solana-exporter/pkg/slog" "slices" ) diff --git a/cmd/solana_exporter/utils_test.go b/cmd/solana-exporter/utils_test.go similarity index 95% rename from cmd/solana_exporter/utils_test.go rename to cmd/solana-exporter/utils_test.go index 708ac36..ed689bb 100644 --- a/cmd/solana_exporter/utils_test.go +++ b/cmd/solana-exporter/utils_test.go @@ -4,7 +4,7 @@ import ( "context" _ "embed" "encoding/json" - "github.com/asymmetric-research/solana_exporter/pkg/rpc" + "github.com/asymmetric-research/solana-exporter/pkg/rpc" "github.com/stretchr/testify/assert" "testing" ) @@ -101,4 +101,5 @@ func TestCountVoteTransactions(t *testing.T) { assert.NoError(t, err) // https://explorer.solana.com/block/297609329 assert.Equal(t, 1048, voteCount) + assert.Equal(t, 446, len(block.Transactions)-voteCount) } diff --git a/go.mod b/go.mod index 361a7d5..0993ab5 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/asymmetric-research/solana_exporter +module github.com/asymmetric-research/solana-exporter go 1.22 diff --git a/pkg/rpc/client.go b/pkg/rpc/client.go index a05b7fa..bd9e018 100644 --- a/pkg/rpc/client.go +++ b/pkg/rpc/client.go @@ -5,7 +5,7 @@ import ( "context" "encoding/json" "fmt" - "github.com/asymmetric-research/solana_exporter/pkg/slog" + "github.com/asymmetric-research/solana-exporter/pkg/slog" "go.uber.org/zap" "io" "net/http" diff --git a/pkg/rpc/client_test.go b/pkg/rpc/client_test.go index 9b57f39..b21b512 100644 --- a/pkg/rpc/client_test.go +++ b/pkg/rpc/client_test.go @@ -7,6 +7,7 @@ import ( ) func newMethodTester(t *testing.T, method string, result any) (*MockServer, *Client) { + t.Helper() return NewMockClient(t, map[string]any{method: result}, nil, nil, nil, nil) } diff --git a/pkg/rpc/mock.go b/pkg/rpc/mock.go index 2b061c8..0e1b209 100644 --- a/pkg/rpc/mock.go +++ b/pkg/rpc/mock.go @@ -4,7 +4,7 @@ import ( "context" "encoding/json" "fmt" - "github.com/asymmetric-research/solana_exporter/pkg/slog" + "github.com/asymmetric-research/solana-exporter/pkg/slog" "go.uber.org/zap" "net" "net/http" diff --git a/pkg/rpc/rpc_test.go b/pkg/rpc/rpc_test.go index aeb0fae..eaadf67 100644 --- a/pkg/rpc/rpc_test.go +++ b/pkg/rpc/rpc_test.go @@ -1,7 +1,7 @@ package rpc import ( - "github.com/asymmetric-research/solana_exporter/pkg/slog" + "github.com/asymmetric-research/solana-exporter/pkg/slog" "os" "testing" )