From 9d3e25342cdf11ad8b6fb025209629552f816b1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luismi=20Ram=C3=ADrez?= Date: Tue, 26 Oct 2021 12:34:15 +0200 Subject: [PATCH] Make StatsD configurable Agent StatsD server is now configurable using the new `enable_statsd` config option. It's disabled by default. --- ...add-new-config-option-to-enable-disable-statsd.md | 5 +++++ lib/appsignal/config.ex | 3 +++ test/appsignal/config_test.exs | 12 ++++++++++++ test/integration/diagnose | 2 +- 4 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 .changesets/add-new-config-option-to-enable-disable-statsd.md diff --git a/.changesets/add-new-config-option-to-enable-disable-statsd.md b/.changesets/add-new-config-option-to-enable-disable-statsd.md new file mode 100644 index 000000000..90bfbc470 --- /dev/null +++ b/.changesets/add-new-config-option-to-enable-disable-statsd.md @@ -0,0 +1,5 @@ +--- +bump: "patch" +--- + +Add new config option to enable/disable StatsD server in the AppSignal agent. This new config option is called `enable_statsd` and is set to `false` by default. If set to `true`, the AppSignal agent will start a StatsD server on port 8125 on the host. diff --git a/lib/appsignal/config.ex b/lib/appsignal/config.ex index 9060ec643..c7dc4eb99 100644 --- a/lib/appsignal/config.ex +++ b/lib/appsignal/config.ex @@ -10,6 +10,7 @@ defmodule Appsignal.Config do dns_servers: [], enable_host_metrics: true, enable_minutely_probes: true, + enable_statsd: false, endpoint: "https://push.appsignal.com", diagnose_endpoint: "https://appsignal.com/diag", env: :dev, @@ -196,6 +197,7 @@ defmodule Appsignal.Config do "APPSIGNAL_WORKING_DIRECTORY_PATH" => :working_directory_path, "APPSIGNAL_ENABLE_HOST_METRICS" => :enable_host_metrics, "APPSIGNAL_ENABLE_MINUTELY_PROBES" => :enable_minutely_probes, + "APPSIGNAL_ENABLE_STATSD" => :enable_statsd, "APPSIGNAL_SKIP_SESSION_DATA" => :skip_session_data, "APPSIGNAL_TRANSACTION_DEBUG_MODE" => :transaction_debug_mode, "APPSIGNAL_FILES_WORLD_ACCESSIBLE" => :files_world_accessible, @@ -213,6 +215,7 @@ defmodule Appsignal.Config do APPSIGNAL_ENABLE_ALLOCATION_TRACKING APPSIGNAL_ENABLE_GC_INSTRUMENTATION APPSIGNAL_RUNNING_IN_CONTAINER APPSIGNAL_ENABLE_HOST_METRICS APPSIGNAL_SKIP_SESSION_DATA APPSIGNAL_TRANSACTION_DEBUG_MODE APPSIGNAL_FILES_WORLD_ACCESSIBLE APPSIGNAL_SEND_PARAMS APPSIGNAL_ENABLE_MINUTELY_PROBES + APPSIGNAL_ENABLE_STATSD ) @atom_keys ~w(APPSIGNAL_APP_ENV APPSIGNAL_OTP_APP) @string_list_keys ~w( diff --git a/test/appsignal/config_test.exs b/test/appsignal/config_test.exs index e439805ec..6fdce57eb 100644 --- a/test/appsignal/config_test.exs +++ b/test/appsignal/config_test.exs @@ -194,6 +194,10 @@ defmodule Appsignal.ConfigTest do with_config(%{enable_minutely_probes: false}, &init_config/0) end + test "enable_statsd" do + assert %{enable_statsd: true} = with_config(%{enable_statsd: true}, &init_config/0) + end + test "endpoint" do assert %{endpoint: "https://push.staging.lol"} = with_config(%{endpoint: "https://push.staging.lol"}, &init_config/0) @@ -429,6 +433,13 @@ defmodule Appsignal.ConfigTest do ) == default_configuration() |> Map.put(:enable_minutely_probes, false) end + test "enable_statsd" do + assert with_env( + %{"APPSIGNAL_ENABLE_STATSD" => "true"}, + &init_config/0 + ) == default_configuration() |> Map.put(:enable_statsd, true) + end + test "endpoint" do assert with_env( %{"APPSIGNAL_PUSH_API_ENDPOINT" => "https://push.staging.lol"}, @@ -949,6 +960,7 @@ defmodule Appsignal.ConfigTest do dns_servers: [], enable_host_metrics: true, enable_minutely_probes: true, + enable_statsd: false, endpoint: "https://push.appsignal.com", diagnose_endpoint: "https://appsignal.com/diag", env: :dev, diff --git a/test/integration/diagnose b/test/integration/diagnose index 54088e661..43cb73e18 160000 --- a/test/integration/diagnose +++ b/test/integration/diagnose @@ -1 +1 @@ -Subproject commit 54088e661e0660d1ecbc0f928fcf8e3b185e6841 +Subproject commit 43cb73e181c630eeca0ccecdbc1dac60093c1702