add observability: LiveDashboard in prod, error tracking, JSON logging

- Move LiveDashboard to /admin/dashboard behind session auth (all envs)
- Add ErrorTracker at /admin/errors for auto-captured exceptions
- Add Oban job and LiveView metrics to telemetry module
- Add logger_json for structured JSON logs in production
- Enable os_mon for CPU/disk/memory in LiveDashboard OS Data tab
- Extend logger metadata with oban_worker and oban_queue fields

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
jamey
2026-02-08 17:02:21 +00:00
parent 1ee37c853d
commit 88291f276b
7 changed files with 50 additions and 11 deletions

View File

@@ -75,7 +75,7 @@ config :tailwind,
# Configures Elixir's Logger
config :logger, :default_formatter,
format: "$time $metadata[$level] $message\n",
metadata: [:request_id]
metadata: [:request_id, :oban_worker, :oban_queue]
# Use Jason for JSON parsing in Phoenix
config :phoenix, :json_library, Jason
@@ -83,6 +83,12 @@ config :phoenix, :json_library, Jason
# ex_money configuration for currency handling
config :ex_money, default_cldr_backend: SimpleshopTheme.Cldr
# Error tracking (stored in DB, auto-captures Phoenix/LiveView/Oban errors)
config :error_tracker,
repo: SimpleshopTheme.Repo,
otp_app: :simpleshop_theme,
plugins: [ErrorTracker.Plugins.Pruner]
# Stripe configuration
config :stripity_stripe, api_version: "2024-12-18.acacia"

View File

@@ -17,5 +17,8 @@ config :swoosh, local: false
# Do not print debug messages in production
config :logger, level: :info
# Structured JSON logs for production (machine-parseable by fly logs, journalctl, Loki, etc.)
config :logger, :default_handler, formatter: {LoggerJSON.Formatters.Basic, []}
# Runtime production configuration, including reading
# of environment variables, is done on config/runtime.exs.