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

Renaming RegistryInterface to Registry and hiding impl details #88

Merged
merged 6 commits into from
May 10, 2024

Conversation

jivimberg
Copy link
Contributor

Renamed RegistryInterface to Registry.
Reduced visibility for spectatordRegistry.
Meant to reduce library API.

@jivimberg jivimberg requested review from sgg and copperlight May 9, 2024 18:43
logger logger.Logger
loggerMutex sync.RWMutex
}

// NewRegistryConfiguredBy loads a new Config JSON file from disk at the path specified.
func NewRegistryConfiguredBy(filePath string) (*Registry, error) {
func NewRegistryConfiguredBy(filePath string) (Registry, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, if you updated this signature to take an optional logger argument and then assigned that to the config, it would obviate the need for a mutable logger on the Registry itself, further simplifying that interface.

Suggested change
func NewRegistryConfiguredBy(filePath string) (Registry, error) {
func NewRegistryConfiguredBy(filePath string, logger Logger) (Registry, error) {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed the option to create a Registry from a file-based config. Thanks for the recommendation 🙌

Copy link
Contributor

Choose a reason for hiding this comment

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

Nice, this should let you shrink surface area of the registry interface too!

Copy link
Collaborator

@copperlight copperlight left a comment

Choose a reason for hiding this comment

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

The overall change looks good, but I think we should add a mention of the SPECTATOR_OUTPUT_LOCATION env var to the README. The use case for this one is configuring no-op writers in CI environments as a fall-back strategy.

@jivimberg
Copy link
Contributor Author

The overall change looks good, but I think we should add a mention of the SPECTATOR_OUTPUT_LOCATION env var to the README. The use case for this one is configuring no-op writers in CI environments as a fall-back strategy.

I think it's already there: https://github.com/Netflix/spectator-go/blob/main/README.md?plain=1#L132

@copperlight
Copy link
Collaborator

The overall change looks good, but I think we should add a mention of the SPECTATOR_OUTPUT_LOCATION env var to the README. The use case for this one is configuring no-op writers in CI environments as a fall-back strategy.

I think it's already there: https://github.com/Netflix/spectator-go/blob/main/README.md?plain=1#L132

Whoops, I lost track of it in the diffs. Thank you!

@copperlight copperlight merged commit 9024900 into main May 10, 2024
2 checks passed
@copperlight copperlight deleted the juan/registry-interface branch May 10, 2024 18:01
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.

3 participants