xiefan46 commented on a change in pull request #1301: Samza-2478: Add new 
metrics to track key and value size of records written to RocksDb
URL: https://github.com/apache/samza/pull/1301#discussion_r389127286
 
 

 ##########
 File path: 
samza-kv/src/main/scala/org/apache/samza/storage/kv/SerializedKeyValueStore.scala
 ##########
 @@ -62,7 +62,10 @@ class SerializedKeyValueStore[K, V](
     val keyBytes = toBytesOrNull(key, keySerde)
     val valBytes = toBytesOrNull(value, msgSerde)
     store.put(keyBytes, valBytes)
+    val keySizeBytes = if (keyBytes == null) 0 else keyBytes.length
     val valSizeBytes = if (valBytes == null) 0 else valBytes.length
+    metrics.recordKeySizeBytes.update(keySizeBytes)
+    metrics.recordValueSizeBytes.update(valSizeBytes)
     updatePutMetrics(1, valSizeBytes)
 
 Review comment:
   I thought about that before. But maybe there are some people using the 
maximum record size metric and deleting it may caused some trouble. So I choose 
to keep this metric and do not combine it with the histogram. 

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to