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_r389322172
 
 

 ##########
 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 am not very sure about that because I am not very familiar with the code 
yet. I will keep that in mind and try to optimize it in the future if possible. 

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