state

package
v0.56.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 19, 2024 License: BSD-2-Clause, BSD-3-Clause, PostgreSQL Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RecommendedSettings = SetupSettings{
	DBUsername: null.StringFrom("pganalyze"),
}
View Source
var SupportedLogLinePrefixes []string

Functions

This section is empty.

Types

type SetupGUCS

type SetupGUCS struct {
	LogErrorVerbosity       null.String `json:"log_error_verbosity"`
	LogDuration             null.String `json:"log_duration"`
	LogStatement            null.String `json:"log_statement"`
	LogMinDurationStatement null.Int    `json:"log_min_duration_statement"`
	LogLinePrefix           null.String `json:"log_line_prefix"`

	AutoExplainLogAnalyze          null.String `json:"auto_explain.log_analyze"`
	AutoExplainLogBuffers          null.String `json:"auto_explain.log_buffers"`
	AutoExplainLogTiming           null.String `json:"auto_explain.log_timing"`
	AutoExplainLogTriggers         null.String `json:"auto_explain.log_triggers"`
	AutoExplainLogVerbose          null.String `json:"auto_explain.log_verbose"`
	AutoExplainLogFormat           null.String `json:"auto_explain.log_format"`
	AutoExplainLogMinDuration      null.Int    `json:"auto_explain.log_min_duration"`
	AutoExplainLogNestedStatements null.String `json:"auto_explain.log_nested_statements"`
}
var RecommendedGUCS SetupGUCS

type SetupInputs

type SetupInputs struct {
	Scripted bool

	Settings SetupSettings `json:"settings"`
	GUCS     SetupGUCS     `json:"gucs"`

	PGSetupConnSocketDir null.String `json:"pg_setup_conn_socket_dir"`
	PGSetupConnPort      null.Int    `json:"pg_setup_conn_port"`
	PGSetupConnUser      null.String `json:"pg_setup_conn_user"`

	EnsureMonitoringUser            null.Bool `json:"ensure_monitoring_user"`
	GenerateMonitoringPassword      null.Bool `json:"generate_monitoring_password"`
	EnsureMonitoringPassword        null.Bool `json:"ensure_monitoring_password"`
	EnsureMonitoringPermissions     null.Bool `json:"ensure_monitoring_permissions"`
	EnsureHelperFunctions           null.Bool `json:"ensure_helper_functions"`
	EnsurePgStatStatementsInstalled null.Bool `json:"ensure_pg_stat_statements_installed"`
	EnsurePgStatStatementsLoaded    null.Bool `json:"ensure_pg_stat_statements_loaded"`

	GuessLogLocation null.Bool `json:"guess_log_location"`

	UseLogBasedExplain      null.Bool `json:"use_log_based_explain"`
	EnsureLogExplainHelpers null.Bool `json:"ensure_log_explain_helpers"`
	EnsureAutoExplainLoaded null.Bool `json:"ensure_auto_explain_loaded"`

	ConfirmPostgresRestart null.Bool `json:"confirm_postgres_restart"`

	ConfirmSetUpLogInsights              null.Bool `json:"confirm_set_up_log_insights"`
	ConfirmSetUpAutomatedExplain         null.Bool `json:"confirm_set_up_automated_explain"`
	EnsureAutoExplainRecommendedSettings null.Bool `json:"ensure_auto_explain_recommended_settings"`
	ConfirmRunTestCommand                null.Bool `json:"confirm_run_test_command"`
	ConfirmRunTestExplainCommand         null.Bool `json:"confirm_run_test_explain_command"`
}
var RecommendedInputs SetupInputs

type SetupSettings

type SetupSettings struct {
	APIKey        null.String `json:"api_key"`
	APIBaseURL    null.String `json:"api_base_url"`
	DBName        null.String `json:"db_name"`
	DBUsername    null.String `json:"db_username"`
	DBPassword    null.String `json:"db_password"`
	DBLogLocation null.String `json:"db_log_location"`
}

type SetupState

type SetupState struct {
	OperatingSystem string
	Platform        string
	PlatformFamily  string
	PlatformVersion string

	QueryRunner  *query.Runner
	PGVersionNum int
	PGVersionStr string

	ConfigFilename   string
	Config           *ini.File
	CurrentSection   *ini.Section
	PGAnalyzeSection *ini.Section

	Inputs *SetupInputs

	DidTestCommand                    bool
	DidTestExplainCommand             bool
	DidAutoExplainRecommendedSettings bool

	Logger *log.Logger
}

func (*SetupState) Log

func (state *SetupState) Log(line string, params ...interface{}) error

func (*SetupState) ReportStep added in v0.39.0

func (state *SetupState) ReportStep(stepID string, stepErr error)

func (*SetupState) SaveConfig

func (state *SetupState) SaveConfig() error

func (*SetupState) Verbose

func (state *SetupState) Verbose(line string, params ...interface{}) error

type Step

type Step struct {
	// Kind of step
	Kind StepKind
	// Step ID
	ID string
	// Description of what the step entails
	Description string
	// Check if the step has already been completed--may modify the state struct, but
	// never modifies Postgres, the collector config, or anything else in the installed
	// system
	Check func(state *SetupState) (bool, error)
	// Make changes to the system necessary for the check to pass, always prompting for
	// user input before any change that modifies Postgres, the collector config, or
	// anything else in the installed system
	Run func(state *SetupState) error
}

Step is a discrete step in the install process

type StepKind

type StepKind int
const (
	GeneralStep          StepKind = 0
	LogInsightsStep      StepKind = 1
	AutomatedExplainStep StepKind = 2
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL