config

package
v6.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package config holds the plain-Go application configuration types for run, workload, driver, pool, logger, exporter, and isolation settings. Unmarshal is the shared strict JSON entry point: it preserves established v5 lower-camel and snake_case field names without retaining application schema descriptors.

Regenerate the committed file-envelope schema after changing these types.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Unmarshal

func Unmarshal(data []byte, dst any) error

Unmarshal validates and canonicalizes the complete JSON token stream before decoding it into a plain config type. It preserves the former ProtoJSON field aliases and scalar forms while rejecting duplicate, colliding, mis-cased, and unknown fields at every nesting level.

Types

type DriverConfig

type DriverConfig struct {
	URL        string     `json:"url,omitempty"`
	DriverType DriverType `json:"driverType,omitempty"`
	// DefaultInsertMethod is the driver fallback when a workload leaves
	// InsertRequest.Method unset.
	DefaultInsertMethod   string                `json:"defaultInsertMethod,omitempty"`
	BulkSize              *int32                `json:"bulkSize,omitempty"`
	Postgres              *PostgresConfig       `json:"postgres,omitempty"`
	SQL                   *SQLConfig            `json:"sql,omitempty"`
	CaCertFile            *string               `json:"caCertFile,omitempty"`
	AuthToken             *string               `json:"authToken,omitempty"`
	ServiceAccountKeyFile *string               `json:"serviceAccountKeyFile,omitempty"`
	AuthUser              *string               `json:"authUser,omitempty"`
	AuthPassword          *string               `json:"authPassword,omitempty"`
	TLSInsecureSkipVerify *bool                 `json:"tlsInsecureSkipVerify,omitempty"`
	InsertProgress        *InsertProgressConfig `json:"insertProgress,omitempty"`
	Recording             *record.Recorder      `json:"-"`
}

DriverConfig is the runtime driver configuration consumed by the drivers and bench engine. It is assembled internally, never JSON-decoded directly.

func (*DriverConfig) GetAuthPassword

func (c *DriverConfig) GetAuthPassword() string

func (*DriverConfig) GetAuthToken

func (c *DriverConfig) GetAuthToken() string

func (*DriverConfig) GetAuthUser

func (c *DriverConfig) GetAuthUser() string

func (*DriverConfig) GetBulkSize

func (c *DriverConfig) GetBulkSize() int32

func (*DriverConfig) GetCaCertFile

func (c *DriverConfig) GetCaCertFile() string

func (*DriverConfig) GetDefaultInsertMethod

func (c *DriverConfig) GetDefaultInsertMethod() string

func (*DriverConfig) GetServiceAccountKeyFile

func (c *DriverConfig) GetServiceAccountKeyFile() string

func (*DriverConfig) GetTLSInsecureSkipVerify

func (c *DriverConfig) GetTLSInsecureSkipVerify() bool

type DriverRunConfig

type DriverRunConfig struct {
	DriverType            *string               `json:"driverType,omitempty"`
	URL                   *string               `json:"url,omitempty"`
	Pool                  *PoolConfig           `json:"pool,omitempty"`
	BulkSize              *int32                `json:"bulkSize,omitempty"`
	CaCertFile            *string               `json:"caCertFile,omitempty"`
	AuthToken             *string               `json:"authToken,omitempty"`
	ServiceAccountKeyFile *string               `json:"serviceAccountKeyFile,omitempty"`
	AuthUser              *string               `json:"authUser,omitempty"`
	AuthPassword          *string               `json:"authPassword,omitempty"`
	TLSInsecureSkipVerify *bool                 `json:"tlsInsecureSkipVerify,omitempty"`
	DefaultInsertMethod   *string               `json:"defaultInsertMethod,omitempty"`
	Postgres              *PostgresConfig       `json:"postgres,omitempty"`
	SQL                   *SQLConfig            `json:"sql,omitempty"`
	InsertProgress        *InsertProgressConfig `json:"insertProgress,omitempty"`
}

DriverRunConfig is the user-facing driver configuration for the config file.

func (*DriverRunConfig) GetAuthPassword

func (c *DriverRunConfig) GetAuthPassword() string

func (*DriverRunConfig) GetAuthToken

func (c *DriverRunConfig) GetAuthToken() string

func (*DriverRunConfig) GetAuthUser

func (c *DriverRunConfig) GetAuthUser() string

func (*DriverRunConfig) GetBulkSize

func (c *DriverRunConfig) GetBulkSize() int32

func (*DriverRunConfig) GetCaCertFile

func (c *DriverRunConfig) GetCaCertFile() string

