Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(BUX-416) disable monitor #380

Merged
merged 3 commits into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions config.example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,18 +69,6 @@ graphql:
enabled: false
import_block_headers: ""
# Prefixed with "_", because it's unused by default
_monitor:
auth_token: ""
bux_agent_url: ws://localhost:8000/websocket
debug: false
enabled: false
false_positive_rate: 0.01
load_monitored_destinations: false
max_number_of_destinations: 100000
monitor_days: 7
processor_type: bloom
save_transaction_destinations: true
# Prefixed with "_", because it's unused by default
_new_relic:
domain_name: domain.com
enabled: false
Expand Down
26 changes: 0 additions & 26 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ type AppConfig struct {
ImportBlockHeaders string `json:"import_block_headers" mapstructure:"import_block_headers"`
// Logging is the configuration for zerolog used in bux.
Logging *LoggingConfig `json:"logging" mapstructure:"logging"`
// Monitor is a monitor service related settings for legacy bitcoin addresses.
Monitor *MonitorOptions `json:"monitor" mapstructure:"monitor"`
// NewRelic is New Relic related settings.
NewRelic *NewRelicConfig `json:"new_relic" mapstructure:"new_relic"`
// Nodes is a config for BSV nodes, mAPI and Arc.
Expand Down Expand Up @@ -139,30 +137,6 @@ type GraphqlConfig struct {
Enabled bool `json:"enabled" mapstructure:"enabled"`
}

// MonitorOptions is the configuration for blockchain monitoring
type MonitorOptions struct {
// AuthToken is a token to connect to the server with.
AuthToken string `json:"auth_token" mapstructure:"auth_token"`
// BuxAgentURL is the BUX agent server url address.
BuxAgentURL string `json:"bux_agent_url" mapstructure:"bux_agent_url"`
// Debug is the flag that says whether additional input from monitor should be produced.
Debug bool `json:"debug" mapstructure:"debug"`
// Enabled is the flag that enables monitor service.
Enabled bool `json:"enabled" mapstructure:"enabled"`
// FalsePositiveRate is the percentage of how many false positives we except.
FalsePositiveRate float64 `json:"false_positive_rate" mapstructure:"false_positive_rate"`
// LoadMonitoredDestinations is a flag that says whether to load monitored destinations.
LoadMonitoredDestinations bool `json:"load_monitored_destinations" mapstructure:"load_monitored_destinations"`
// MaxNumberOfDestinations is a number of destinations that the filter can hold (default: 100,000).
MaxNumberOfDestinations int `json:"max_number_of_destinations" mapstructure:"max_number_of_destinations"`
// MonitorDays is the number of days in the past that we should monitor an address (default: 7).
MonitorDays int `json:"monitor_days" mapstructure:"monitor_days"`
// ProcessorType is the type of processor to start monitor with. Default: bloom.
ProcessorType string `json:"processor_type" mapstructure:"processor_type"`
// SaveTransactionDestinations says whether to save destinations on monitored transactions.
SaveTransactionDestinations bool `json:"save_transaction_destinations" mapstructure:"save_transaction_destinations"`
}

// NewRelicConfig is the configuration for New Relic
type NewRelicConfig struct {
// DomainName is used for hostname display.
Expand Down
16 changes: 0 additions & 16 deletions config/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ func getDefaultAppConfig() *AppConfig {
GraphQL: getGraphqlDefaults(),
ImportBlockHeaders: "",
Logging: getLoggingDefaults(),
Monitor: getMonitorDefaults(),
NewRelic: getNewRelicDefaults(),
Nodes: getNodesDefaults(),
Notifications: getNotificationDefaults(),
Expand Down Expand Up @@ -107,21 +106,6 @@ func getLoggingDefaults() *LoggingConfig {
}
}

func getMonitorDefaults() *MonitorOptions {
return &MonitorOptions{
AuthToken: "",
BuxAgentURL: "ws://localhost:8000/websocket",
Debug: false,
Enabled: false,
FalsePositiveRate: 0.01,
LoadMonitoredDestinations: false,
MaxNumberOfDestinations: 100000,
MonitorDays: 7,
ProcessorType: "bloom",
SaveTransactionDestinations: true,
}
}

func getNewRelicDefaults() *NewRelicConfig {
return &NewRelicConfig{
DomainName: "domain.com",
Expand Down
25 changes: 0 additions & 25 deletions config/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (

"github.com/BuxOrg/bux"
"github.com/BuxOrg/bux-server/logging"
"github.com/BuxOrg/bux/chainstate"
"github.com/BuxOrg/bux/cluster"
"github.com/BuxOrg/bux/taskmanager"
"github.com/BuxOrg/bux/utils"
Expand Down Expand Up @@ -188,10 +187,6 @@ func (s *AppServices) loadBux(ctx context.Context, appConfig *AppConfig, testMod
options = append(options, bux.WithNotifications(appConfig.Notifications.WebhookEndpoint))
}

if options, err = loadMonitor(ctx, appConfig, options); err != nil {
return err
}

if appConfig.Nodes.UseMapiFeeQuotes {
options = append(options, bux.WithMinercraftFeeQuotes())
}
Expand Down Expand Up @@ -404,26 +399,6 @@ func loadTaskManager(appConfig *AppConfig, options []bux.ClientOps) []bux.Client
return options
}

func loadMonitor(ctx context.Context, appConfig *AppConfig, options []bux.ClientOps) ([]bux.ClientOps, error) {
if appConfig.Monitor != nil && appConfig.Monitor.Enabled {
if appConfig.Monitor.BuxAgentURL == "" {
err := errors.New("CentrifugeServer is required for monitoring to work")
return options, err
}
options = append(options, bux.WithMonitoring(ctx, &chainstate.MonitorOptions{
Debug: appConfig.Monitor.Debug,
BuxAgentURL: appConfig.Monitor.BuxAgentURL,
MonitorDays: appConfig.Monitor.MonitorDays,
AuthToken: appConfig.Monitor.AuthToken,
FalsePositiveRate: appConfig.Monitor.FalsePositiveRate,
MaxNumberOfDestinations: appConfig.Monitor.MaxNumberOfDestinations,
SaveTransactionDestinations: appConfig.Monitor.SaveTransactionDestinations,
LoadMonitoredDestinations: appConfig.Monitor.LoadMonitoredDestinations,
}))
}
return options, nil
}

func loadBroadcastClientAPI(appConfig *AppConfig, options []bux.ClientOps) []bux.ClientOps {
if appConfig.Nodes.BroadcastClientAPIs != nil {
arcClientConfigs := splitBroadcastClientApis(appConfig.Nodes.BroadcastClientAPIs)
Expand Down
2 changes: 1 addition & 1 deletion go.mod

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading