Documentation
¶
Index ¶
- Constants
- func BuildTime() string
- func CloseFileLogger()
- func DirectRuntimeProductIDs() map[string]bool
- func DiscoveryBaseURL() string
- func Execute() int
- func FileLoggerInstance() *slog.Logger
- func GitCommit() string
- func IsPerfTimingEnabled() bool
- func NewRootCommand(ctx ...context.Context) *cobra.Command
- func NewRootCommandWithEngine(rootCtx context.Context, engine *pipeline.Engine) *cobra.Command
- func RawVersion() string
- func RecordTiming(ctx context.Context, name string, d time.Duration)
- func ResetRuntimeTokenCache()
- func SetDiscoveryBaseURL(url string)
- func SetDynamicServers(servers []market.ServerDescriptor)
- func SetVersion(v, bt, gc string)
- func StartTiming(ctx context.Context, name string) func()
- func Version() string
- func WithTimingCollector(ctx context.Context, tc *TimingCollector) context.Context
- type GlobalFlags
- type TimingCollector
- func (tc *TimingCollector) Entries() []TimingEntry
- func (tc *TimingCollector) Print(w io.Writer)
- func (tc *TimingCollector) PrintIfEnabled()
- func (tc *TimingCollector) Record(name string, d time.Duration)
- func (tc *TimingCollector) StartTimer(name string) func()
- func (tc *TimingCollector) Total() time.Duration
- type TimingEntry
Constants ¶
const PerfTimingEnv = "DWS_PERF_TIMING"
Environment variable to enable performance timing output.
Variables ¶
This section is empty.
Functions ¶
func BuildTime ¶ added in v1.0.7
func BuildTime() string
BuildTime returns the build timestamp injected via ldflags.
func DirectRuntimeProductIDs ¶
DirectRuntimeProductIDs returns the set of product IDs that have direct runtime endpoints configured, sourced from dynamic server discovery.
func DiscoveryBaseURL ¶
func DiscoveryBaseURL() string
DiscoveryBaseURL returns the effective base URL for discovery — discoveryBaseURLOverride if set, otherwise DefaultMarketBaseURL.
func FileLoggerInstance ¶
FileLoggerInstance returns the package-level file logger, or nil if not initialized.
func GitCommit ¶ added in v1.0.7
func GitCommit() string
GitCommit returns the git commit hash injected via ldflags.
func IsPerfTimingEnabled ¶ added in v1.0.6
func IsPerfTimingEnabled() bool
IsPerfTimingEnabled returns true if performance timing output is enabled.
func NewRootCommand ¶
NewRootCommand constructs the root CLI command. The provided context is propagated to background goroutines and the Cobra command tree so that SIGINT/SIGTERM can cancel in-flight work.
func NewRootCommandWithEngine ¶
NewRootCommandWithEngine constructs the root CLI command with an optional pipeline engine for input correction. When engine is nil, no pipeline processing is applied.
func RawVersion ¶ added in v1.0.7
func RawVersion() string
RawVersion returns the bare version string without build metadata.
func RecordTiming ¶ added in v1.0.6
RecordTiming is a convenience function to record timing to the collector in context.
func ResetRuntimeTokenCache ¶ added in v1.0.5
func ResetRuntimeTokenCache()
ResetRuntimeTokenCache clears the cached token, forcing a reload on next access. This should be called after login/logout operations.
func SetDiscoveryBaseURL ¶
func SetDiscoveryBaseURL(url string)
SetDiscoveryBaseURL sets the base URL used for dynamic server discovery. Intended for test use only.
func SetDynamicServers ¶
func SetDynamicServers(servers []market.ServerDescriptor)
SetDynamicServers injects server data discovered from servers.json. All product endpoints are resolved dynamically from this data.
func SetVersion ¶ added in v1.0.7
func SetVersion(v, bt, gc string)
SetVersion overrides the version, build time and git commit strings. Called by pkg/cli.SetVersion for overlay modules that inject their own version info via ldflags.
func StartTiming ¶ added in v1.0.6
StartTiming is a convenience function that returns a stop function for defer usage. Example:
defer StartTiming(ctx, "operation")()
func Version ¶
func Version() string
Version returns the current CLI version string, including build metadata when injected via ldflags (buildTime, gitCommit).
func WithTimingCollector ¶ added in v1.0.6
func WithTimingCollector(ctx context.Context, tc *TimingCollector) context.Context
WithTimingCollector returns a new context with the TimingCollector attached.
Types ¶
type GlobalFlags ¶
type GlobalFlags struct {
ClientID string
ClientSecret string
Debug bool
DryRun bool
Fields string
Format string
JQ string
Mock bool
Output string
Timeout int
Token string
Verbose bool
Yes bool
}
GlobalFlags contains the root-level persistent flags shared across the CLI.
type TimingCollector ¶ added in v1.0.6
type TimingCollector struct {
// contains filtered or unexported fields
}
TimingCollector collects timing measurements for a single command execution. It is safe for concurrent use.
func NewTimingCollector ¶ added in v1.0.6
func NewTimingCollector() *TimingCollector
NewTimingCollector creates a new collector with the start time set to now.
func TimingCollectorFromContext ¶ added in v1.0.6
func TimingCollectorFromContext(ctx context.Context) *TimingCollector
TimingCollectorFromContext extracts the TimingCollector from context, or nil.
func (*TimingCollector) Entries ¶ added in v1.0.6
func (tc *TimingCollector) Entries() []TimingEntry
Entries returns a copy of all recorded entries in insertion order.
func (*TimingCollector) Print ¶ added in v1.0.6
func (tc *TimingCollector) Print(w io.Writer)
Print writes a summary of all timing entries to the given writer.
func (*TimingCollector) PrintIfEnabled ¶ added in v1.0.6
func (tc *TimingCollector) PrintIfEnabled()
PrintIfEnabled prints timing info to stderr if DWS_PERF_TIMING is set.
func (*TimingCollector) Record ¶ added in v1.0.6
func (tc *TimingCollector) Record(name string, d time.Duration)
Record adds a timing entry with the given name and duration.
func (*TimingCollector) StartTimer ¶ added in v1.0.6
func (tc *TimingCollector) StartTimer(name string) func()
StartTimer returns a function that, when called, records the elapsed time since StartTimer was called. This is convenient for defer usage:
defer tc.StartTimer("operation")()
func (*TimingCollector) Total ¶ added in v1.0.6
func (tc *TimingCollector) Total() time.Duration
Total returns the total elapsed time since the collector was created.