-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
124b992
commit 2850372
Showing
11 changed files
with
86 additions
and
198 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Empty file.
Empty file.
Empty file.
Empty file.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
defmodule Req.Telemetry do | ||
@moduledoc """ | ||
""" | ||
|
||
use Supervisor | ||
|
||
alias Telemetry.Metrics | ||
|
||
def start_link(arg) do | ||
Supervisor.start_link(__MODULE__, arg, name: __MODULE__) | ||
end | ||
|
||
def init(_arg) do | ||
telemetry_metrics_splunk_config = Application.get_env(:dotcom, :telemetry_metrics_splunk) | ||
|
||
children = [ | ||
{ | ||
TelemetryMetricsSplunk, | ||
[ | ||
metrics: metrics(), | ||
token: telemetry_metrics_splunk_config[:token], | ||
url: telemetry_metrics_splunk_config[:url] | ||
] | ||
}, | ||
{ | ||
:telemetry_poller, | ||
measurements: measurements(), period: :timer.seconds(60), init_delay: :timer.seconds(5) | ||
}, | ||
{Req.Stats, %{}} | ||
] | ||
|
||
Supervisor.init(children, strategy: :one_for_one) | ||
end | ||
|
||
defp measurements do | ||
[ | ||
{Req.Stats, :dispatch_stats, []} | ||
] | ||
end | ||
|
||
defp metrics do | ||
[ | ||
Metrics.last_value("req.request.count"), | ||
Metrics.last_value("req.request.avg") | ||
] | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters