introduce prometheus endpoint
diff --git a/rebar.config.script b/rebar.config.script
index 4abdcc9..f3c526c 100644
--- a/rebar.config.script
+++ b/rebar.config.script
@@ -174,7 +174,8 @@
 {meck,             "meck",             {tag, "0.8.8"}},
 {recon,            "recon",            {tag, "2.5.0"}},
 {passage,          "passage",          {tag, "0.2.6"}},
-{thrift_protocol,  "thrift-protocol",  {tag, "0.1.5"}}
+{thrift_protocol,  "thrift-protocol",  {tag, "0.1.5"}},
+{prometheus,  "prometheus",  {tag, "master"}}
 ].
 
 WithProper = lists:keyfind(with_proper, 1, CouchConfig) == {with_proper, true}.
diff --git a/src/couch/src/couch.app.src b/src/couch/src/couch.app.src
index 6116c79..592b1a1 100644
--- a/src/couch/src/couch.app.src
+++ b/src/couch/src/couch.app.src
@@ -45,7 +45,8 @@
         couch_event,
         ioq,
         couch_stats,
-        hyper
+        hyper,
+        prometheus
     ]},
     {env, [
         { httpd_global_handlers, [
diff --git a/src/couch_stats/src/couch_stats.erl b/src/couch_stats/src/couch_stats.erl
index 4fde14a..dfa7836 100644
--- a/src/couch_stats/src/couch_stats.erl
+++ b/src/couch_stats/src/couch_stats.erl
@@ -58,18 +58,33 @@
     case folsom_metrics:new_counter(Name) of
         ok -> ok;
         {error, Name, metric_already_exists} -> {error, metric_exists}
-    end;
+    end,
+    FlatName = lists:foldl(fun(NamePart, Acc) ->
+        atom_to_list(NamePart) ++ "_"  ++  Acc
+    end, "", Name),
+    prometheus_counter:new([{name, list_to_atom(FlatName)}, {help, FlatName}]);
 new(histogram, Name) ->
     Time = config:get_integer("stats", "interval", ?DEFAULT_INTERVAL),
     case folsom_metrics:new_histogram(Name, slide_uniform, {Time, 1024}) of
         ok -> ok;
         {error, Name, metric_already_exists} -> {error, metric_exists}
-    end;
+    end,
+    FlatName = lists:foldl(fun(NamePart, Acc) ->
+        atom_to_list(NamePart) ++ "_"  ++  Acc
+    end, "", Name),
+    prometheus_histogram:new([{name, list_to_atom(FlatName)},
+        {labels, [method]},
+        {buckets, [50, 75, 90, 95, 99, 999]},
+        {help, FlatName}]);
 new(gauge, Name) ->
     case folsom_metrics:new_gauge(Name) of
         ok -> ok;
         {error, Name, metric_already_exists} -> {error, metric_exists}
-    end;
+    end,
+    FlatName = lists:foldl(fun(NamePart, Acc) ->
+        atom_to_list(NamePart) ++ "_"  ++  Acc
+    end, "", Name),
+    prometheus_gauge:new([{name, list_to_atom(FlatName)}, {help, FlatName}]);
 new(_, _) ->
     {error, unsupported_type}.