Skip to content

Commit

Permalink
Merge 380f243 into dee8904
Browse files Browse the repository at this point in the history
  • Loading branch information
indrajithi committed Nov 23, 2023
2 parents dee8904 + 380f243 commit 197f56d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion resources/config.test.edn
Original file line number Diff line number Diff line change
Expand Up @@ -95,5 +95,5 @@
:custom-provider ""}
:new-relic {:report-errors false}
:prometheus {:port 8002
:enabled true}
:enabled false}
:log-format "text"}}
10 changes: 5 additions & 5 deletions src/ziggurat/metrics.clj
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,18 @@
(let [metrics-impl-constructor (get-metrics-implementor-constructor)]
(reset! metric-impl (metrics-impl-constructor))))

(def prometheus-enabled?
(defn prometheus-enabled? []
(:enabled (prometheus-config)))

(defstate metrics-reporter
:start (do (log/info "Initializing Metrics")
(if prometheus-enabled?
(if (prometheus-enabled?)
(prometheus-exporter/start-http-server)
(do
(initialise-metrics-library)
(metrics-interface/initialize @metric-impl (statsd-config)))))
:stop (do (log/info "Terminating Metrics")
(if prometheus-enabled?
(if (prometheus-enabled?)
(prometheus-exporter/stop-http-server)
(metrics-interface/terminate @metric-impl))))

Expand Down Expand Up @@ -102,7 +102,7 @@
tags (remove-topic-tag-for-old-namespace (get-all-tags (get-map additional-tags) metric-namespaces) metric-namespace)
signed-int-value (sign (get-int n))]
(doseq [metric-ns metric-namespaces]
(if prometheus-enabled?
(if (prometheus-enabled?)
(prometheus-exporter/update-counter metric-ns metric tags signed-int-value)
(metrics-interface/update-counter @metric-impl metric-ns metric tags signed-int-value))))))

Expand All @@ -123,7 +123,7 @@
integer-value (get-int val)
metric "all"]
(doseq [metric-ns intercalated-metric-namespaces]
(if prometheus-enabled?
(if (prometheus-enabled?)
(prometheus-exporter/report-histogram metric-ns metric tags integer-value)
(metrics-interface/update-timing @metric-impl metric-ns metric tags integer-value))))))

Expand Down

0 comments on commit 197f56d

Please sign in to comment.