func (*DriverRunConfig) GetDefaultInsertMethod

func (c *DriverRunConfig) GetDefaultInsertMethod() string

func (*DriverRunConfig) GetDriverType

func (c *DriverRunConfig) GetDriverType() string

func (*DriverRunConfig) GetServiceAccountKeyFile

func (c *DriverRunConfig) GetServiceAccountKeyFile() string

func (*DriverRunConfig) GetTLSInsecureSkipVerify

func (c *DriverRunConfig) GetTLSInsecureSkipVerify() bool

func (*DriverRunConfig) GetURL

func (c *DriverRunConfig) GetURL() string

type DriverType

type DriverType int32

DriverType identifies a database driver implementation.

const (
	DriverTypeUnspecified DriverType = 0
	DriverTypePostgres    DriverType = 1
	DriverTypeMySQL       DriverType = 2
	DriverTypePicodata    DriverType = 3
	DriverTypeYDB         DriverType = 4
	DriverTypeNoop        DriverType = 5
	DriverTypeCSV         DriverType = 6
	DriverTypeRecording   DriverType = 7

	// Engines that speak another driver's protocol but are their own product:
	// CockroachDB and YugabyteDB speak the postgres wire, TiDB the mysql one. They
	// are separate kinds because each selects its own SQL asset and defaults.
	DriverTypeCRDB     DriverType = 8
	DriverTypeYugabyte DriverType = 9
	DriverTypeTiDB     DriverType = 10
)

func DriverTypeValues

func DriverTypeValues() []DriverType

DriverTypeValues returns every concrete driver type in enum order, excluding the unspecified sentinel.

func (DriverType) String

func (d DriverType) String() string

type ExporterConfig

type ExporterConfig struct {
	Name       string      `json:"name,omitempty"`
	OtlpExport *OtlpExport `json:"otlpExport,omitempty"`
}

ExporterConfig contains named configuration for an OTLP exporter.

type GlobalConfig

type GlobalConfig struct {
	Version  string            `json:"version,omitempty"`
	RunID    string            `json:"runId,omitempty"`
	Seed     uint64            `json:"seed,omitempty"`
	Metadata map[string]string `json:"metadata,omitempty"`
	Logger   *LoggerConfig     `json:"logger,omitempty"`
	Exporter *ExporterConfig   `json:"exporter,omitempty"`
}

GlobalConfig holds global stroppy settings: logger, exporter, seed, run_id, and metadata.

type InsertProgressConfig

type InsertProgressConfig struct {
	Enabled    *bool   `json:"enabled,omitempty"`
	Interval   *string `json:"interval,omitempty"`
	StallAfter *string `json:"stallAfter,omitempty"`
	Mode       *string `json:"mode,omitempty"`
}

InsertProgressConfig is periodic typed-load progress reporting.

func (*InsertProgressConfig) GetEnabled

func (c *InsertProgressConfig) GetEnabled() bool

func (*InsertProgressConfig) GetInterval

func (c *InsertProgressConfig) GetInterval() string

func (*InsertProgressConfig) GetMode

func (c *InsertProgressConfig) GetMode() string

func (*InsertProgressConfig) GetStallAfter

func (c *InsertProgressConfig) GetStallAfter() string

type LogLevel

type LogLevel int32

LogLevel is the minimum log level to output.

const (
	LogLevelDebug LogLevel = iota
	LogLevelInfo
	LogLevelWarn
	LogLevelError
	LogLevelFatal
)

func LogLevelValues

func LogLevelValues() []LogLevel

LogLevelValues returns every declared LogLevel constant in canonical order.

func ParseLogLevel

func ParseLogLevel(value string) (LogLevel, error)

ParseLogLevel accepts the short and v5 logging level names, or a valid ordinal.

func (LogLevel) MarshalJSON

func (l LogLevel) MarshalJSON() ([]byte, error)

func (LogLevel) Short

func (l LogLevel) Short() string

func (LogLevel) String

func (l LogLevel) String() string

func (*LogLevel) UnmarshalJSON

func (l *LogLevel) UnmarshalJSON(data []byte) error

type LogMode

type LogMode int32

LogMode is the logging output mode.

const (
	LogModeDevelopment LogMode = iota
	LogModeProduction
)

func LogModeValues

func LogModeValues() []LogMode

LogModeValues returns every declared LogMode constant in canonical order.

func ParseLogMode

func ParseLogMode(value string) (LogMode, error)

func (LogMode) MarshalJSON

func (m LogMode) MarshalJSON() ([]byte, error)

func (LogMode) Short

func (m LogMode) Short() string

func (LogMode) String

