Skip to content

Commit

Permalink
add integration with new relic
Browse files Browse the repository at this point in the history
  • Loading branch information
macielti committed Nov 10, 2024
1 parent b299195 commit 96897b9
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 17 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@
:exclusions [amazonica]

:dependencies [[org.clojure/clojure "1.12.0"]
[net.clojars.macielti/common-clj "37.71.70"]
[net.clojars.macielti/common-clj "37.71.71"]
[io.pedestal/pedestal.service "0.7.2"]
[io.pedestal/pedestal.jetty "0.7.2"]
[io.pedestal/pedestal.error "0.7.2"]
[net.clojars.macielti/service-component "1.3.2"]
[net.clojars.macielti/porteiro-component "0.3.1"]
[net.clojars.macielti/postgresql-component "2.2.2"]
[com.github.clj-easy/graal-build-time "1.0.5"]
[net.clojars.macielti/new-relic-component "0.1.0"]
[com.taoensso/timbre "6.6.1"]]

:profiles {:dev {:plugins [[com.github.clojure-lsp/lein-clojure-lsp "1.4.13"]
Expand Down Expand Up @@ -50,12 +51,15 @@
"native-image"

"-Ob"
"--enable-url-protocols=http,https"

"--initialize-at-run-time=io.prometheus.client.Striped64"

"--initialize-at-build-time"
"--initialize-at-build-time=org.pg.enums.TxLevel"
"--initialize-at-build-time=org.pg.enums.CopyFormat"
"--initialize-at-build-time=org.pg.enums.TXStatus"

"--initialize-at-build-time"
"--report-unsupported-elements-at-runtime"
"--features=clj_easy.graal_build_time.InitClojureClasses"
"-Dio.pedestal.log.defaultMetricsRecorder=nil"
Expand Down
36 changes: 23 additions & 13 deletions src/rango_graalvm/components.clj
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
(ns rango-graalvm.components
(:require [common-clj.integrant-components.config :as component.config]
(:require [clojure.tools.logging :as log]
[common-clj.integrant-components.config :as component.config]
[common-clj.integrant-components.routes :as component.routes]
[common-clj.integrant-components.prometheus :as component.prometheus]
[common-clj.integrant-components.http-client :as component.http-client]
[new-relic-component.core :as component.new-relic]
[integrant.core :as ig]
[porteiro-component.admin-component :as porteiro.admin]
[porteiro-component.diplomat.http-server :as porteiro.diplomat.http-server]
Expand All @@ -13,23 +17,29 @@
(taoensso.timbre.tools.logging/use-timbre)

(def config
{::component.config/config {:path "resources/config.edn"
:env :prod}
::component.postgresql/postgresql {:components {:config (ig/ref ::component.config/config)}}
::porteiro.admin/admin {:components {:config (ig/ref ::component.config/config)
:postgresql (ig/ref ::component.postgresql/postgresql)}}
::component.routes/routes {:routes (concat diplomat.http-server/routes porteiro.diplomat.http-server/routes)}
::component.service/service {:components {:config (ig/ref ::component.config/config)
:routes (ig/ref ::component.routes/routes)
:postgresql (ig/ref ::component.postgresql/postgresql)}}})
{::component.config/config {:path "resources/config.edn"
:env :prod}
::component.prometheus/prometheus {:metrics []}
::component.http-client/http-client {:components {:config (ig/ref ::component.config/config)
:prometheus (ig/ref ::component.prometheus/prometheus)}}
::component.new-relic/new-relic {:components {:config (ig/ref ::component.config/config)
:http-client (ig/ref ::component.http-client/http-client)}}
::component.postgresql/postgresql {:components {:config (ig/ref ::component.config/config)}}
::porteiro.admin/admin {:components {:config (ig/ref ::component.config/config)
:postgresql (ig/ref ::component.postgresql/postgresql)}}
::component.routes/routes {:routes (concat diplomat.http-server/routes porteiro.diplomat.http-server/routes)}
::component.service/service {:components {:config (ig/ref ::component.config/config)
:routes (ig/ref ::component.routes/routes)
:postgresql (ig/ref ::component.postgresql/postgresql)}}})

(defn start-system! []
(ig/init config))

(defn -main [& _args]
(start-system!))
(start-system!)
(log/info :service-is-ready))

(def config-test
(-> config
(assoc :common-clj.integrant-components.config/config {:path "resources/config.example.edn"
:env :test})))
(assoc ::component.config/config {:path "resources/config.example.edn"
:env :test})))

0 comments on commit 96897b9

Please sign in to comment.