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 (since it's emitted in both cases). For "one-off" events
I tend to lean towards logging them (and then for repeated events use metrics),
although I suppose this would catch bugs where the table schema was getting
cleared somehow. I'm not sure how much value adding the initialized metric
provides given you would be checking logs anyways most likely to see old column
count, etc.
--
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]