func (m LogMode) String() string

func (*LogMode) UnmarshalJSON

func (m *LogMode) UnmarshalJSON(data []byte) error

type LoggerConfig

type LoggerConfig struct {
	LogLevel LogLevel `json:"logLevel,omitempty"`
	LogMode  LogMode  `json:"logMode,omitempty"`
}

LoggerConfig controls log levels and output formatting.

type OtlpExport

type OtlpExport struct {
	OtlpGrpcEndpoint        *string `json:"otlpGrpcEndpoint,omitempty"`
	OtlpHTTPEndpoint        *string `json:"otlpHttpEndpoint,omitempty"`
	OtlpHTTPExporterURLPath *string `json:"otlpHttpExporterUrlPath,omitempty"`
	OtlpEndpointInsecure    *bool   `json:"otlpEndpointInsecure,omitempty"`
	OtlpHeaders             *string `json:"otlpHeaders,omitempty"`
	OtlpMetricsPrefix       *string `json:"otlpMetricsPrefix,omitempty"`
}

OtlpExport contains configuration for exporting metrics via OTLP.

func (*OtlpExport) GetOtlpEndpointInsecure

func (o *OtlpExport) GetOtlpEndpointInsecure() bool

func (*OtlpExport) GetOtlpGrpcEndpoint

func (o *OtlpExport) GetOtlpGrpcEndpoint() string

func (*OtlpExport) GetOtlpHTTPEndpoint

func (o *OtlpExport) GetOtlpHTTPEndpoint() string

func (*OtlpExport) GetOtlpHTTPExporterURLPath

func (o *OtlpExport) GetOtlpHTTPExporterURLPath() string

func (*OtlpExport) GetOtlpHeaders

func (o *OtlpExport) GetOtlpHeaders() string

func (*OtlpExport) GetOtlpMetricsPrefix

func (o *OtlpExport) GetOtlpMetricsPrefix() string

type PoolConfig

type PoolConfig struct {
	MaxConns                 *int32  `json:"maxConns,omitempty"`
	MinConns                 *int32  `json:"minConns,omitempty"`
	MinIdleConns             *int32  `json:"minIdleConns,omitempty"`
	MaxConnLifetime          *string `json:"maxConnLifetime,omitempty"`
	MaxConnIdleTime          *string `json:"maxConnIdleTime,omitempty"`
	TraceLogLevel            *string `json:"traceLogLevel,omitempty"`
	DefaultQueryExecMode     *string `json:"defaultQueryExecMode,omitempty"`
	DescriptionCacheCapacity *int32  `json:"descriptionCacheCapacity,omitempty"`
	StatementCacheCapacity   *int32  `json:"statementCacheCapacity,omitempty"`
	MaxOpenConns             *int32  `json:"maxOpenConns,omitempty"`
	MaxIdleConns             *int32  `json:"maxIdleConns,omitempty"`
	ConnMaxLifetime          *string `json:"connMaxLifetime,omitempty"`
	ConnMaxIdleTime          *string `json:"connMaxIdleTime,omitempty"`
}

PoolConfig is a sugar pool block accepted on the config-file driver. It maps to PostgresConfig or SQLConfig based on driver type.

func (*PoolConfig) GetConnMaxIdleTime

func (c *PoolConfig) GetConnMaxIdleTime() string

func (*PoolConfig) GetConnMaxLifetime

func (c *PoolConfig) GetConnMaxLifetime() string

func (*PoolConfig) GetDefaultQueryExecMode

func (c *PoolConfig) GetDefaultQueryExecMode() string

func (*PoolConfig) GetDescriptionCacheCapacity

func (c *PoolConfig) GetDescriptionCacheCapacity() int32

func (*PoolConfig) GetMaxConnIdleTime

func (c *PoolConfig) GetMaxConnIdleTime() string

func (*PoolConfig) GetMaxConnLifetime

func (c *PoolConfig) GetMaxConnLifetime() string

func (*PoolConfig) GetMaxConns

func (c *PoolConfig) GetMaxConns() int32

func (*PoolConfig) GetMaxIdleConns

func (c *PoolConfig) GetMaxIdleConns() int32

func (*PoolConfig) GetMaxOpenConns

func (c *PoolConfig) GetMaxOpenConns() int32

func (*PoolConfig) GetMinConns

func (c *PoolConfig) GetMinConns() int32

func (*PoolConfig) GetMinIdleConns

func (c *PoolConfig) GetMinIdleConns() int32

func (*PoolConfig) GetStatementCacheCapacity

func (c *PoolConfig) GetStatementCacheCapacity() int32

