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

feat: expose BatchCounter for MetricBatcher #28

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

Conversation

b1tamara
Copy link

Exposing BatchCounter allows to set Tags for the metrics (similar to metric sender ValueCounter)
Related to cloudfoundry/routing-release#445

@b1tamara
Copy link
Author

@geofffranks Could you maybe review it?

@@ -52,6 +53,7 @@ type MetricBatcher interface {
BatchIncrementCounter(name string)
BatchAddCounter(name string, delta uint64)
Close()
BatchCounter(name string) metricbatcher.BatchCounterChainer

Choose a reason for hiding this comment

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

Suggested change
BatchCounter(name string) metricbatcher.BatchCounterChainer
BatchCounter(name string) metricBatcher.BatchCounterChainer

Choose a reason for hiding this comment

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

the camel case is lost here, it does not correspond to the other code

Copy link
Author

Choose a reason for hiding this comment

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

as it is imported library name, I will not change it.

Choose a reason for hiding this comment

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

The name is not longer and more readable in camel case, that' s why I would prefer that. It was only a suggestion, of course you are free to keep it.

@@ -21,6 +21,7 @@ package metrics

import (
"github.com/cloudfoundry/dropsonde/metric_sender"
"github.com/cloudfoundry/dropsonde/metricbatcher"

Choose a reason for hiding this comment

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

Suggested change
"github.com/cloudfoundry/dropsonde/metricbatcher"
"metricBatcher github.com/cloudfoundry/dropsonde/metricbatcher"

Copy link

Choose a reason for hiding this comment

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

I agree with @b1tamara, the imported package should not be aliased in camel case notation.

@Dariquest Good package names are short and clear. They are lower case, with no under_scores or mixedCaps.. Check the whole blogpost on package names for more information ;)

Copy link

@Dariquest Dariquest Jan 15, 2025

Choose a reason for hiding this comment

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

Thanks for the blogpost @chombium. The name is not longer and more readable in camel case. Only imho. My suggestion might be more appropriate for other programming languages then Go, which I am used to :)

The package names should be at least unified, what I can find here is unfortunately:

import (
	"github.com/cloudfoundry/dropsonde/metric_sender"
	"github.com/cloudfoundry/dropsonde/metricbatcher"

Choose a reason for hiding this comment

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

@Dariquest I know what you mean and I would completely agree if it wasn't Go. Go has some different conventions. On the other hand, we have the same import used like here in many places in other CF components.

Copy link

@chombium chombium left a comment

Choose a reason for hiding this comment

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

LGTM!
@ctlong, @geofffranks any objections maybe?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Pending Merge | Prioritized
Development

Successfully merging this pull request may close these issues.

3 participants