extkingpin

package
v0.30.0-rc.0 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2022 License: Apache-2.0 Imports: 19 Imported by: 1

Documentation

Index

Constants

View Source
const UsageTemplate = `` /* 1202-byte string literal not displayed */

Variables

This section is empty.

Functions

func Addrs added in v0.24.0

func Addrs(flags *kingpin.FlagClause) (target *addressSlice)

func ModelDuration added in v0.17.0

func ModelDuration(flags *kingpin.FlagClause) *model.Duration

func NewStaticPathContent added in v0.29.0

func NewStaticPathContent(fromPath string) (*staticPathContent, error)

NewStaticPathContent creates a new content that can be used to serve a static configuration. It copies the configuration from `fromPath` into `destPath` to avoid confusion with file watchers.

func PathContentReloader added in v0.29.0

func PathContentReloader(ctx context.Context, fileContent fileContent, logger log.Logger, reloadFunc func(), debounceTime time.Duration) error

PathContentReloader starts a file watcher that monitors the file indicated by fileContent.Path() and runs reloadFunc whenever a change is detected. A debounce timer can be configured via opts to handle situations where many "write" events are received together or a "create" event is followed up by a "write" event, for example. Files will be effectively reloaded at the latest after 2 times the debounce timer. By default the debouncer timer is 1 second. To ensure renames and deletes are properly handled, the file watcher is put at the file's parent folder. See https://github.com/fsnotify/fsnotify/issues/214 for more details.

func RegisterCommonObjStoreFlags added in v0.17.0

func RegisterCommonObjStoreFlags(cmd FlagClause, suffix string, required bool, extraDesc ...string) *extflag.PathOrContent

RegisterCommonObjStoreFlags register flags to specify object storage configuration.

func RegisterCommonTracingFlags added in v0.17.0

func RegisterCommonTracingFlags(app FlagClause) *extflag.PathOrContent

RegisterCommonTracingFlags registers flags to pass a tracing configuration to be used with OpenTracing.

func RegisterGRPCFlags added in v0.17.0

func RegisterGRPCFlags(cmd FlagClause) (
	grpcBindAddr *string,
	grpcGracePeriod *model.Duration,
	grpcTLSSrvCert *string,
	grpcTLSSrvKey *string,
	grpcTLSSrvClientCA *string,
	grpcMaxConnectionAge *time.Duration,
)

RegisterGRPCFlags registers flags commonly used to configure gRPC servers with.

func RegisterHTTPFlags added in v0.17.0

func RegisterHTTPFlags(cmd FlagClause) (httpBindAddr *string, httpGracePeriod *model.Duration, httpTLSConfig *string)

RegisterCommonObjStoreFlags register flags commonly used to configure http servers with.

func RegisterRequestLoggingFlags added in v0.20.0

func RegisterRequestLoggingFlags(app FlagClause) *extflag.PathOrContent

RegisterRequestLoggingFlags registers flags to pass a request logging configuration to be used.

func RegisterSelectorRelabelFlags added in v0.17.0

func RegisterSelectorRelabelFlags(cmd FlagClause) *extflag.PathOrContent

RegisterSelectorRelabelFlags register flags to specify relabeling configuration selecting blocks to process.

Types

type App

type App struct {
	FlagClause
	// contains filtered or unexported fields
}

App is a wrapper around kingping.Application for easier use.

func NewApp

func NewApp(app *kingpin.Application) *App

NewApp returns new App.

func (*App) Command

func (a *App) Command(cmd, help string) AppClause

func (*App) Parse

func (a *App) Parse() (cmd string, setup SetupFunc)

type AppClause

type AppClause interface {
	FlagClause
	Command(cmd string, help string) AppClause
	Flags() []*kingpin.FlagModel
	Setup(s SetupFunc)
}

type FlagClause

type FlagClause interface {
	Flag(name, help string) *kingpin.FlagClause
}

type SetupFunc

type SetupFunc func(*run.Group, log.Logger, *prometheus.Registry, opentracing.Tracer, <-chan struct{}, bool) error

TODO(bwplotka): Consider some extkingpin package that will not depend on those. Needed: Generics!

Jump to

Keyboard shortcuts

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