🐛 Fix metrics and doc endpoints

This commit is contained in:
Alejandro Alonso 2023-04-05 14:03:55 +02:00 committed by Andrey Antukh
parent 408de63ea3
commit 08c6ebe10c
2 changed files with 9 additions and 9 deletions

View file

@ -89,12 +89,12 @@
(defn- handler (defn- handler
[registry _ respond _] [registry _]
(let [samples (.metricFamilySamples ^CollectorRegistry registry) (let [samples (.metricFamilySamples ^CollectorRegistry registry)
writer (StringWriter.)] writer (StringWriter.)]
(TextFormat/write004 writer samples) (TextFormat/write004 writer samples)
(respond {:headers {"content-type" TextFormat/CONTENT_TYPE_004} {:headers {"content-type" TextFormat/CONTENT_TYPE_004}
:body (.toString writer)}))) :body (.toString writer)}))

View file

@ -65,12 +65,12 @@
[methods] [methods]
(if (contains? cf/flags :backend-api-doc) (if (contains? cf/flags :backend-api-doc)
(let [context (prepare-context methods)] (let [context (prepare-context methods)]
(fn [_ respond _] (fn [_]
(respond {::yrs/status 200 {::yrs/status 200
::yrs/body (-> (io/resource "app/templates/api-doc.tmpl") ::yrs/body (-> (io/resource "app/templates/api-doc.tmpl")
(tmpl/render context))}))) (tmpl/render context))}))
(fn [_ respond _] (fn [_]
(respond {::yrs/status 404})))) {::yrs/status 404})))
(s/def ::routes vector?) (s/def ::routes vector?)