eventuate-tool's kamon-metrics provides
metrics of any replicated log as entity under the category eventuate-replicated-log
using kamon's histograms as basis recording instruments.
The following artifact is published to jfrog's snapshot and release repository:
- Artifact Id:
kamon-metrics_<scala-version>
- Group Name:
com.rbmhtechnology.eventuate-tools
Settings for an sbt-build:
libraryDependencies += "com.rbmhtechnology.eventuate-tools" %% "kamon-metrics" % "<version>"
// for snapshots
resolvers += "OJO Snapshots" at "https://oss.jfrog.org/oss-snapshot-local"
// for releases
resolvers += "OJO Releases" at "https://oss.jfrog.org/oss-release-local"
Initially a KamonReplicationMetricsRecorder
has to be initialized with the ReplicationEndpoint
to
be monitored and optionally a entity-name-prefix:
val endpoint = new ReplicationEndpoint(...)
val metrics = new KamonReplicationMetricsRecorder(endpoint, Some("prefix."))
Recording of metrics starts immediately and can be stopped with:
metrics.stopRecording()
Once recording is started it will record for each event-log managed by the ReplicationEndpoint
under
- the name
"<prefix><logId>"
and - the category
eventuate-replicated-log
the following set of histograms:
sequenceNo
: The sequence number of the local log.localVersionVector.<process-id>
: The entire version vector of the local log. For details see also the Eventuate documentation.- For each remote replica (
<remote-log.id>
) of the local log:replicationProgress.<remote-log-id>
: The replication progress in form of the sequence number in the remote log up to which events have been replicated to the local log.
As each one of the recorded values is only increasing the max-value of the histogram also represents the latest recorded value.
For checking the actual replication progress (i.e. how many events need to be replicated from one log to another for a full replication)
the local sequence number of one log has to be compared with the replication progress of this replica on a remote node.
For example in case of two replication endpoints (endpointA
and endpointB
) on two nodes with a single replicated log (log1
)
and the following recorded values:
- for the entity named:
endpointA_log1
sequenceNo
= 4replicationProgress.endpointB_log1
= 3
- for the entity named :
endpointB_log1
sequenceNo
= 5replicationProgress.endpointA_log1
= 4
one can see that the replication from A to B has caught up with A's local progress as
endpointA_log1
-> sequenceNo
(4) equals endpointB_log1
-> replicationProgress.endpointA_log1
(4).
As opposed to this the replication from B to A lacks behind as endpointB_log1
-> sequenceNo
(5) is
greater than endpointA_log1
-> replicationProgress.endpointB_log1
(3)