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

Improve CounterService operations #8800

Closed
jtuberville opened this issue Apr 3, 2017 · 5 comments
Closed

Improve CounterService operations #8800

jtuberville opened this issue Apr 3, 2017 · 5 comments

Comments

@jtuberville
Copy link

While reviewing some projects new to me today, I saw several cases of CounterService being in a for loop in order to have counters on batch processes. I was wondering if it had been discussed to allow increment and decrement in values other than one?

void increment(String metricName, long value);
void decrement(String metricName, long value);

Since internally Delta already has this concept it does not seem challenging to extend the service interface itself. Any thoughts @dsyer or others?

Joshua

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Apr 3, 2017
@dsyer
Copy link
Member

dsyer commented Apr 4, 2017

We intentionally wanted to keep CounterService a simple as possible, but some changes are planned in 2.0, so it's a good time to have the discussion about opening it up.

In the mean time, you can use CounterBuffers if you want access to an efficient incrementer with an explicit value. Delta is expensive if you do it a lot, so it's best not to use it explicitly if you can help it, but if you want to avoid being tied to the buffers implementation you can use MetricWriter. I expect Delta and MetricWriter might be deprecated at some point, but CounterBuffers might will be part of the replacement (maybe with a new interface).

@dsyer dsyer added status: waiting-for-feedback We need additional information before we can continue and removed status: waiting-for-triage An issue we've not yet triaged labels Apr 4, 2017
@wilkinsona wilkinsona added the status: waiting-for-triage An issue we've not yet triaged label Apr 4, 2017
@jtuberville
Copy link
Author

Thanks @dsyer those are new to me. I can not find any write ups. Would we create a @PublicMetrics service that contains the CounterBuffers we want to use?

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Apr 4, 2017
@dsyer
Copy link
Member

dsyer commented Apr 4, 2017

It depends what you want to happen. There is already an instance of CounterBuffers you can autowire (but beware the deprecation that might be coming), and it is already part of the public metrics.

@jtuberville
Copy link
Author

I will still vote for overloading the increment/decrement methods for easier implementation of batch oriented metrics

@wilkinsona
Copy link
Member

This has been superseded by the planned move to Micrometer-based metrics (#9970)

@wilkinsona wilkinsona removed status: feedback-provided Feedback has been provided status: waiting-for-triage An issue we've not yet triaged theme: actuator labels Aug 11, 2017
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

No branches or pull requests

5 participants