You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by "willholley (via GitHub)" <gi...@apache.org> on 2023/03/14 08:48:19 UTC

[GitHub] [couchdb] willholley commented on a diff in pull request #4474: fix: prometheus counter metric naming

willholley commented on code in PR #4474:
URL: https://github.com/apache/couchdb/pull/4474#discussion_r1135193265


##########
src/couch_prometheus/src/couch_prometheus_util.erl:
##########
@@ -167,3 +167,75 @@ val(Data) ->
 val(Key, Stats) ->
     {Key, Data} = lists:keyfind(Key, 1, Stats),
     val(Data).
+
+-ifdef(TEST).
+-include_lib("couch/include/couch_eunit.hrl").
+
+to_prom_test_() ->
+    [
+        ?_assertEqual(
+            <<"couchdb_ddoc_cache 10">>,
+            test_to_prom_output(ddoc_cache, counter, 10)
+        ),
+        ?_assertEqual(

Review Comment:
   @nickva this was just ported verbatim from the deleted [couch_prometheus_util.erl](s[rc/couch_prometheus/test/eunit/couch_prometheus_util_tests.erl](https://github.com/apache/couchdb/pull/4474/files#diff-693448a0247c2a0cf45a63e30a4f07d10099cb25a0fff201210c12ad25dee273) though happy to clean it up so long as it doesn't confuse things. 
   
   The second example you suggest doesn't appear to work - the test runs (with a compiler warning `Warning: a term is constructed, but never used`), but the first assertion is ignored. The examples in [the documentation](https://www.erlang.org/doc/apps/eunit/chapter.html#an-example), look like they use a generator so am I missing something?



-- 
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-unsubscribe@couchdb.apache.org

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