Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rewrite the core edge monitoring code as decorators
* Added integration test to check CSV files correctly populated * Added unit tests for monitoring wrapper * Removed initial integration test from MetricsKernelExtensionFactoryIT as it didn't fit in there.
- Loading branch information
Mark Needham
committed
Jan 16, 2016
1 parent
cadf7e9
commit a095933
Showing
17 changed files
with
521 additions
and
73 deletions.
There are no files selected for viewing
109 changes: 109 additions & 0 deletions
109
enterprise/core-edge/src/main/java/org/neo4j/coreedge/raft/log/MonitoredRaftLog.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,109 @@ | |||
/* | |||
* Copyright (c) 2002-2016 "Neo Technology," | |||
* Network Engine for Objects in Lund AB [http://neotechnology.com] | |||
* | |||
* This file is part of Neo4j. | |||
* | |||
* Neo4j is free software: you can redistribute it and/or modify | |||
* it under the terms of the GNU Affero General Public License as | |||
* published by the Free Software Foundation, either version 3 of the | |||
* License, or (at your option) any later version. | |||
* | |||
* This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU Affero General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU Affero General Public License | |||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
*/ | |||
package org.neo4j.coreedge.raft.log; | |||
|
|||
import org.neo4j.coreedge.raft.log.monitoring.RaftLogAppendIndexMonitor; | |||
import org.neo4j.coreedge.raft.log.monitoring.RaftLogCommitIndexMonitor; | |||
import org.neo4j.coreedge.raft.replication.ReplicatedContent; | |||
import org.neo4j.kernel.monitoring.Monitors; | |||
|
|||
public class MonitoredRaftLog implements RaftLog | |||
{ | |||
private final RaftLog delegate; | |||
private final RaftLogAppendIndexMonitor appendIndexMonitor; | |||
private final RaftLogCommitIndexMonitor commitIndexMonitor; | |||
|
|||
public MonitoredRaftLog( RaftLog delegate, Monitors monitors ) | |||
{ | |||
this.delegate = delegate; | |||
this.appendIndexMonitor = monitors.newMonitor( RaftLogAppendIndexMonitor.class, getClass(), APPEND_INDEX_TAG ); | |||
this.commitIndexMonitor = monitors.newMonitor( RaftLogCommitIndexMonitor.class, getClass(), COMMIT_INDEX_TAG ); | |||
} | |||
|
|||
@Override | |||
public long append( RaftLogEntry entry ) throws RaftStorageException | |||
{ | |||
long appendIndex = delegate.append( entry ); | |||
appendIndexMonitor.appendIndex( appendIndex ); | |||
return appendIndex; | |||
} | |||
|
|||
@Override | |||
public void truncate( long fromIndex ) throws RaftStorageException | |||
{ | |||
delegate.truncate( fromIndex ); | |||
appendIndexMonitor.appendIndex( delegate.appendIndex() ); | |||
} | |||
|
|||
@Override | |||
public void commit( long commitIndex ) throws RaftStorageException | |||
{ | |||
delegate.commit( commitIndex ); | |||
commitIndexMonitor.commitIndex( delegate.commitIndex() ); | |||
} | |||
|
|||
@Override | |||
public void replay() throws Throwable | |||
{ | |||
delegate.replay(); | |||
} | |||
|
|||
@Override | |||
public void registerListener( Listener consumer ) | |||
{ | |||
delegate.registerListener( consumer ); | |||
} | |||
|
|||
@Override | |||
public long appendIndex() | |||
{ | |||
return delegate.appendIndex(); | |||
} | |||
|
|||
@Override | |||
public long commitIndex() | |||
{ | |||
return delegate.commitIndex(); | |||
} | |||
|
|||
@Override | |||
public RaftLogEntry readLogEntry( long logIndex ) throws RaftStorageException | |||
{ | |||
return delegate.readLogEntry( logIndex ); | |||
} | |||
|
|||
@Override | |||
public ReplicatedContent readEntryContent( long logIndex ) throws RaftStorageException | |||
{ | |||
return delegate.readEntryContent( logIndex ); | |||
} | |||
|
|||
@Override | |||
public long readEntryTerm( long logIndex ) throws RaftStorageException | |||
{ | |||
return delegate.readEntryTerm( logIndex ); | |||
} | |||
|
|||
@Override | |||
public boolean entryExists( long logIndex ) | |||
{ | |||
return delegate.entryExists( logIndex ); | |||
} | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
...rprise/core-edge/src/main/java/org/neo4j/coreedge/raft/state/term/MonitoredTermState.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,51 @@ | |||
/* | |||
* Copyright (c) 2002-2016 "Neo Technology," | |||
* Network Engine for Objects in Lund AB [http://neotechnology.com] | |||
* | |||
* This file is part of Neo4j. | |||
* | |||
* Neo4j is free software: you can redistribute it and/or modify | |||
* it under the terms of the GNU Affero General Public License as | |||
* published by the Free Software Foundation, either version 3 of the | |||
* License, or (at your option) any later version. | |||
* | |||
* This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU Affero General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU Affero General Public License | |||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
*/ | |||
package org.neo4j.coreedge.raft.state.term; | |||
|
|||
import org.neo4j.coreedge.raft.log.RaftStorageException; | |||
import org.neo4j.coreedge.raft.log.monitoring.RaftTermMonitor; | |||
import org.neo4j.kernel.monitoring.Monitors; | |||
|
|||
public class MonitoredTermState implements TermState | |||
{ | |||
private final TermState delegate; | |||
private final RaftTermMonitor termMonitor; | |||
|
|||
public MonitoredTermState( TermState delegate, Monitors monitors ) | |||
{ | |||
this.delegate = delegate; | |||
|
|||
this.termMonitor = monitors.newMonitor( RaftTermMonitor.class, getClass(), TERM_TAG ); | |||
|
|||
} | |||
|
|||
@Override | |||
public long currentTerm() | |||
{ | |||
return delegate.currentTerm(); | |||
} | |||
|
|||
@Override | |||
public void update( long newTerm ) throws RaftStorageException | |||
{ | |||
delegate.update( newTerm ); | |||
termMonitor.term( newTerm ); | |||
} | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.