You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2022/10/13 08:00:35 UTC

[GitHub] [druid] abhishekagarwal87 commented on a diff in pull request #13219: Improve global-cached-lookups metric reporting

abhishekagarwal87 commented on code in PR #13219:
URL: https://github.com/apache/druid/pull/13219#discussion_r994291902


##########
extensions-core/lookups-cached-global/src/main/java/org/apache/druid/data/input/MapPopulator.java:
##########
@@ -245,7 +245,8 @@ static long getByteLengthOfObject(@Nullable Object o)
   {
     if (null != o) {
       if (o.getClass().getName().equals(STRING_CLASS_NAME)) {
-        return ((String) (o)).length();
+        // Each String object has ~40 bytes of overhead
+        return ((long) ((String) (o)).length() * Character.BYTES) + 40;

Review Comment:
   it's better to use the same calculation and code. 
   @zachjsh - can you reuse the code? The common code can be placed in `StringUtils` class. 



-- 
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: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org