Persist telemetry data in local sqlite database
This commit is contained in:
+5
-1
@@ -14,7 +14,7 @@ config :elixir, :time_zone_database, TimeZoneInfo.TimeZoneDatabase
|
||||
config :time_zone_info, update: :daily
|
||||
|
||||
config :music_library,
|
||||
ecto_repos: [MusicLibrary.BackgroundRepo, MusicLibrary.Repo],
|
||||
ecto_repos: [MusicLibrary.BackgroundRepo, MusicLibrary.Repo, MusicLibrary.TelemetryRepo],
|
||||
generators: [timestamp_type: :utc_datetime, binary_id: true]
|
||||
|
||||
config :music_library, default_timezone: "Europe/London"
|
||||
@@ -112,6 +112,10 @@ config :oban_met, sketch_time_unit: :millisecond
|
||||
|
||||
config :music_library, MusicLibrary.BackgroundRepo, priv: "priv/background_repo"
|
||||
|
||||
config :music_library, MusicLibrary.TelemetryRepo, priv: "priv/telemetry_repo", log: false
|
||||
|
||||
config :music_library, MusicLibraryWeb.Telemetry.Storage, buffer_size: 1024
|
||||
|
||||
config :swoosh, :api_client, Swoosh.ApiClient.Req
|
||||
|
||||
config :music_library, MusicLibrary.Mailer,
|
||||
|
||||
@@ -14,6 +14,12 @@ config :music_library, MusicLibrary.BackgroundRepo,
|
||||
stacktrace: true,
|
||||
show_sensitive_data_on_connection_error: true
|
||||
|
||||
config :music_library, MusicLibrary.TelemetryRepo,
|
||||
database: Path.expand("../data/music_library_telemetry_dev.db", __DIR__),
|
||||
pool_size: 3,
|
||||
stacktrace: true,
|
||||
show_sensitive_data_on_connection_error: true
|
||||
|
||||
# For development, we disable any cache and enable
|
||||
# debugging and code reloading.
|
||||
#
|
||||
|
||||
@@ -117,6 +117,19 @@ if config_env() == :prod do
|
||||
pool_size: String.to_integer(System.get_env("POOL_SIZE") || "5"),
|
||||
show_sensitive_data_on_connection_error: false
|
||||
|
||||
telemetry_database_path =
|
||||
System.get_env("TELEMETRY_DATABASE_PATH") ||
|
||||
raise """
|
||||
environment variable TELEMETRY_DATABASE_PATH is missing.
|
||||
For example: /etc/music_library/music_library_telemetry.db
|
||||
"""
|
||||
|
||||
config :music_library, MusicLibrary.TelemetryRepo,
|
||||
database: telemetry_database_path,
|
||||
cache_size: -4000,
|
||||
pool_size: 2,
|
||||
show_sensitive_data_on_connection_error: false
|
||||
|
||||
# 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
|
||||
|
||||
@@ -21,6 +21,15 @@ config :music_library, MusicLibrary.BackgroundRepo,
|
||||
pool_size: 32,
|
||||
pool: Ecto.Adapters.SQL.Sandbox
|
||||
|
||||
config :music_library, MusicLibrary.TelemetryRepo,
|
||||
database:
|
||||
Path.expand(
|
||||
"../data/music_library_telemetry_test#{System.get_env("MIX_TEST_PARTITION")}.db",
|
||||
__DIR__
|
||||
),
|
||||
pool_size: 5,
|
||||
pool: Ecto.Adapters.SQL.Sandbox
|
||||
|
||||
# We don't run a server during test. If one is required,
|
||||
# you can enable the server option below.
|
||||
config :music_library, MusicLibraryWeb.Endpoint,
|
||||
|
||||
Reference in New Issue
Block a user