jtuglu1 commented on code in PR #18966:
URL: https://github.com/apache/druid/pull/18966#discussion_r2761898386


##########
sql/src/main/java/org/apache/druid/sql/calcite/schema/BrokerSegmentMetadataCache.java:
##########
@@ -358,10 +358,34 @@ private Map<String, PhysicalDatasourceMetadata> 
queryDataSourceInformation(Set<S
   private void updateDSMetadata(String dataSource, PhysicalDatasourceMetadata 
physicalDatasourceMetadata)
   {
     final PhysicalDatasourceMetadata oldTable = tables.put(dataSource, 
physicalDatasourceMetadata);
-    if (oldTable == null || 
!oldTable.getRowSignature().equals(physicalDatasourceMetadata.getRowSignature()))
 {
-      log.info("[%s] has new signature: %s.", dataSource, 
physicalDatasourceMetadata.getRowSignature());
+    final RowSignature newRowSignature = 
physicalDatasourceMetadata.getRowSignature();
+    final int newColumnCount = newRowSignature.getColumnNames().size();
+
+    final ServiceMetricEvent.Builder builder =
+        new ServiceMetricEvent.Builder().setDimension(DruidMetrics.DATASOURCE, 
dataSource);
+
+    if (oldTable == null) {
+      log.info(
+          "Row signature for datasource[%s] initialized with [%d] columns - 
signature[%s]",
+          dataSource, newColumnCount, newRowSignature
+      );
+
+      emitMetric(Metric.SCHEMA_ROW_SIGNATURE_INITIALIZED, 1, builder);

Review Comment:
   Do we really need this `SCHEMA_ROW_SIGNATURE_INITIALIZED` metric? I wonder 
if it suffices to just look at the earliest `SCHEMA_ROW_SIGNATURE_COLUMN_COUNT` 
for a given deployment?



##########
docs/operations/metrics.md:
##########
@@ -462,6 +462,9 @@ These metrics are emitted by the Druid Coordinator in every 
run of the correspon
 |`segment/schemaCache/dataSource/removed`|Emitted when a datasource is removed 
from the Broker cache due to segments being marked as unused.|`dataSource`||
 |`segment/schemaCache/refresh/time`|Time taken to refresh segments in 
coordinator segment schema cache.|`dataSource`||
 |`segment/schemaCache/backfill/count`|Number of segments for which schema was 
back filled in the database.|`dataSource`||
+|`segment/schemaCache/rowSignature/initialized`|Emitted when a datasource row 
signature is initialized for the first time in the Broker's segment metadata 
cache.|`dataSource`||
+|`segment/schemaCache/rowSignature/changed`|Emitted when the cached row 
signature on the Broker's segment metadata cache for a datasource changes, 
indicating schema evolution or some form of flapping.|`dataSource`||
+|`segment/schemaCache/rowSignature/column/count`|Number of columns in the 
updated row signature for a datasource.|`dataSource`||

Review Comment:
   nit: `Number of columns in the row signature for a datasource.`



-- 
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