You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by "cschneider (via GitHub)" <gi...@apache.org> on 2026/03/11 13:56:50 UTC

[PR] SLING-13136 - Support metric for non editable queues [sling-org-apache-sling-distribution-journal]

cschneider opened a new pull request, #183:
URL: https://github.com/apache/sling-org-apache-sling-distribution-journal/pull/183

   (no comment)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@sling.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] SLING-13136 - Support metric for non editable queues [sling-org-apache-sling-distribution-journal]

Posted by "cschneider (via GitHub)" <gi...@apache.org>.
cschneider commented on PR #183:
URL: https://github.com/apache/sling-org-apache-sling-distribution-journal/pull/183#issuecomment-4116698799

   I created a new PR


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@sling.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] SLING-13136 - Support metric for non editable queues [sling-org-apache-sling-distribution-journal]

Posted by "cschneider (via GitHub)" <gi...@apache.org>.
cschneider closed pull request #183: SLING-13136 - Support metric for non editable queues
URL: https://github.com/apache/sling-org-apache-sling-distribution-journal/pull/183


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@sling.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] SLING-13136 - Support metric for non editable queues [sling-org-apache-sling-distribution-journal]

Posted by "cschneider (via GitHub)" <gi...@apache.org>.
cschneider commented on code in PR #183:
URL: https://github.com/apache/sling-org-apache-sling-distribution-journal/pull/183#discussion_r2918901806


