Skip to content

Commit

Permalink
Make StatsD configurable
Browse files Browse the repository at this point in the history
Agent StatsD server is now configurable using the new `enable_statsd`
config option. It's disabled by default.
  • Loading branch information
luismiramirez committed Oct 27, 2021
1 parent de1c852 commit 9d3e253
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changesets/add-new-config-option-to-enable-disable-statsd.md
Original file line number Diff line number Diff line change
@@ -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.
3 changes: 3 additions & 0 deletions lib/appsignal/config.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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(
Expand Down
12 changes: 12 additions & 0 deletions test/appsignal/config_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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"},
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion test/integration/diagnose

0 comments on commit 9d3e253

Please sign in to comment.