Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 42 additions & 37 deletions .github/workflows/elixir.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,40 +11,45 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Setup elixir
uses: actions/setup-elixir@v1
with:
elixir-version: 1.9.4 # Define the elixir version [required]
otp-version: 22.2 # Define the OTP version [required]
- name: Check formatting
run: mix format --check-formatted

- name: Cache Dependencies
id: mix-cache
uses: actions/cache@v2
with:
path: deps
key: ${{ runner.os }}-mix-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
- name: Install Dependencies
if: steps.mix-cache.outputs.cache-hit != 'true'
run: mix deps.get

- name: Cache Build
id: build-cache
uses: actions/cache@v2
with:
path: |
_build
!_build/*/lib/signal_tower
key: ${{ runner.os }}-mix-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
- name: Compile Dependencies
run: mix deps.compile
- name: Compile and check for warnings
run: mix compile --warnings-as-errors

- name: Run Tests
run: mix test

- name: Run dialyzer static code analysis
run: mix dialyzer
- uses: actions/checkout@v4

- name: Setup Elixir
uses: actions/setup-elixir@v1
with:
elixir-version: 1.9.4
otp-version: 22.2

- name: Check formatting
run: mix format --check-formatted

- name: Cache Dependencies
id: mix-cache
uses: actions/cache@v4
with:
path: deps
key: ${{ runner.os }}-mix-${{ hashFiles('mix.lock') }}

- name: Install Dependencies
if: steps.mix-cache.outputs.cache-hit != 'true'
run: mix deps.get

- name: Cache Build
id: build-cache
uses: actions/cache@v4
with:
path: |
_build
!_build/*/lib/signal_tower
key: ${{ runner.os }}-mix-${{ hashFiles('mix.lock') }}

- name: Compile Dependencies
run: mix deps.compile

- name: Compile and check for warnings
run: mix compile --warnings-as-errors

- name: Run Tests
run: mix test

- name: Run dialyzer static code analysis
run: mix dialyzer
2 changes: 1 addition & 1 deletion config/config.exs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use Mix.Config
import Config

if Mix.env() == :dev do
config :mix_test_watch,
Expand Down
2 changes: 2 additions & 0 deletions lib/signal_tower/prometheus_http_handler.ex
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ defmodule SignalTower.PrometheusHTTPHandler do
headers = :cowboy_req.headers(req)
body = SignalTower.PrometheusStats.to_string()

IO.inspect(:cowboy_req.header("Authorization", req))

reply = :cowboy_req.reply(200, headers, body, req)
{:ok, reply, :no_state}
end
Expand Down
8 changes: 4 additions & 4 deletions lib/signal_tower/websocket_handler.ex
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ defmodule SignalTower.WebsocketHandler do

@impl :cowboy_websocket
def websocket_handle(msg, state) do
Logger.warn("Unknown handle message: #{inspect(msg)}")
Logger.warning("Unknown handle message: #{inspect(msg)}")
{:ok, state}
end

Expand All @@ -81,7 +81,7 @@ defmodule SignalTower.WebsocketHandler do

@impl :cowboy_websocket
def websocket_info(msg, state) do
Logger.warn("Unknown info message: #{inspect(msg)}")
Logger.warning("Unknown info message: #{inspect(msg)}")
{:ok, state}
end

Expand All @@ -103,10 +103,10 @@ defmodule SignalTower.WebsocketHandler do
def terminate(reason, req, _room) do
case reason do
{:error, error} ->
Logger.warn("websocket error: #{error}, request: #{inspect(req)}")
Logger.warning("websocket error: #{error}, request: #{inspect(req)}")

