-
Notifications
You must be signed in to change notification settings - Fork 157
Metrics Enhancement #471
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
Metrics Enhancement #471
Conversation
f10aad4 to
f0f8dd7
Compare
f0f8dd7 to
16a1b06
Compare
…nnection pool metrics Change the histogram only record value generated by successful requests.
…for a connection from the pool. Fixed the bug where the pool status was not showing the correct status of each small pool.
eb89a5e to
42cfee8
Compare
lutovich
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zhenlineo changes look good. Made couple comments.
| log.debug( "Channel %s created", channel ); | ||
| incrementInUse( channel ); | ||
| metricsListener.afterCreated( serverAddress( channel ) ); | ||
| throw new IllegalStateException( "A fatal error happened in this driver as this method should never be called. " + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe just throw new UnsupportedOperationException()? Current message reminds me of ThisShouldNotHappenError :)
|
|
||
| long elapsed(); | ||
|
|
||
| interface PoolListenerEvent extends ListenerEvent |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are these empty interfaces needed? Can't ListenerEvent be used everywhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For
MetricsListener#afterAcquiredOrCreated( BoltServerAddress serverAddress, PoolListenerEvent acquireEvent );
and
MetricsListener#void afterAcquiredOrCreated( BoltServerAddress serverAddress, ConnectionListenerEvent acquireEvent );
It is also more clear API to use.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ListenerEvent.PoolListenerEvent and ListenerEvent.ConnectionListenerEvent are the same as ListenerEvent. I do not really see the reason for having them right now. They only force us to type more :)
| Open( 0 ), | ||
| Closed( 1 ); | ||
|
|
||
| private final int value; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this field be removed? It's really up to the users how to interpret the returned status
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But I kind of do not want to have a if-else just for this conversion when publishing the result.
metrics.add( new Metric( path( serverName, "poolStatus" ), metric.poolStatus().value(), date ) );
vs.
PoolStatus staus = metric.poolStatus()
int statusNum = -1;
if( status == PoolStatus.OPEN)
{
statusNum = 0;
}
else if( status == PoolStatus.CLOSED)
{
statusNum = 1;
}
metrics.add( new Metric( path( serverName, "poolStatus"), statusNum, date ) );
I feel for a metrics collector, it does not matter what value you assigned to each PoolStatus.
It is more important to record all possible PoolStatus. I mean it would be good to know the real value, but it will not be a big issue if a user does not know as long as they see they are different. So I thought it would be helpful to have a simple value to use directly.
| public enum PoolStatus | ||
| { | ||
| Open, Closed | ||
| Open( 0 ), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd vote for renaming enum values to OPEN and CLOSED which follows the recommended java code style
c98deb3 to
bef44eb
Compare
Change to unmodified map to return pool and connection metrics to users
bef44eb to
c889fa1
Compare
Based on #470
Added connection
acquiring,acquiredcount andtimedOutToAcquirecount on connection pool metricsChange the histogram only record value generated by successful requests.
Fixed a bug where the pool status was showing the big pool rather than each small pool status.