Documentation ¶
Index ¶
- Constants
- Variables
- func AllFlags(ctx context.Context) []string
- func ContextWithExplicitFeatureFlags(ctx context.Context) context.Context
- func ContextWithFeatureFlag(ctx context.Context, flag FeatureFlag, enabled bool) context.Context
- func IncomingCtxWithFeatureFlag(ctx context.Context, flag FeatureFlag, enabled bool) context.Context
- func IncomingCtxWithRubyFeatureFlag(ctx context.Context, flag FeatureFlag, enabled bool) context.Context
- func OutgoingCtxWithFeatureFlag(ctx context.Context, flag FeatureFlag, enabled bool) context.Context
- func OutgoingCtxWithRubyFeatureFlag(ctx context.Context, flag FeatureFlag, enabled bool) context.Context
- func OutgoingWithRaw(ctx context.Context, flags Raw) context.Context
- type FeatureFlag
- type Raw
Constants ¶
const (
// Delim is a delimiter used between a feature flag name and its value.
Delim = ":"
)
Variables ¶
var ( // All is the list of all registered feature flags. All = []FeatureFlag{} )
var CommandStatsMetrics = NewFeatureFlag("command_stats_metrics", false)
CommandStatsMetrics tracks additional prometheus metrics for each shelled out command
var ConcurrencyQueueEnforceMax = NewFeatureFlag("concurrency_queue_enforce_max", false)
ConcurrencyQueueEnforceMax enforces a maximum number of items that are waiting in a concurrency queue. when this flag is turned on, subsequent requests that come in will be rejected with an error.
var ConcurrencyQueueMaxWait = NewFeatureFlag("concurrency_queue_max_wait", false)
ConcurrencyQueueMaxWait will enable the concurrency limiter to drop requests that are waiting in the concurrency queue for longer than the configured time.
var ExactPaginationTokenMatch = NewFeatureFlag("exact_pagination_token_match", false)
ExactPaginationTokenMatch enables exact matching for provided pagination tokens and returns an error if the match is not found.
var GoFindLicense = NewFeatureFlag("go_find_license", false)
GoFindLicense enables Go implementation of FindLicense
var MaintenanceOperationRouting = NewFeatureFlag("maintenance_operation_routing", false)
MaintenanceOperationRouting enables routing logic that is specific to maintenance operations.
var RateLimit = NewFeatureFlag("rate_limit", false)
RateLimit will enable the rate limiter to reject requests beyond a configured rate.
var RevlistForRepoSize = NewFeatureFlag("revlist_for_repo_size", false)
RevlistForRepoSize enables the RepositorySize RPC to use git rev-list to calculate the disk usage of the repository.
var RunCommandsInCGroup = NewFeatureFlag("run_cmds_in_cgroup", true)
RunCommandsInCGroup allows all commands to be run within a cgroup
var UserRebaseConfirmableImprovedErrorHandling = NewFeatureFlag("user_rebase_confirmable_improved_error_handling", false)
UserRebaseConfirmableImprovedErrorHandling enables proper error handling in the UserRebaseConfirmable RPC. When this flag is disabled many error cases were returning successfully with an error message embedded in the response. With this flag enabled, this is converted to return real gRPC errors with structured errors.
var UserSquashQuarantinedVoting = NewFeatureFlag("user_squash_quarantined_voting", true)
UserSquashQuarantinedVoting enables the use of a quarantine directory to stage all objects created by UserSquash into a temporary directory. This quarantine directory will only be migrated into the final repository when the RPC is successful, including a new transactional vote on the object ID of the resulting squashed commit.
Functions ¶
func AllFlags ¶
AllFlags returns all feature flags with their value that use the Gitaly metadata prefix. Note: results will not be sorted.
func ContextWithExplicitFeatureFlags ¶ added in v14.6.0
ContextWithExplicitFeatureFlags marks the context such that all feature flags which are checked must have been explicitly set in that context. If a feature flag wasn't set to an explicit value, then checking this feature flag will panic. This is not for use in production systems, but is intended for tests to verify that we test each feature flag properly.
func ContextWithFeatureFlag ¶ added in v14.7.0
ContextWithFeatureFlag sets the feature flag in both the incoming and outgoing context.
func IncomingCtxWithFeatureFlag ¶
func IncomingCtxWithFeatureFlag(ctx context.Context, flag FeatureFlag, enabled bool) context.Context
IncomingCtxWithFeatureFlag sets the feature flag for an incoming context. This is NOT meant for use in clients that transfer the context across process boundaries.
func IncomingCtxWithRubyFeatureFlag ¶ added in v14.6.0
func IncomingCtxWithRubyFeatureFlag(ctx context.Context, flag FeatureFlag, enabled bool) context.Context
IncomingCtxWithRubyFeatureFlag sets the Ruby feature flag for an incoming context. This is NOT meant for use in clients that transfer the context across process boundaries.
func OutgoingCtxWithFeatureFlag ¶ added in v14.6.0
func OutgoingCtxWithFeatureFlag(ctx context.Context, flag FeatureFlag, enabled bool) context.Context
OutgoingCtxWithFeatureFlag sets the feature flag for an outgoing context.
func OutgoingCtxWithRubyFeatureFlag ¶ added in v14.6.0
func OutgoingCtxWithRubyFeatureFlag(ctx context.Context, flag FeatureFlag, enabled bool) context.Context
OutgoingCtxWithRubyFeatureFlag sets the Ruby feature flag for an outgoing context.
Types ¶
type FeatureFlag ¶
type FeatureFlag struct { // Name is the name of the feature flag. Name string `json:"name"` // OnByDefault is the default value if the feature flag is not explicitly set in // the incoming context. OnByDefault bool `json:"on_by_default"` }
FeatureFlag gates the implementation of new or changed functionality.
func NewFeatureFlag ¶ added in v14.3.0
func NewFeatureFlag(name string, onByDefault bool) FeatureFlag
NewFeatureFlag creates a new feature flag and adds it to the array of all existing feature flags.
func (FeatureFlag) IsDisabled ¶ added in v14.1.0
func (ff FeatureFlag) IsDisabled(ctx context.Context) bool
IsDisabled determines whether the feature flag is disabled in the incoming context.
func (FeatureFlag) IsEnabled ¶ added in v14.1.0
func (ff FeatureFlag) IsEnabled(ctx context.Context) bool
IsEnabled checks if the feature flag is enabled for the passed context. Only returns true if the metadata for the feature flag is set to "true"
func (FeatureFlag) MetadataKey ¶ added in v14.4.0
func (ff FeatureFlag) MetadataKey() string
MetadataKey returns the key of the feature flag as it is present in the metadata map.
type Raw ¶
Raw contains feature flags and their values in their raw form with header prefix in place and values unparsed.
func RawFromContext ¶
RawFromContext returns a map that contains all feature flags with their values. The feature flags are in their raw format with the header prefix in place. If multiple values are set a flag, the first occurrence is used.
This is mostly intended for propagating the feature flags by other means than the metadata, for example into the hooks through the environment.
Source Files ¶
- context.go
- featureflag.go
- ff_command_stats_metrics.go
- ff_exact_pagination_token_match.go
- ff_go_find_license.go
- ff_maintenance_operation_routing.go
- ff_max_queue_wait_time.go
- ff_queue_max.go
- ff_rate_limiter.go
- ff_repo_size_revlist.go
- ff_run_cmd_in_cgroup.go
- ff_user_rebase_confirmable_improved_error_handling.go
- ff_user_squash_quarantined_voting.go