{:crash, class, error} ->
Logger.warn(
Logger.warning(
"websocket crash. class: #{class}, reason: #{error}, request: #{inspect(req)}"
)

Expand Down
10 changes: 5 additions & 5 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ defmodule SignalTower.MixProject do
# Run "mix help deps" to learn about dependencies.
defp deps do
[
{:cowboy, "~> 2.6.0"},
{:poison, "~> 4.0.1"},
{:prometheus_ex, "~> 3.0"},
{:cowboy, "~> 2.13"},
{:poison, "~> 6.0"},
{:prometheus_ex, "~> 4.0"},
{:elixir_uuid, "~> 1.2"},
{:dialyxir, "~> 1.0", only: [:dev], runtime: false},
{:mix_test_watch, "~> 1.0", only: :dev, runtime: false}
{:dialyxir, "~> 1.4", only: [:dev], runtime: false},
{:mix_test_watch, "~> 1.3", only: :dev, runtime: false}
]
end

Expand Down
21 changes: 11 additions & 10 deletions mix.lock
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
%{
"cowboy": {:hex, :cowboy, "2.6.3", "99aa50e94e685557cad82e704457336a453d4abcb77839ad22dbe71f311fcc06", [:rebar3], [{:cowlib, "~> 2.7.3", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "~> 1.7.1", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "e5580029080f3f1ad17436fb97b0d5ed2ed4e4815a96bac36b5a992e20f58db6"},
"cowlib": {:hex, :cowlib, "2.7.3", "a7ffcd0917e6d50b4d5fb28e9e2085a0ceb3c97dea310505f7460ff5ed764ce9", [:rebar3], [], "hexpm", "1e1a3d176d52daebbecbbcdfd27c27726076567905c2a9d7398c54da9d225761"},
"dialyxir": {:hex, :dialyxir, "1.0.0", "6a1fa629f7881a9f5aaf3a78f094b2a51a0357c843871b8bc98824e7342d00a5", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "aeb06588145fac14ca08d8061a142d52753dbc2cf7f0d00fc1013f53f8654654"},
"cowboy": {:hex, :cowboy, "2.14.2", "4008be1df6ade45e4f2a4e9e2d22b36d0b5aba4e20b0a0d7049e28d124e34847", [:make, :rebar3], [{:cowlib, ">= 2.16.0 and < 3.0.0", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, ">= 1.8.0 and < 3.0.0", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "569081da046e7b41b5df36aa359be71a0c8874e5b9cff6f747073fc57baf1ab9"},
"cowlib": {:hex, :cowlib, "2.16.0", "54592074ebbbb92ee4746c8a8846e5605052f29309d3a873468d76cdf932076f", [:make, :rebar3], [], "hexpm", "7f478d80d66b747344f0ea7708c187645cfcc08b11aa424632f78e25bf05db51"},
"dialyxir": {:hex, :dialyxir, "1.4.7", "dda948fcee52962e4b6c5b4b16b2d8fa7d50d8645bbae8b8685c3f9ecb7f5f4d", [:mix], [{:erlex, ">= 0.2.8", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "b34527202e6eb8cee198efec110996c25c5898f43a4094df157f8d28f27d9efe"},
"elixir_uuid": {:hex, :elixir_uuid, "1.2.1", "dce506597acb7e6b0daeaff52ff6a9043f5919a4c3315abb4143f0b00378c097", [:mix], [], "hexpm", "f7eba2ea6c3555cea09706492716b0d87397b88946e6380898c2889d68585752"},
"erlex": {:hex, :erlex, "0.2.6", "c7987d15e899c7a2f34f5420d2a2ea0d659682c06ac607572df55a43753aa12e", [:mix], [], "hexpm", "2ed2e25711feb44d52b17d2780eabf998452f6efda104877a3881c2f8c0c0c75"},
"file_system": {:hex, :file_system, "0.2.10", "fb082005a9cd1711c05b5248710f8826b02d7d1784e7c3451f9c1231d4fc162d", [:mix], [], "hexpm", "41195edbfb562a593726eda3b3e8b103a309b733ad25f3d642ba49696bf715dc"},
"mix_test_watch": {:hex, :mix_test_watch, "1.0.2", "34900184cbbbc6b6ed616ed3a8ea9b791f9fd2088419352a6d3200525637f785", [:mix], [{:file_system, "~> 0.2.1 or ~> 0.3", [hex: :file_system, repo: "hexpm", optional: false]}], "hexpm", "47ac558d8b06f684773972c6d04fcc15590abdb97aeb7666da19fcbfdc441a07"},
"erlex": {:hex, :erlex, "0.2.8", "cd8116f20f3c0afe376d1e8d1f0ae2452337729f68be016ea544a72f767d9c12", [:mix], [], "hexpm", "9d66ff9fedf69e49dc3fd12831e12a8a37b76f8651dd21cd45fcf5561a8a7590"},
"file_system": {:hex, :file_system, "1.1.1", "31864f4685b0148f25bd3fbef2b1228457c0c89024ad67f7a81a3ffbc0bbad3a", [:mix], [], "hexpm", "7a15ff97dfe526aeefb090a7a9d3d03aa907e100e262a0f8f7746b78f8f87a5d"},
"mix_test_watch": {:hex, :mix_test_watch, "1.4.0", "d88bcc4fbe3198871266e9d2f00cd8ae350938efbb11d3fa1da091586345adbb", [:mix], [{:file_system, "~> 0.2 or ~> 1.0", [hex: :file_system, repo: "hexpm", optional: false]}], "hexpm", "2b4693e17c8ead2ef56d4f48a0329891e8c2d0d73752c0f09272a2b17dc38d1b"},
"parallel_stream": {:hex, :parallel_stream, "1.0.6", "b967be2b23f0f6787fab7ed681b4c45a215a81481fb62b01a5b750fa8f30f76c", [:mix], [], "hexpm"},
"poison": {:hex, :poison, "4.0.1", "bcb755a16fac91cad79bfe9fc3585bb07b9331e50cfe3420a24bcc2d735709ae", [:mix], [], "hexpm", "ba8836feea4b394bb718a161fc59a288fe0109b5006d6bdf97b6badfcf6f0f25"},
"prometheus": {:hex, :prometheus, "4.6.0", "20510f381db1ccab818b4cf2fac5fa6ab5cc91bc364a154399901c001465f46f", [:mix, :rebar3], [], "hexpm", "4905fd2992f8038eccd7aa0cd22f40637ed618c0bed1f75c05aacec15b7545de"},
"prometheus_ex": {:hex, :prometheus_ex, "3.0.5", "fa58cfd983487fc5ead331e9a3e0aa622c67232b3ec71710ced122c4c453a02f", [:mix], [{:prometheus, "~> 4.0", [hex: :prometheus, repo: "hexpm", optional: false]}], "hexpm", "9fd13404a48437e044b288b41f76e64acd9735fb8b0e3809f494811dfa66d0fb"},
"ranch": {:hex, :ranch, "1.7.1", "6b1fab51b49196860b733a49c07604465a47bdb78aa10c1c16a3d199f7f8c881", [:rebar3], [], "hexpm", "451d8527787df716d99dc36162fca05934915db0b6141bbdac2ea8d3c7afc7d7"},
"poison": {:hex, :poison, "6.0.0", "9bbe86722355e36ffb62c51a552719534257ba53f3271dacd20fbbd6621a583a", [:mix], [{:decimal, "~> 2.1", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "bb9064632b94775a3964642d6a78281c07b7be1319e0016e1643790704e739a2"},
"prometheus": {:hex, :prometheus, "5.1.1", "c84d8d3dd703b54b450fa1eda1552ae70f9b72db3c093a947e416257486925a7", [:rebar3], [{:quantile_estimator, "1.0.2", [hex: :quantile_estimator, repo: "hexpm", optional: false]}], "hexpm", "82f8f8613e8cbc3b4dd1d7724f9807b3175b37dcd4c6cb903bb27c6a07591ff0"},
"prometheus_ex": {:hex, :prometheus_ex, "4.0.0", "6df813df5d13cc2898e1d8c1303cec59f0d9b7caaa33799a6335833eaa25dad7", [:mix], [{:prometheus, "~> 5.0", [hex: :prometheus, repo: "hexpm", optional: false]}], "hexpm", "dcedb31bfe3913b1f92fc46e4060bd708ab7edefa6f2a741d2fd108dc3da42ef"},
"quantile_estimator": {:hex, :quantile_estimator, "1.0.2", "ecd281d40110fdd9ba62685531e4435e0839a52fd1058da5564f1763e4642ef7", [:rebar3], [], "hexpm", "db404793d6384995a1ac6dd973e2cee5be9fcc128765bdba53d87c564e296b64"},
"ranch": {:hex, :ranch, "2.2.0", "25528f82bc8d7c6152c57666ca99ec716510fe0925cb188172f41ce93117b1b0", [:make, :rebar3], [], "hexpm", "fa0b99a1780c80218a4197a59ea8d3bdae32fbff7e88527d7d8a4787eff4f8e7"},
}
Loading