Merge branch 'stable-3.5' into stable-3.6 * stable-3.5: Fix pull-replication plugin startup which was always failing Add description for pending tasks metric Add description for in_flight metric Fixed typo in metric description Change-Id: Ib8517e700ed248863878e6fa37258a71cbedb8b3
diff --git a/src/main/java/com/googlesource/gerrit/plugins/replication/pull/event/EventsBrokerMessageConsumer.java b/src/main/java/com/googlesource/gerrit/plugins/replication/pull/event/EventsBrokerMessageConsumer.java index 13b038e..a21a48c 100644 --- a/src/main/java/com/googlesource/gerrit/plugins/replication/pull/event/EventsBrokerMessageConsumer.java +++ b/src/main/java/com/googlesource/gerrit/plugins/replication/pull/event/EventsBrokerMessageConsumer.java
@@ -34,7 +34,7 @@ public class EventsBrokerMessageConsumer implements Consumer<Event>, LifecycleListener { private static final FluentLogger logger = FluentLogger.forEnclosingClass(); - private final DynamicItem<BrokerApi> eventsBroker; + private final DynamicItem<BrokerApi> eventsBrokerDi; private final StreamEventListener eventListener; private final ShutdownState shutdownState; private final String eventsTopicName; @@ -48,7 +48,7 @@ @Named(STREAM_EVENTS_TOPIC_NAME) String eventsTopicName, @Nullable @Named(STREAM_EVENTS_GROUP_ID) String groupId) { - this.eventsBroker = eventsBroker; + this.eventsBrokerDi = eventsBroker; this.eventListener = eventListener; this.shutdownState = shutdownState; this.eventsTopicName = eventsTopicName; @@ -67,18 +67,18 @@ @Override public void start() { - BrokerApi brokerApi = eventsBroker.get(); + BrokerApi brokerApi = eventsBrokerDi.get(); if (groupId == null) { brokerApi.receiveAsync(eventsTopicName, this); return; } - if (!(eventsBroker instanceof ExtendedBrokerApi)) { + if (!(brokerApi instanceof ExtendedBrokerApi)) { throw new IllegalArgumentException( String.format( "Failed to load the pull-replication plugin: %s does not support the custom group-id '%s'.\n" + "Remove replication.eventBrokerGroupId from replication.config or install a different event-broker plugin.", - eventsBroker.getClass(), groupId)); + brokerApi.getClass(), groupId)); } ((ExtendedBrokerApi) brokerApi).receiveAsync(eventsTopicName, groupId, this); @@ -87,6 +87,6 @@ @Override public void stop() { shutdownState.setIsShuttingDown(true); - eventsBroker.get().disconnect(); + eventsBrokerDi.get().disconnect(); } }
diff --git a/src/main/resources/Documentation/metrics.md b/src/main/resources/Documentation/metrics.md index 6fd6cf2..ac1539c 100644 --- a/src/main/resources/Documentation/metrics.md +++ b/src/main/resources/Documentation/metrics.md
@@ -32,6 +32,10 @@ - `scheduled`: (counter) number of tasks triggered and scheduled for execution. +- `in_flight`: (gauge) number of tasks currently being executed. + +- `pending`: (gauge) number of tasks waiting to be executed. + - `started`: (counter) number of tasks started. - `rescheduled`: (counter) number of tasks re-scheduled for execution. @@ -44,7 +48,7 @@ error and none of the operations took place; a partial failure is when some of the operations in the tasks succeeded but other failed. -- `retrying`: (counter) number of tasks being retired for execution. +- `retrying`: (counter) number of tasks being retried for execution. - `not_scheduled`: (counter) number of tasks which have been discarded before being executed, because redundant (duplicate of existing scheduled tasks)