jonasplaum opened a new issue, #5446:
URL: https://github.com/apache/couchdb/issues/5446

   ## Description
   
   The quantiles are in Seconds and the sum is in milliseconds, but both are 
supposed to use the same unit.
   Analysis by rnewson in Slack: 
https://couchdb.slack.com/archives/C49LEE7NW/p1740575676084599?thread_ts=1740575450.920029&cid=C49LEE7NW
   
   "looks like a bug to me;
   ```
   T0 = os:timestamp(),
               {ok, Info} = fabric:get_db_info(Db),
               Suffix = mem3:shard_suffix(Db),
               Etag = chttpd:make_etag({Info, Suffix}),
               DeltaT = timer:now_diff(os:timestamp(), T0) / 1000,
               couch_stats:update_histogram([couchdb, dbinfo], DeltaT),
   ```
   
   os:timestamp is microseconds, so dividing by 1000 gives milliseconds, but 
the prometheuse metric says "seconds"
   
   and then here
   ```
   to_prom_summary(Path, Info) -> Used 3 times
       Metric = path_to_name(Path ++ ["seconds"]),
       {value, Value} = lists:keyfind(value, 1, Info),
       {arithmetic_mean, Mean} = lists:keyfind(arithmetic_mean, 1, Value),
       {percentile, Percentiles} = lists:keyfind(percentile, 1, Value),
       {n, Count} = lists:keyfind(n, 1, Value),
       Quantiles = lists:map(
           fun({Perc, Val0}) ->
               % Prometheus uses seconds, so we need to convert milliseconds to 
seconds
               Val = Val0 / 1000,
   ```
   
   we convert to seconds for the quantiles but not the mean average."
   
   ## Steps to Reproduce
   
   Look at a metric that has a sum, like couchdb_dbinfo_seconds_sum. The 
average is 1000 times higher than expected.
   
   
   ## Your Environment
   
   * CouchDB version used: 3.4.2
   


-- 
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: notifications-unsubscr...@couchdb.apache.org.apache.org

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

Reply via email to