func (*PoolConfig) GetTraceLogLevel

func (c *PoolConfig) GetTraceLogLevel() string

type PostgresConfig

type PostgresConfig struct {
	TraceLogLevel            *string `json:"traceLogLevel,omitempty"`
	MaxConnLifetime          *string `json:"maxConnLifetime,omitempty"`
	MaxConnIdleTime          *string `json:"maxConnIdleTime,omitempty"`
	MaxConns                 *int32  `json:"maxConns,omitempty"`
	MinConns                 *int32  `json:"minConns,omitempty"`
	MinIdleConns             *int32  `json:"minIdleConns,omitempty"`
	DefaultQueryExecMode     *string `json:"defaultQueryExecMode,omitempty"`
	DescriptionCacheCapacity *int32  `json:"descriptionCacheCapacity,omitempty"`
	StatementCacheCapacity   *int32  `json:"statementCacheCapacity,omitempty"`
}

PostgresConfig is PostgreSQL-specific pool and connection configuration.

func (*PostgresConfig) GetDefaultQueryExecMode

func (c *PostgresConfig) GetDefaultQueryExecMode() string

func (*PostgresConfig) GetDescriptionCacheCapacity

func (c *PostgresConfig) GetDescriptionCacheCapacity() int32

func (*PostgresConfig) GetMaxConnIdleTime

func (c *PostgresConfig) GetMaxConnIdleTime() string

func (*PostgresConfig) GetMaxConnLifetime

func (c *PostgresConfig) GetMaxConnLifetime() string

func (*PostgresConfig) GetMaxConns

func (c *PostgresConfig) GetMaxConns() int32

func (*PostgresConfig) GetMinConns

func (c *PostgresConfig) GetMinConns() int32

func (*PostgresConfig) GetMinIdleConns

func (c *PostgresConfig) GetMinIdleConns() int32

func (*PostgresConfig) GetStatementCacheCapacity

func (c *PostgresConfig) GetStatementCacheCapacity() int32

func (*PostgresConfig) GetTraceLogLevel

func (c *PostgresConfig) GetTraceLogLevel() string

type RunConfig

type RunConfig struct {
	Version string                      `json:"version,omitempty"`
	Script  *string                     `json:"script,omitempty"`
	SQL     *string                     `json:"sql,omitempty"`
	Global  *GlobalConfig               `json:"global,omitempty"`
	Drivers map[string]*DriverRunConfig `json:"drivers,omitempty"`
	Run     map[string]json.RawMessage  `configscope:"run"        json:"run,omitempty"`
	Params  map[string]json.RawMessage  `configscope:"params"     json:"params,omitempty"`
	Steps   []string                    `json:"steps,omitempty"`
	NoSteps []string                    `json:"noSteps,omitempty"`
}

RunConfig is the top-level stroppy config file schema.

func (*RunConfig) GetSQL

func (c *RunConfig) GetSQL() string

func (*RunConfig) GetScript

func (c *RunConfig) GetScript() string

type SQLConfig

type SQLConfig struct {
	MaxOpenConns    *int32  `json:"maxOpenConns,omitempty"`
	MaxIdleConns    *int32  `json:"maxIdleConns,omitempty"`
	ConnMaxLifetime *string `json:"connMaxLifetime,omitempty"`
	ConnMaxIdleTime *string `json:"connMaxIdleTime,omitempty"`
}

SQLConfig is generic database/sql pool settings for SQL-based drivers.

func (*SQLConfig) GetConnMaxIdleTime

func (c *SQLConfig) GetConnMaxIdleTime() string

func (*SQLConfig) GetConnMaxLifetime

func (c *SQLConfig) GetConnMaxLifetime() string

func (*SQLConfig) GetMaxIdleConns

func (c *SQLConfig) GetMaxIdleConns() int32

func (*SQLConfig) GetMaxOpenConns

func (c *SQLConfig) GetMaxOpenConns() int32

type TxIsolationLevel

type TxIsolationLevel int32

TxIsolationLevel is the isolation level of a database transaction.

const (
	TxIsolationLevelUnspecified     TxIsolationLevel = 0
	TxIsolationLevelReadUncommitted TxIsolationLevel = 1
	TxIsolationLevelReadCommitted   TxIsolationLevel = 2
	TxIsolationLevelRepeatableRead  TxIsolationLevel = 3
	TxIsolationLevelSerializable    TxIsolationLevel = 4
	TxIsolationLevelConnectionOnly  TxIsolationLevel = 5
	TxIsolationLevelNone            TxIsolationLevel = 6
)

Jump to

Keyboard shortcuts

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