diff --git a/cmd/stellar-rpc/internal/config/options.go b/cmd/stellar-rpc/internal/config/options.go index 0720ab73..07acd6ca 100644 --- a/cmd/stellar-rpc/internal/config/options.go +++ b/cmd/stellar-rpc/internal/config/options.go @@ -33,15 +33,17 @@ func (cfg *Config) options() Options { defaultStellarCoreBinaryPath, _ := exec.LookPath("stellar-core") cfg.optionsCache = &Options{ { - Name: "config-path", - EnvVar: "STELLAR_RPC_CONFIG_PATH", + Name: "config-path", + // TODO: deprecate and rename to STELLAR_RPC_ + EnvVar: "SOROBAN_RPC_CONFIG_PATH", TomlKey: "-", Usage: "File path to the toml configuration file", ConfigKey: &cfg.ConfigPath, }, { - Name: "config-strict", - EnvVar: "STELLAR_RPC_CONFIG_STRICT", + Name: "config-strict", + // TODO: deprecate and rename to STELLAR_RPC_ + EnvVar: "SOROBAN_RPC_CONFIG_STRICT", TomlKey: "STRICT", Usage: "Enable strict toml configuration file parsing. This will prevent unknown fields in the config toml from being parsed.", ConfigKey: &cfg.Strict, @@ -197,10 +199,11 @@ func (cfg *Config) options() Options { Validate: required, }, { - Name: "db-path", - Usage: "SQLite DB path", - ConfigKey: &cfg.SQLiteDBPath, - DefaultValue: "stellar_rpc.sqlite", + Name: "db-path", + Usage: "SQLite DB path", + ConfigKey: &cfg.SQLiteDBPath, + // TODO: deprecate and rename to stellar_rpc.sqlite + DefaultValue: "soroban_rpc.sqlite", }, { Name: "ingestion-timeout", diff --git a/cmd/stellar-rpc/internal/daemon/daemon.go b/cmd/stellar-rpc/internal/daemon/daemon.go index 6f97588d..232c8d1a 100644 --- a/cmd/stellar-rpc/internal/daemon/daemon.go +++ b/cmd/stellar-rpc/internal/daemon/daemon.go @@ -27,6 +27,7 @@ import ( "github.com/stellar/stellar-rpc/cmd/stellar-rpc/internal" "github.com/stellar/stellar-rpc/cmd/stellar-rpc/internal/config" + "github.com/stellar/stellar-rpc/cmd/stellar-rpc/internal/daemon/interfaces" "github.com/stellar/stellar-rpc/cmd/stellar-rpc/internal/db" "github.com/stellar/stellar-rpc/cmd/stellar-rpc/internal/feewindow" "github.com/stellar/stellar-rpc/cmd/stellar-rpc/internal/ingest" @@ -35,7 +36,6 @@ import ( ) const ( - prometheusNamespace = "stellar_rpc" maxLedgerEntryWriteBatchSize = 150 defaultReadTimeout = 5 * time.Second defaultShutdownGracePeriod = 10 * time.Second @@ -220,7 +220,7 @@ func mustCreateHistoryArchive(cfg *config.Config, logger *supportlog.Entry) *his } func mustOpenDatabase(cfg *config.Config, logger *supportlog.Entry, metricsRegistry *prometheus.Registry) *db.DB { - dbConn, err := db.OpenSQLiteDBWithPrometheusMetrics(cfg.SQLiteDBPath, prometheusNamespace, "db", metricsRegistry) + dbConn, err := db.OpenSQLiteDBWithPrometheusMetrics(cfg.SQLiteDBPath, interfaces.interfaces.PrometheusNamespace, "db", metricsRegistry) if err != nil { logger.WithError(err).Fatal("could not open database") } diff --git a/cmd/stellar-rpc/internal/daemon/interfaces/noOpDaemon.go b/cmd/stellar-rpc/internal/daemon/interfaces/noOpDaemon.go index 1a3014be..ca66802a 100644 --- a/cmd/stellar-rpc/internal/daemon/interfaces/noOpDaemon.go +++ b/cmd/stellar-rpc/internal/daemon/interfaces/noOpDaemon.go @@ -9,6 +9,9 @@ import ( proto "github.com/stellar/go/protocols/stellarcore" ) +// TODO: deprecate and rename to stellar_rpc +const PrometheusNamespace = "soroban_rpc" + // NoOpDaemon The noOpDeamon is a dummy daemon implementation, supporting the Daemon interface. // Used only in testing. type NoOpDaemon struct { @@ -21,7 +24,7 @@ type NoOpDaemon struct { func MakeNoOpDeamon() *NoOpDaemon { return &NoOpDaemon{ metricsRegistry: prometheus.NewRegistry(), - metricsNamespace: "stellar_rpc", + metricsNamespace: PrometheusNamespace, coreClient: noOpCoreClient{}, } } diff --git a/cmd/stellar-rpc/internal/daemon/metrics.go b/cmd/stellar-rpc/internal/daemon/metrics.go index c7d9dd6d..db799a59 100644 --- a/cmd/stellar-rpc/internal/daemon/metrics.go +++ b/cmd/stellar-rpc/internal/daemon/metrics.go @@ -21,14 +21,14 @@ import ( func (d *Daemon) registerMetrics() { // LogMetricsHook is a metric which counts log lines emitted by stellar rpc - logMetricsHook := logmetrics.New(prometheusNamespace) + logMetricsHook := logmetrics.New(interfaces.PrometheusNamespace) d.logger.AddHook(logMetricsHook) for _, counter := range logMetricsHook { d.metricsRegistry.MustRegister(counter) } buildInfoGauge := prometheus.NewGaugeVec( - prometheus.GaugeOpts{Namespace: prometheusNamespace, Subsystem: "build", Name: "info"}, + prometheus.GaugeOpts{Namespace: interfaces.PrometheusNamespace, Subsystem: "build", Name: "info"}, []string{"version", "goversion", "commit", "branch", "build_timestamp"}, ) buildInfoGauge.With(prometheus.Labels{ @@ -49,7 +49,7 @@ func (d *Daemon) MetricsRegistry() *prometheus.Registry { } func (d *Daemon) MetricsNamespace() string { - return prometheusNamespace + return interfaces.PrometheusNamespace } type CoreClientWithMetrics struct { @@ -60,12 +60,12 @@ type CoreClientWithMetrics struct { func newCoreClientWithMetrics(client stellarcore.Client, registry *prometheus.Registry) *CoreClientWithMetrics { submitMetric := prometheus.NewSummaryVec(prometheus.SummaryOpts{ - Namespace: prometheusNamespace, Subsystem: "txsub", Name: "submission_duration_seconds", + Namespace: interfaces.PrometheusNamespace, Subsystem: "txsub", Name: "submission_duration_seconds", Help: "submission durations to Stellar-Core, sliding window = 10m", Objectives: map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001}, //nolint:mnd }, []string{"status"}) opCountMetric := prometheus.NewSummaryVec(prometheus.SummaryOpts{ - Namespace: prometheusNamespace, Subsystem: "txsub", Name: "operation_count", + Namespace: interfaces.PrometheusNamespace, Subsystem: "txsub", Name: "operation_count", Help: "number of operations included in a transaction, sliding window = 10m", Objectives: map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001}, //nolint:mnd }, []string{"status"}) diff --git a/cmd/stellar-rpc/internal/integrationtest/metrics_test.go b/cmd/stellar-rpc/internal/integrationtest/metrics_test.go index 49f7289e..4857c3f3 100644 --- a/cmd/stellar-rpc/internal/integrationtest/metrics_test.go +++ b/cmd/stellar-rpc/internal/integrationtest/metrics_test.go @@ -23,7 +23,7 @@ func TestMetrics(t *testing.T) { require.NoError(t, err) metrics := getMetrics(t, metricsURL) buildMetric := fmt.Sprintf( - "stellar_rpc_build_info{branch=\"%s\",build_timestamp=\"%s\",commit=\"%s\",goversion=\"%s\",version=\"%s\"} 1", + "soroban_rpc_build_info{branch=\"%s\",build_timestamp=\"%s\",commit=\"%s\",goversion=\"%s\",version=\"%s\"} 1", config.Branch, config.BuildTimestamp, config.CommitHash, @@ -42,7 +42,7 @@ func TestMetrics(t *testing.T) { assert.NoError(t, err) var metric *io_prometheus_client.MetricFamily for _, mf := range metricFamilies { - if mf.GetName() == "stellar_rpc_log_error_total" { + if mf.GetName() == "soroban_rpc_log_error_total" { metric = mf break }