Skip to content

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

Merged
merged 4 commits into from
Mar 2, 2018
Merged

Metrics Enhancement #471

merged 4 commits into from
Mar 2, 2018

Conversation

zhenlineo
Copy link
Contributor

@zhenlineo zhenlineo commented Feb 28, 2018

Based on #470
Added connection acquiring, acquired count and timedOutToAcquire count on connection pool metrics
Change 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.

@zhenlineo zhenlineo changed the title Metrics enhance Metrics Enhancement Feb 28, 2018
@zhenlineo zhenlineo force-pushed the 1.6-metrics-enhance branch from f0f8dd7 to 16a1b06 Compare March 1, 2018 09:24
Zhen added 2 commits March 1, 2018 15:31
…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.
@zhenlineo zhenlineo force-pushed the 1.6-metrics-enhance branch from eb89a5e to 42cfee8 Compare March 1, 2018 14:31
@zhenlineo zhenlineo requested a review from lutovich March 1, 2018 14:32
Copy link
Contributor

@lutovich lutovich left a 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. " +
Copy link
Contributor

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
Copy link
Contributor

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?

Copy link
Contributor Author

@zhenlineo zhenlineo Mar 1, 2018

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.

Copy link
Contributor

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;
Copy link
Contributor

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

Copy link
Contributor Author

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.

@@ -20,5 +20,18 @@

public enum PoolStatus
{
Open, Closed
Open( 0 ),
Copy link
Contributor

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

@zhenlineo zhenlineo force-pushed the 1.6-metrics-enhance branch from c98deb3 to bef44eb Compare March 1, 2018 17:16
Change to unmodified map to return pool and connection metrics to users
@zhenlineo zhenlineo force-pushed the 1.6-metrics-enhance branch from bef44eb to c889fa1 Compare March 1, 2018 17:20
@lutovich lutovich merged commit 82e8c16 into neo4j:1.6 Mar 2, 2018
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