kfaraz commented on code in PR #18314:
URL: https://github.com/apache/druid/pull/18314#discussion_r2230219536


##########
server/src/main/java/org/apache/druid/client/BrokerServerView.java:
##########
@@ -281,6 +286,7 @@ private void serverAddedSegment(final DruidServerMetadata 
server, final DataSegm
 
           timeline.add(segment.getInterval(), segment.getVersion(), 
segment.getShardSpec().createChunk(selector));
           selectors.put(segmentId, selector);
+          incrementSegmentCount(getMetricKey(segment));

Review Comment:
   Sorry, I missed this in the original feedback, I think we need to 
de-duplicate the segment counts as the same segment may be served by multiple 
processes. So, for every `RowKey` (which already has datasource, interval, 
version), you can keep a `Set` of partition numbers. The size of this set will 
give the overall `segment/available/count`.
   
   Also, looking at the embedded tests, I think your original idea of emitting 
events upon addition/removal might be useful too. You can either add it in this 
PR or a follow up.
   
   So, you can emit a detailed event 
`serverview/segment/added`/`serverview/segment/removed` which has `datasource`, 
`server`, `description` (containing full segment ID). Just track the 
addition/removal events in a map in `BrokerServerView` and flush the map when 
`doMonitor` calls `BrokerServerView.getSegmentsUpdated()`.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to