Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature gate CLI flag and visibility changes #4368

Merged
merged 10 commits into from
Nov 23, 2021

Conversation

Aneurysm9
Copy link
Member

Adds CLI flags for setting feature gates, exposes the feature gate registry type and provides an accessor for the global feature gate registry.

@Aneurysm9 Aneurysm9 requested review from a team and bogdandrutu November 5, 2021 19:48
@codecov
Copy link

codecov bot commented Nov 5, 2021

Codecov Report

Merging #4368 (f81ac80) into main (e23c9d0) will increase coverage by 0.03%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #4368      +/-   ##
==========================================
+ Coverage   90.70%   90.73%   +0.03%     
==========================================
  Files         178      179       +1     
  Lines       10357    10399      +42     
==========================================
+ Hits         9394     9436      +42     
  Misses        745      745              
  Partials      218      218              
Impacted Files Coverage Δ
service/command.go 100.00% <100.00%> (ø)
service/featuregate/flags.go 100.00% <100.00%> (ø)
service/flags.go 93.33% <100.00%> (+0.15%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e23c9d0...f81ac80. Read the comment docs.

Comment on lines 27 to 33
// Flags adds CLI flags for managing feature gates to the provided FlagSet
func Flags(flags *flag.FlagSet) {
flags.Var(
gatesList,
gatesListCfg,
"Comma-delimited list of feature gate identifiers. Prefix with '-' to disable the feature. '+' or no prefix will enable the feature.")
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to see at least couple of examples for the rules. At least in the func comment.

Comment on lines 56 to 59
// GlobalRegistry returns the Registry instance used by package-global functions in this package.
func GlobalRegistry() *Registry {
return reg
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need this to be public?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, per the comment there "and have only a "GetRegistry" func that gets the global one". The idea was not to have both global funcs and global Registry, but have only one global func "GetGlobalRegistry" and the Registry itself.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also that was called a "prototype" and you sneak it in a PR that we need (adding the flag)... not sure this is the right call.

return reg
}

type Registry struct {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the need in this PR that adds the flag to make this public?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather deal with the changes here in one PR than in two. Every open PR I have to carry brings cognitive load and repetitive tasks such as dealing with conflict resolution and upstream changes. The two changes here are to the same component and both were either deferred from or requested after the initial PR that added the gate implementation. Managing separate PRs for them does not make sense.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You still did not answer why is this needed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand where this comes from, but my comment was to remove the other global funcs.

Copy link
Member

@bogdandrutu bogdandrutu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Aneurysm9 for reasons like #4430 we MUST never accept different changes in same PR.

type FlagValue map[string]bool

// String returns a string representing the FlagValue
func (f FlagValue) String() string {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need to be public? (I want to understand)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. It is part of the flag.Value interface.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry wrong line of comment, was looking at SetSlice (you can answer on Slack or after the merge).

@bogdandrutu bogdandrutu merged commit 7059878 into open-telemetry:main Nov 23, 2021
@Aneurysm9 Aneurysm9 deleted the feature_gates_pt2 branch November 24, 2021 20:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants