Documentation ¶
Overview ¶
Deprecated: Use storj.io/common/process instead.
Index ¶
- Constants
- Variables
- func AtomicLevel(cmd *cobra.Command) *zap.AtomicLevel
- func Bind(cmd *cobra.Command, config interface{}, opts ...cfgstruct.BindOpt)
- func Ctx(cmd *cobra.Command) (context.Context, context.CancelFunc)
- func Exec(cmd *cobra.Command)
- func ExecCustomDebug(cmd *cobra.Command)
- func ExecWithCustomConfig(cmd *cobra.Command, debugEnabled bool, ...)
- func ExecWithCustomConfigAndLogger(cmd *cobra.Command, debugEnabled bool, ...)
- func ExecWithCustomOptions(cmd *cobra.Command, opts ExecOptions)
- func InitEventStatPublisher(ctx context.Context, log *zap.Logger, r *eventstat.Registry, ...) error
- func InitEventStatPublisherWithHostname(ctx context.Context, log *zap.Logger, r *eventstat.Registry) error
- func InitMetrics(ctx context.Context, log *zap.Logger, r *monkit.Registry, instanceID string) (err error)
- func InitMetricsWithCertPath(ctx context.Context, log *zap.Logger, r *monkit.Registry, certPath string) error
- func InitMetricsWithHostname(ctx context.Context, log *zap.Logger, r *monkit.Registry) error
- func InitTracing(ctx context.Context, log *zap.Logger, r *monkit.Registry, instanceID string) (*jaeger.ThriftCollector, func(), error)
- func InitTracingWithCertPath(ctx context.Context, log *zap.Logger, r *monkit.Registry, certDir string) (*jaeger.ThriftCollector, func(), error)
- func InitTracingWithHostname(ctx context.Context, log *zap.Logger, r *monkit.Registry, certDir string) (*jaeger.ThriftCollector, func(), error)
- func LoadConfig(cmd *cobra.Command, vip *viper.Viper) error
- func NamedLog(base *zap.Logger, name string) *zap.Logger
- func NewLogger(processName string) (*zap.Logger, *zap.AtomicLevel, error)
- func NewLoggerWithOutputPaths(processName string, outputPaths ...string) (*zap.Logger, error)
- func NewLoggerWithOutputPathsAndAtomicLevel(processName string, outputPaths ...string) (*zap.Logger, *zap.AtomicLevel, error)
- func Report(ctx context.Context) error
- func SaveConfig(cmd *cobra.Command, outfile string, opts ...SaveConfigOption) error
- func SetHardcodedApplicationName(name string)
- func SetProfiler(fn func(log *zap.Logger) error)
- func Viper(cmd *cobra.Command) (*viper.Viper, error)
- func ViperWithCustomConfig(cmd *cobra.Command, ...) (*viper.Viper, error)
- type ExecOptions
- type SaveConfigOption
- type SaveConfigOptions
Constants ¶
const DefaultCfgFilename = "config.yaml"
DefaultCfgFilename is the default filename used for storing a configuration.
Variables ¶
var ( // Error is a process error class. Error = errs.Class("process") )
Functions ¶
func AtomicLevel ¶
func AtomicLevel(cmd *cobra.Command) *zap.AtomicLevel
AtomicLevel returns the appropriate zap.AtomicLevel for ExecuteWithConfig commands.
func Bind ¶
Bind sets flags on a command that match the configuration struct 'config'. It ensures that the config has all of the values loaded into it when the command runs.
func Exec ¶
Exec runs a Cobra command. If a "config-dir" flag is defined it will be parsed and loaded using viper.
func ExecCustomDebug ¶
ExecCustomDebug runs default configuration except the default debug is disabled.
func ExecWithCustomConfig ¶
func ExecWithCustomConfig(cmd *cobra.Command, debugEnabled bool, loadConfig func(cmd *cobra.Command, vip *viper.Viper) error)
ExecWithCustomConfig runs a Cobra command. Custom configuration can be loaded.
func ExecWithCustomConfigAndLogger ¶
func ExecWithCustomConfigAndLogger(cmd *cobra.Command, debugEnabled bool, loadConfig func(cmd *cobra.Command, vip *viper.Viper) error, loggerFactory func(*zap.Logger) *zap.Logger)
ExecWithCustomConfigAndLogger runs a Cobra command with a custom logger. Custom configuration can be loaded.
func ExecWithCustomOptions ¶
func ExecWithCustomOptions(cmd *cobra.Command, opts ExecOptions)
ExecWithCustomOptions runs a Cobra command with custom options.
func InitEventStatPublisher ¶
func InitEventStatPublisher(ctx context.Context, log *zap.Logger, r *eventstat.Registry, customization func(*eventstat.ClientOpts)) error
InitEventStatPublisher initializes telemetry reporting.
func InitEventStatPublisherWithHostname ¶
func InitEventStatPublisherWithHostname(ctx context.Context, log *zap.Logger, r *eventstat.Registry) error
InitEventStatPublisherWithHostname initializes telemetry reporting, using the hostname as the telemetry instance ID. ctx should be cancelled to stop the telemetry publisher.
func InitMetrics ¶
func InitMetrics(ctx context.Context, log *zap.Logger, r *monkit.Registry, instanceID string) (err error)
InitMetrics initializes telemetry reporting. Makes a telemetry.Client and calls its Run() method in a goroutine.
func InitMetricsWithCertPath ¶
func InitMetricsWithCertPath(ctx context.Context, log *zap.Logger, r *monkit.Registry, certPath string) error
InitMetricsWithCertPath initializes telemetry reporting, using the node ID corresponding to the given certificate as the telemetry instance ID.
func InitMetricsWithHostname ¶
InitMetricsWithHostname initializes telemetry reporting, using the hostname as the telemetry instance ID.
func InitTracing ¶
func InitTracing(ctx context.Context, log *zap.Logger, r *monkit.Registry, instanceID string) (*jaeger.ThriftCollector, func(), error)
InitTracing initializes distributed tracing with an instance ID.
func InitTracingWithCertPath ¶
func InitTracingWithCertPath(ctx context.Context, log *zap.Logger, r *monkit.Registry, certDir string) (*jaeger.ThriftCollector, func(), error)
InitTracingWithCertPath initializes distributed tracing with certificate path.
func InitTracingWithHostname ¶
func InitTracingWithHostname(ctx context.Context, log *zap.Logger, r *monkit.Registry, certDir string) (*jaeger.ThriftCollector, func(), error)
InitTracingWithHostname initializes distributed tracing with nodeID and hostname.
func LoadConfig ¶
LoadConfig loads configuration into *viper.Viper from file specified with "config-dir" flag.
func NewLoggerWithOutputPaths ¶
NewLoggerWithOutputPaths is the same as NewLogger, but overrides the log output paths.
func NewLoggerWithOutputPathsAndAtomicLevel ¶
func NewLoggerWithOutputPathsAndAtomicLevel(processName string, outputPaths ...string) (*zap.Logger, *zap.AtomicLevel, error)
NewLoggerWithOutputPathsAndAtomicLevel is the same as NewLoggerWithOutputPaths, but overrides the log output paths and returns the AtomicLevel.
func SaveConfig ¶
func SaveConfig(cmd *cobra.Command, outfile string, opts ...SaveConfigOption) error
SaveConfig will save only the user-specific flags with default values to outfile with specific values specified in 'overrides' overridden.
func SetHardcodedApplicationName ¶
func SetHardcodedApplicationName(name string)
SetHardcodedApplicationName configures telemetry to use the given application name, followed by -dev/-release depending on build settings, instead of os.Args[0]. Disables configuration of metrics.app and metrics.app-suffix.
func ViperWithCustomConfig ¶
func ViperWithCustomConfig(cmd *cobra.Command, loadConfig func(cmd *cobra.Command, vip *viper.Viper) error) (*viper.Viper, error)
ViperWithCustomConfig returns the appropriate *viper.Viper for the command, creating if necessary. Custom config load logic can be defined with "loadConfig" parameter.
Types ¶
type ExecOptions ¶
type ExecOptions struct { InitDefaultDebugServer bool // enable default debug server. InitTracing bool InitProfiler bool FailOnValueError bool LoadConfig func(cmd *cobra.Command, vip *viper.Viper) error LoggerFactory func(*zap.Logger) *zap.Logger }
ExecOptions contains options for ExecWithCustomOptions.
type SaveConfigOption ¶
type SaveConfigOption func(*SaveConfigOptions)
SaveConfigOption is a function that updates the options for SaveConfig.
func SaveConfigRemovingDeprecated ¶
func SaveConfigRemovingDeprecated() SaveConfigOption
SaveConfigRemovingDeprecated tells SaveConfig to not store deprecated flags.
func SaveConfigWithOverride ¶
func SaveConfigWithOverride(name string, value interface{}) SaveConfigOption
SaveConfigWithOverride adds a single override to SaveConfig.
func SaveConfigWithOverrides ¶
func SaveConfigWithOverrides(overrides map[string]interface{}) SaveConfigOption
SaveConfigWithOverrides sets the overrides to the provided map.
type SaveConfigOptions ¶
SaveConfigOptions controls the behavior of SaveConfig.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Deprecated: Use storj.io/common/gcloudlogging instead.
|
Deprecated: Use storj.io/common/gcloudlogging instead. |
Deprecated: Use storj.io/common/googleprofiler instead.
|
Deprecated: Use storj.io/common/googleprofiler instead. |