[Enhancement] Add Prometheus support (#556)

* Added prometheus to deps list

* WIP - screwing around with Prometheus and grafana

* Added basic prometheus config

* Updated docs in prom_ex module

* Updated README
This commit is contained in:
Kieran
2025-01-09 12:38:17 -08:00
committed by GitHub
parent 8a40d296c4
commit fb27988963
9 changed files with 83 additions and 23 deletions
+6
View File
@@ -99,6 +99,12 @@ config :logger, :default_formatter,
# Use Jason for JSON parsing in Phoenix
config :phoenix, :json_library, Jason
config :pinchflat, Pinchflat.PromEx,
disabled: true,
manual_metrics_start_delay: :no_delay,
drop_metrics_groups: [],
metrics_server: :disabled
# Import environment specific config. This must remain at the bottom
# of this file so it overrides the configuration defined above.
import_config "#{config_env()}.exs"
+2
View File
@@ -81,3 +81,5 @@ config :phoenix_live_view, :debug_heex_annotations, true
# Disable swoosh api client as it is only required for production adapters.
config :swoosh, :api_client, false
config :pinchflat, Pinchflat.PromEx, disabled: false
+3
View File
@@ -72,6 +72,7 @@ if config_env() == :prod do
# For running PF in a subdirectory via a reverse proxy
base_route_path = System.get_env("BASE_ROUTE_PATH", "/")
enable_ipv6 = String.length(System.get_env("ENABLE_IPV6", "")) > 0
enable_prometheus = String.length(System.get_env("ENABLE_PROMETHEUS", "")) > 0
config :logger, level: String.to_existing_atom(System.get_env("LOG_LEVEL", "debug"))
@@ -95,6 +96,8 @@ if config_env() == :prod do
database: db_path,
journal_mode: journal_mode
config :pinchflat, Pinchflat.PromEx, disabled: !enable_prometheus
# The secret key base is used to sign/encrypt cookies and other secrets.
# A default value is used in config/dev.exs and config/test.exs but you
# want to use a different value for prod and you most likely don't want