##########
src/main/java/org/apache/sling/distribution/journal/queue/QueueType.java:
##########
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.distribution.journal.queue;
+
+/**
+ * Type of queue for metrics and filtering: editable (golden publish) or non-editable.

Review Comment:
   Maybe we can explain that the editable queue is the persisted state. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@sling.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] SLING-13136 - Support metric for non editable queues [sling-org-apache-sling-distribution-journal]

Posted by "joerghoh (via GitHub)" <gi...@apache.org>.
joerghoh commented on code in PR #183:
URL: https://github.com/apache/sling-org-apache-sling-distribution-journal/pull/183#discussion_r2918766593


##########
src/main/java/org/apache/sling/distribution/journal/queue/impl/PubQueueProviderImpl.java:
##########
@@ -208,22 +210,27 @@ public OffsetQueue<DistributionQueueItem> getOffsetQueue(String pubAgentName, lo
     
 
     @Override
-    public int getMaxQueueSize(String pubAgentName) {
-        Optional<Long> minOffset = getMinEditableQueueOffset(pubAgentName);
-        if (minOffset.isPresent()) {
-            return getOffsetQueue(pubAgentName, minOffset.get()).getMinOffsetQueue(minOffset.get()).getSize();
-        } else {
-            return 0;
-        }
+    public int getMaxQueueSize(String pubAgentName, QueueType queueType) {
+        return computeMaxQueueSize(pubAgentName, subscriberFilterFor(pubAgentName, queueType));
+    }
+
+    private Predicate<String> subscriberFilterFor(String agentName, QueueType queueType) {

Review Comment:
   please provide some minimal documentation what this is for



##########
src/main/java/org/apache/sling/distribution/journal/queue/impl/PubQueueProviderImpl.java:
##########
@@ -208,22 +210,27 @@ public OffsetQueue<DistributionQueueItem> getOffsetQueue(String pubAgentName, lo
     
 
     @Override
-    public int getMaxQueueSize(String pubAgentName) {
-        Optional<Long> minOffset = getMinEditableQueueOffset(pubAgentName);
-        if (minOffset.isPresent()) {
-            return getOffsetQueue(pubAgentName, minOffset.get()).getMinOffsetQueue(minOffset.get()).getSize();
-        } else {
-            return 0;
-        }
+    public int getMaxQueueSize(String pubAgentName, QueueType queueType) {
+        return computeMaxQueueSize(pubAgentName, subscriberFilterFor(pubAgentName, queueType));
+    }
+
+    private Predicate<String> subscriberFilterFor(String agentName, QueueType queueType) {
+        boolean wantEditable = (queueType == QueueType.EDITABLE);
+        return sub -> isEditable(agentName, sub) == wantEditable;
     }
 
-    private Optional<Long> getMinEditableQueueOffset(String pubAgentName) {
-        return callback.getSubscribedAgentIds(pubAgentName).stream()
-            .filter(subAgentName -> isEditable(pubAgentName, subAgentName))
-            .map(subAgentName -> lastProcessedOffset(pubAgentName, subAgentName))
+    private int computeMaxQueueSize(String pubAgentName, Predicate<String> subscriberFilter) {

Review Comment:
   some additional documentation here as well, please



##########
src/main/java/org/apache/sling/distribution/journal/queue/PubQueueProvider.java:
##########
@@ -38,11 +38,12 @@ public interface PubQueueProvider extends Closeable {
     DistributionQueue getQueue(String pubAgentName, String queueName);
     
     /**
-     * Get maximum size of all queues for a pubAgentName
+     * Get maximum size of all queues for a pubAgentName, filtered by queue type.

Review Comment:
   so that means, that queues must exist for this pubAgentName, and that at least one of these queues have to have the correct queue type?



##########
src/main/java/org/apache/sling/distribution/journal/queue/QueueType.java:
##########
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.distribution.journal.queue;
+
+/**
+ * Type of queue for metrics and filtering: editable (golden publish) or non-editable.

Review Comment:
   ```suggestion
    * Type of queue for metrics and filtering: editable or non-editable.
   ```
   
   And even then, what's the difference between those? Please explain without referring to AEM :)
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@sling.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] SLING-13136 - Support metric for non editable queues [sling-org-apache-sling-distribution-journal]

Posted by "cschneider (via GitHub)" <gi...@apache.org>.
cschneider commented on code in PR #183:
URL: https://github.com/apache/sling-org-apache-sling-distribution-journal/pull/183#discussion_r2918895529


##########
src/main/java/org/apache/sling/distribution/journal/queue/PubQueueProvider.java:
##########
@@ -38,11 +38,12 @@ public interface PubQueueProvider extends Closeable {
     DistributionQueue getQueue(String pubAgentName, String queueName);
     
     /**
-     * Get maximum size of all queues for a pubAgentName
+     * Get maximum size of all queues for a pubAgentName, filtered by queue type.

Review Comment:
   yes



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@sling.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] SLING-13136 - Support metric for non editable queues [sling-org-apache-sling-distribution-journal]

Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #183:
URL: https://github.com/apache/sling-org-apache-sling-distribution-journal/pull/183#issuecomment-4039429977

   ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=apache_sling-org-apache-sling-distribution-journal&pullRequest=183) **Quality Gate passed**  
   Issues  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [2 New issues](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-distribution-journal&pullRequest=183&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/accepted-16px.png '') [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-distribution-journal&pullRequest=183&issueStatuses=ACCEPTED)
   
   Measures  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-distribution-journal&pullRequest=183&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [100.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-distribution-journal&pullRequest=183&metric=new_coverage&view=list)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-distribution-journal&pullRequest=183&metric=new_duplicated_lines_density&view=list)  
     
   [See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_sling-org-apache-sling-distribution-journal&pullRequest=183)
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@sling.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] SLING-13136 - Support metric for non editable queues [sling-org-apache-sling-distribution-journal]

Posted by "joerghoh (via GitHub)" <gi...@apache.org>.
joerghoh commented on PR #183:
URL: https://github.com/apache/sling-org-apache-sling-distribution-journal/pull/183#issuecomment-4039723166

   @cschneider SLING-13136 does not give much context, so can you please provide here a bit of context here? Especially when you introduce the concept of "editable queues" here as well.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@sling.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] SLING-13136 - Support metric for non editable queues [sling-org-apache-sling-distribution-journal]

Posted by "joerghoh (via GitHub)" <gi...@apache.org>.
joerghoh commented on code in PR #183:
URL: https://github.com/apache/sling-org-apache-sling-distribution-journal/pull/183#discussion_r2918774403


##########
src/main/java/org/apache/sling/distribution/journal/queue/impl/PubQueueProviderImpl.java:
##########
@@ -208,22 +210,27 @@ public OffsetQueue<DistributionQueueItem> getOffsetQueue(String pubAgentName, lo
     
 
     @Override
-    public int getMaxQueueSize(String pubAgentName) {
-        Optional<Long> minOffset = getMinEditableQueueOffset(pubAgentName);
-        if (minOffset.isPresent()) {
-            return getOffsetQueue(pubAgentName, minOffset.get()).getMinOffsetQueue(minOffset.get()).getSize();
-        } else {
-            return 0;
-        }
+    public int getMaxQueueSize(String pubAgentName, QueueType queueType) {
+        return computeMaxQueueSize(pubAgentName, subscriberFilterFor(pubAgentName, queueType));
+    }
+
+    private Predicate<String> subscriberFilterFor(String agentName, QueueType queueType) {
+        boolean wantEditable = (queueType == QueueType.EDITABLE);
+        return sub -> isEditable(agentName, sub) == wantEditable;
     }
 
-    private Optional<Long> getMinEditableQueueOffset(String pubAgentName) {
-        return callback.getSubscribedAgentIds(pubAgentName).stream()
-            .filter(subAgentName -> isEditable(pubAgentName, subAgentName))
-            .map(subAgentName -> lastProcessedOffset(pubAgentName, subAgentName))
+    private int computeMaxQueueSize(String pubAgentName, Predicate<String> subscriberFilter) {
+        Optional<Long> minOffset = callback.getSubscribedAgentIds(pubAgentName).stream()
+            .filter(subscriberFilter)
+            .map(sub -> lastProcessedOffset(pubAgentName, sub))
             .min(Long::compare);
+        if (minOffset.isPresent()) {
+            return getOffsetQueue(pubAgentName, minOffset.get())
+                .getMinOffsetQueue(minOffset.get()).getSize();
+        }
+        return 0;
     }
-    
+

Review Comment:
   please remove this whitespace only change



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@sling.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org