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

Add ability for a faster and simpler instation of graphite, leveragin… #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

thegreymatter
Copy link

…g sensible defaults.

@@ -13,6 +13,12 @@ public GraphiteMetricsReporterFactory(GraphiteConfiguration configuration, IGrap
_graphiteSwitch = graphiteSwitch;
}

public GraphiteMetricsReporterFactory(string ipAddress, string prefix = "" , bool reportMachineName = false, IGraphiteSwitch graphiteSwitch = null)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not add default values to GraphiteConfiguration object?
We are using an object to keep the API backword compatible

Copy link
Author

Choose a reason for hiding this comment

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

the UX and discoverability of doing it that way is way higher than building an entire object just to discover what config parameters i need, especially since most of the times for simple cases we just need to supply ipAddress.

i accept that the GraphiteConfiguration is a good solution when needed. but it doesn't mean it has to be the only solution.

WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think that using a constructor will lead to a more complex configuration at the long run, since it breaks the encapsulation of the configuratoin.
Whats so painful in creating an object (the default values can be initiated in his ctor the same why), and it would keep backward compatibility, which is the main issue here

Copy link
Author

Choose a reason for hiding this comment

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

the pain is in lack of simplicity and discoverability.

lack of simplicity - it just more code and more mental leaps to create a new graphite reporter.
discoverability - because from the config class i cannot understand with ease what is a must and what is not.

regarding, "breaks the encapsulation of the configuration", i don't understand what it means? can you describe a sensible scenario in which something will "break".

Copy link
Contributor

Choose a reason for hiding this comment

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

"breaks the encapsulation of the configuration" - when you add a parameter to configuration, you'll need to add it to this ctor as well - i.e. breaks encapsulation.

What if we change the design of the configuration object?
Instead of it including all the parameters, it should only include the optional ones.
In the case of GraphiteConfiguration, change it to a ctor which gets the IP (the only actual mandatory parameter), and the rest under GraphiteOptions.

It will make the initial configuration easier, with the flexibility of an object for options.

I've seen this pattern in different libraries (MongoDB.Driver is one of them). It is very convenient.

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