curator-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Randgalt <...@git.apache.org>
Subject [GitHub] curator pull request #165: [CURATOR-349] Expose extra metrics in TracerDrive...
Date Mon, 10 Oct 2016 21:07:46 GMT
Github user Randgalt commented on a diff in the pull request:

    https://github.com/apache/curator/pull/165#discussion_r82682285
  
    --- Diff: curator-client/src/main/java/org/apache/curator/ConnectionState.java ---
    @@ -199,13 +202,28 @@ private synchronized void checkTimeouts() throws Exception
                         {
                             log.error(String.format("Connection timed out for connection
string (%s) and timeout (%d) / elapsed (%d)", zooKeeper.getConnectionString(), connectionTimeoutMs,
elapsed), connectionLossException);
                         }
    -                    tracer.get().addCount("connections-timed-out", 1);
    +                    new EventTrace("connections-timed-out", tracer.get(), getSessionId()).commit();
                         throw connectionLossException;
                     }
                 }
             }
         }
     
    +    /**
    +     * Return the current session id
    +     */
    +    public long getSessionId() {
    +        long sessionId = -1;
    +        if (isConnected()) {
    +            try {
    +                sessionId = getZooKeeper().getSessionId();
    --- End diff --
    
    This is an expensive call. Is it really necessary? Maybe we can get the session ID cheaper
by a direct call to `zooKeeper.getZooKeeper()` - (checking for nulls)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message