From 2de5c1f8a7c39022745f0ac9fced4a25a45c5459 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Niemier?= Date: Fri, 6 Oct 2023 11:03:42 +0200 Subject: [PATCH 1/3] chore: update Rustler to version 0.29.x --- lib/logflare/application.ex | 2 +- .../logs/lql/bigquery/lql_ecto_helpers.ex | 4 ++- .../live/endpoints/actions/index.html.heex | 5 ++- mix.exs | 2 +- mix.lock | 2 +- native/sqlparser_ex/Cargo.lock | 35 ++++++++++++------- native/sqlparser_ex/Cargo.toml | 2 +- test/logflare/sql_test.exs | 5 ++- test/support/test_utils.ex | 2 +- 9 files changed, 39 insertions(+), 20 deletions(-) diff --git a/lib/logflare/application.ex b/lib/logflare/application.ex index 8b33d4add..051288645 100644 --- a/lib/logflare/application.ex +++ b/lib/logflare/application.ex @@ -76,7 +76,7 @@ defmodule Logflare.Application do defp get_children(_) do # Database options for Postgres notifications - hostname = '#{Application.get_env(:logflare, Logflare.Repo)[:hostname]}' + hostname = ~c"#{Application.get_env(:logflare, Logflare.Repo)[:hostname]}" username = Application.get_env(:logflare, Logflare.Repo)[:username] password = Application.get_env(:logflare, Logflare.Repo)[:password] database = Application.get_env(:logflare, Logflare.Repo)[:database] diff --git a/lib/logflare/logs/lql/bigquery/lql_ecto_helpers.ex b/lib/logflare/logs/lql/bigquery/lql_ecto_helpers.ex index 8ae61514b..daea75e2c 100644 --- a/lib/logflare/logs/lql/bigquery/lql_ecto_helpers.ex +++ b/lib/logflare/logs/lql/bigquery/lql_ecto_helpers.ex @@ -54,7 +54,9 @@ defmodule Logflare.Lql.EctoHelpers do if level === 1 do join(q, join_type, [top], n in fragment("UNNEST(?)", field(top, ^column)), on: true) else - join(q, join_type, [..., n1], n in fragment("UNNEST(?)", field(n1, ^column)), on: true) + join(q, join_type, [..., n1], n in fragment("UNNEST(?)", field(n1, ^column)), + on: true + ) end end) end diff --git a/lib/logflare_web/live/endpoints/actions/index.html.heex b/lib/logflare_web/live/endpoints/actions/index.html.heex index 5921750f5..447bec1f0 100644 --- a/lib/logflare_web/live/endpoints/actions/index.html.heex +++ b/lib/logflare_web/live/endpoints/actions/index.html.heex @@ -15,7 +15,10 @@

- <%= link("Documentation", to: "https://docs.logflare.app/concepts/endpoints", target: "_blank") %> + <%= link("Documentation", + to: "https://docs.logflare.app/concepts/endpoints", + target: "_blank" + ) %> <%= live_patch to: ~p"/endpoints/new" do %> <.button variant="primary"> New endpoint diff --git a/mix.exs b/mix.exs index 48a7f1a28..779418bef 100644 --- a/mix.exs +++ b/mix.exs @@ -163,7 +163,7 @@ defmodule Logflare.Mixfile do {:floki, "~> 0.29.0"}, # Rust NIFs - {:rustler, "~> 0.25.0"}, + {:rustler, "~> 0.29.0"}, # Frontend {:phoenix_live_react, "~> 0.4"}, diff --git a/mix.lock b/mix.lock index d2da80ccc..392eb93ed 100644 --- a/mix.lock +++ b/mix.lock @@ -110,7 +110,7 @@ "ranch": {:hex, :ranch, "1.8.0", "8c7a100a139fd57f17327b6413e4167ac559fbc04ca7448e9be9057311597a1d", [:make, :rebar3], [], "hexpm", "49fbcfd3682fab1f5d109351b61257676da1a2fdbe295904176d5e521a2ddfe5"}, "recase": {:hex, :recase, "0.7.0", "3f2f719f0886c7a3b7fe469058ec539cb7bbe0023604ae3bce920e186305e5ae", [:mix], [], "hexpm", "36f5756a9f552f4a94b54a695870e32f4e72d5fad9c25e61bc4a3151c08a4e0c"}, "recon": {:hex, :recon, "2.5.3", "739107b9050ea683c30e96de050bc59248fd27ec147696f79a8797ff9fa17153", [:mix, :rebar3], [], "hexpm", "6c6683f46fd4a1dfd98404b9f78dcabc7fcd8826613a89dcb984727a8c3099d7"}, - "rustler": {:hex, :rustler, "0.25.0", "32526b51af7e58a740f61941bf923486ce6415a91c3934cc16c281aa201a2240", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}, {:toml, "~> 0.6", [hex: :toml, repo: "hexpm", optional: false]}], "hexpm", "6b43a11a37fe79c6234d88c4102ab5dfede7a6a764dc5c7b539956cfa02f3cf4"}, + "rustler": {:hex, :rustler, "0.29.1", "880f20ae3027bd7945def6cea767f5257bc926f33ff50c0d5d5a5315883c084d", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}, {:toml, "~> 0.6", [hex: :toml, repo: "hexpm", optional: false]}], "hexpm", "109497d701861bfcd26eb8f5801fe327a8eef304f56a5b63ef61151ff44ac9b6"}, "scrivener": {:hex, :scrivener, "2.7.2", "1d913c965ec352650a7f864ad7fd8d80462f76a32f33d57d1e48bc5e9d40aba2", [:mix], [], "hexpm", "7866a0ec4d40274efbee1db8bead13a995ea4926ecd8203345af8f90d2b620d9"}, "scrivener_ecto": {:hex, :scrivener_ecto, "2.7.0", "cf64b8cb8a96cd131cdbcecf64e7fd395e21aaa1cb0236c42a7c2e34b0dca580", [:mix], [{:ecto, "~> 3.3", [hex: :ecto, repo: "hexpm", optional: false]}, {:scrivener, "~> 2.4", [hex: :scrivener, repo: "hexpm", optional: false]}], "hexpm", "e809f171687806b0031129034352f5ae44849720c48dd839200adeaf0ac3e260"}, "scrivener_html": {:git, "https://github.com/Logflare/scrivener_html.git", "e81b4845c2542f59f768aba07950459240ddddcc", []}, diff --git a/native/sqlparser_ex/Cargo.lock b/native/sqlparser_ex/Cargo.lock index c653dc7b2..114ef5439 100644 --- a/native/sqlparser_ex/Cargo.lock +++ b/native/sqlparser_ex/Cargo.lock @@ -52,18 +52,18 @@ checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] name = "proc-macro2" -version = "1.0.50" +version = "1.0.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ef7d57beacfaf2d8aee5937dab7b7f28de3cb8b1828479bb5de2a7106f2bae2" +checksum = "3d433d9f1a3e8c1263d9456598b16fec66f4acc9a74dacffd35c7bb09b3a1328" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.23" +version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" dependencies = [ "proc-macro2", ] @@ -87,9 +87,9 @@ checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" [[package]] name = "rustler" -version = "0.25.0" +version = "0.29.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3e6617fa86bacfb2de792c12e261e0f456bb9ff15038498ae421715bf4128c5" +checksum = "0884cb623b9f43d3e2c51f9071c5e96a5acf3e6e6007866812884ff0cb983f1e" dependencies = [ "lazy_static", "rustler_codegen", @@ -98,21 +98,21 @@ dependencies = [ [[package]] name = "rustler_codegen" -version = "0.25.0" +version = "0.29.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05cda738bc4260019ee078a699fac55ce3577fe2db736b2cc64a4d6696950fa6" +checksum = "50e277af754f2560cf4c4ebedb68c1a735292fb354505c6133e47ec406e699cf" dependencies = [ "heck", "proc-macro2", "quote", - "syn", + "syn 2.0.37", ] [[package]] name = "rustler_sys" -version = "2.2.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ff26a42e62d538f82913dd34f60105ecfdffbdb25abdc3c3580b0c622285332" +checksum = "0a7c0740e5322b64e2b952d8f0edce5f90fcf6f6fe74cca3f6e78eb3de5ea858" dependencies = [ "regex", "unreachable", @@ -141,7 +141,7 @@ checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.107", ] [[package]] @@ -185,6 +185,17 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "syn" +version = "2.0.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7303ef2c05cd654186cb250d29049a24840ca25d2747c25c0381c8d9e2f582e8" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + [[package]] name = "unicode-ident" version = "1.0.6" diff --git a/native/sqlparser_ex/Cargo.toml b/native/sqlparser_ex/Cargo.toml index 73a7b8a71..e2ffa5b71 100644 --- a/native/sqlparser_ex/Cargo.toml +++ b/native/sqlparser_ex/Cargo.toml @@ -11,7 +11,7 @@ path = "src/lib.rs" crate-type = ["cdylib"] [dependencies] -rustler = "0.25.0" +rustler = "0.29.0" sqlparser = {git = "https://github.com/Logflare/sqlparser-rs", branch = "main", features = ["serde"]} # sqlparser = {version = "0.27.0", features = ["serde"]} serde = { version = "1", features = ["derive"] } diff --git a/test/logflare/sql_test.exs b/test/logflare/sql_test.exs index 73c4bea44..df3006432 100644 --- a/test/logflare/sql_test.exs +++ b/test/logflare/sql_test.exs @@ -226,7 +226,10 @@ defmodule Logflare.SqlTest do describe "Bigquery fully qualified" do test "able to use fully qualified names in queries" do user = - insert(:user, bigquery_project_id: @user_project_id, bigquery_dataset_id: @user_dataset_id) + insert(:user, + bigquery_project_id: @user_project_id, + bigquery_dataset_id: @user_dataset_id + ) source_abc = insert(:source, user: user, name: "a.b.c") source_cxy = insert(:source, user: user, name: "c.x.y") diff --git a/test/support/test_utils.ex b/test/support/test_utils.ex index 82f1d68fb..f0cc96e6d 100644 --- a/test/support/test_utils.ex +++ b/test/support/test_utils.ex @@ -415,7 +415,7 @@ defmodule Logflare.TestUtils do Fetches data until the asserts is able to run its asserts a certain amount of times (default 10 times). """ @spec retry_fetch( - (() -> :retry | any()), + (-> :retry | any()), (any() -> :retry | any()), pos_integer(), pos_integer() From a7ff98fe72273e02389e57af5e131570c0c84849 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Niemier?= Date: Fri, 6 Oct 2023 11:04:18 +0200 Subject: [PATCH 2/3] chore: replace calls to Logger.warn with Logger.warning --- lib/logflare/admin.ex | 2 +- lib/logflare/context_cache.ex | 6 +++--- lib/logflare/endpoints/cache.ex | 2 +- lib/logflare/google/bigquery/bigquery.ex | 5 ++++- .../google/bigquery/schema_utils/schema_utils.ex | 2 +- lib/logflare/logs/log_event.ex | 2 +- lib/logflare/logs/netlify.ex | 2 +- .../logs/search/logs_search_query_executor.ex | 2 +- .../logs/validators/eq_deep_field_types_validator.ex | 2 +- lib/logflare/source/bigquery/pipeline.ex | 12 ++++++------ lib/logflare/source/bigquery/schema.ex | 8 ++++---- lib/logflare/source/slack_hook_server/client.ex | 10 +++++----- .../source/webhook_notification_server/client.ex | 4 ++-- .../webhook_notification_server/discord_client.ex | 4 ++-- .../system_metrics/all_logs_logged/poller.ex | 2 +- lib/logflare_web/controllers/admin_controller.ex | 4 ++-- .../controllers/auth/oauth_controller.ex | 6 +++--- lib/logflare_web/controllers/stripe_controller.ex | 2 +- lib/logflare_web/live/admin/cluster_live.ex | 2 +- .../search_log_event_viewer_component.ex | 2 +- lib/sig_term_handler.ex | 10 +++++----- 21 files changed, 47 insertions(+), 44 deletions(-) diff --git a/lib/logflare/admin.ex b/lib/logflare/admin.ex index 30e7a92f6..bddf66bbc 100644 --- a/lib/logflare/admin.ex +++ b/lib/logflare/admin.ex @@ -11,7 +11,7 @@ defmodule Logflare.Admin do def shutdown(node \\ Node.self(), delay \\ 5000) when is_atom(node) do task = Task.async(fn -> - Logger.warn("Node shutdown initialized, shutting down in #{delay}ms. node=#{node}") + Logger.warning("Node shutdown initialized, shutting down in #{delay}ms. node=#{node}") Process.sleep(delay) :rpc.eval_everywhere([node], System, :stop, []) diff --git a/lib/logflare/context_cache.ex b/lib/logflare/context_cache.ex index 6c7f573fc..5c4954f29 100644 --- a/lib/logflare/context_cache.ex +++ b/lib/logflare/context_cache.ex @@ -85,15 +85,15 @@ defmodule Logflare.ContextCache do value.id true -> - # Logger.warn("Cached unknown value from context.", error_string: inspect(value)) + # Logger.warning("Cached unknown value from context.", error_string: inspect(value)) "true" nil -> - # Logger.warn("Cached unknown value from context.", error_string: inspect(value)) + # Logger.warning("Cached unknown value from context.", error_string: inspect(value)) :not_found _value -> - # Logger.warn("Unhandled cache key for value.", error_string: inspect(value)) + # Logger.warning("Unhandled cache key for value.", error_string: inspect(value)) :uknown end end diff --git a/lib/logflare/endpoints/cache.ex b/lib/logflare/endpoints/cache.ex index 22db48b2d..fcbbfd5bb 100644 --- a/lib/logflare/endpoints/cache.ex +++ b/lib/logflare/endpoints/cache.ex @@ -39,7 +39,7 @@ defmodule Logflare.Endpoints.Cache do GenServer.call(cache, :query, 30_000) catch :exit, {:timeout, _call} -> - Logger.warn("Endpoint query timeout") + Logger.warning("Endpoint query timeout") message = """ Backend query timeout! Optimizing your query will help. Some tips: diff --git a/lib/logflare/google/bigquery/bigquery.ex b/lib/logflare/google/bigquery/bigquery.ex index ce82519b2..961e3c281 100644 --- a/lib/logflare/google/bigquery/bigquery.ex +++ b/lib/logflare/google/bigquery/bigquery.ex @@ -341,7 +341,10 @@ defmodule Logflare.Google.BigQuery do {:error, :not_patched} {:error, response} -> - Logger.warn("Dataset labels NOT patched: #{dataset_id}", error_string: inspect(response)) + Logger.warning("Dataset labels NOT patched: #{dataset_id}", + error_string: inspect(response) + ) + {:error, :not_patched} end end diff --git a/lib/logflare/google/bigquery/schema_utils/schema_utils.ex b/lib/logflare/google/bigquery/schema_utils/schema_utils.ex index 1ab30d566..649eb8df0 100644 --- a/lib/logflare/google/bigquery/schema_utils/schema_utils.ex +++ b/lib/logflare/google/bigquery/schema_utils/schema_utils.ex @@ -169,7 +169,7 @@ defmodule Logflare.Google.BigQuery.SchemaUtils do %{t: bq_type_to_ex(t)} true -> - Logger.warn("Unexpected value of TFS mode: #{mode}") + Logger.warning("Unexpected value of TFS mode: #{mode}") %{t: bq_type_to_ex(t)} end diff --git a/lib/logflare/logs/log_event.ex b/lib/logflare/logs/log_event.ex index 06c68d94a..3989a8839 100644 --- a/lib/logflare/logs/log_event.ex +++ b/lib/logflare/logs/log_event.ex @@ -106,7 +106,7 @@ defmodule Logflare.LogEvent do DateTime.to_unix(udt, :microsecond) {:error, _} -> - # Logger.warn( + # Logger.warning( # "Malformed timesetamp. Using DateTime.utc_now/0. Expected iso8601. Got: #{inspect(x)}" # ) diff --git a/lib/logflare/logs/netlify.ex b/lib/logflare/logs/netlify.ex index 1a290ec7d..374b4711a 100644 --- a/lib/logflare/logs/netlify.ex +++ b/lib/logflare/logs/netlify.ex @@ -86,7 +86,7 @@ defmodule Logflare.Logs.Netlify do defp custom_message(event) do case Jason.encode(event) do {:ok, json} -> - Logger.warn("Unhandled Netlify log event!", error_string: inspect(event)) + Logger.warning("Unhandled Netlify log event!", error_string: inspect(event)) json {:error, reason} -> diff --git a/lib/logflare/logs/search/logs_search_query_executor.ex b/lib/logflare/logs/search/logs_search_query_executor.ex index f554603b9..8fbb35356 100644 --- a/lib/logflare/logs/search/logs_search_query_executor.ex +++ b/lib/logflare/logs/search/logs_search_query_executor.ex @@ -355,7 +355,7 @@ defmodule Logflare.Logs.SearchQueryExecutor do :ok {:error, _result} -> - Logger.warn("Streaming buffer not found for source #{source.token}") + Logger.warning("Streaming buffer not found for source #{source.token}") end end) end diff --git a/lib/logflare/logs/validators/eq_deep_field_types_validator.ex b/lib/logflare/logs/validators/eq_deep_field_types_validator.ex index 6368f85fa..d7ffe070f 100644 --- a/lib/logflare/logs/validators/eq_deep_field_types_validator.ex +++ b/lib/logflare/logs/validators/eq_deep_field_types_validator.ex @@ -15,7 +15,7 @@ defmodule Logflare.Logs.Validators.EqDeepFieldTypes do end rescue e -> - Logger.warn("Unexpected error at #{__MODULE__}: #{Exception.message(e)}") + Logger.warning("Unexpected error at #{__MODULE__}: #{Exception.message(e)}") {:error, "Log event payload validation error"} catch :type_error -> diff --git a/lib/logflare/source/bigquery/pipeline.ex b/lib/logflare/source/bigquery/pipeline.ex index c9d26a1ac..9cfadc448 100644 --- a/lib/logflare/source/bigquery/pipeline.ex +++ b/lib/logflare/source/bigquery/pipeline.ex @@ -91,7 +91,7 @@ defmodule Logflare.Source.BigQuery.Pipeline do messages {:ok, %GoogleApi.BigQuery.V2.Model.TableDataInsertAllResponse{insertErrors: errors}} -> - Logger.warn("BigQuery insert errors.", error_string: inspect(errors)) + Logger.warning("BigQuery insert errors.", error_string: inspect(errors)) messages @@ -114,7 +114,7 @@ defmodule Logflare.Source.BigQuery.Pipeline do # messages _message -> - Logger.warn("Stream batch response error!", + Logger.warning("Stream batch response error!", tesla_response: GenUtils.get_tesla_error_message(response) ) @@ -126,15 +126,15 @@ defmodule Logflare.Source.BigQuery.Pipeline do messages {:error, :timeout = response} -> - Logger.warn("Stream batch timeout error!", tesla_response: response) + Logger.warning("Stream batch timeout error!", tesla_response: response) messages {:error, :checkout_timeout = response} -> - Logger.warn("Stream batch checkout_timeout error!", tesla_response: response) + Logger.warning("Stream batch checkout_timeout error!", tesla_response: response) messages {:error, response} -> - Logger.warn("Stream batch unknown error!", tesla_response: inspect(response)) + Logger.warning("Stream batch unknown error!", tesla_response: inspect(response)) messages end end @@ -176,7 +176,7 @@ defmodule Logflare.Source.BigQuery.Pipeline do |> AccountEmail.backend_disconnected(message) |> Mailer.deliver() - Logger.warn("Backend disconnected for: #{user.email}", tesla_response: message) + Logger.warning("Backend disconnected for: #{user.email}", tesla_response: message) {:error, changeset} -> Logger.error("Failed to reset backend for user: #{user.email}", diff --git a/lib/logflare/source/bigquery/schema.ex b/lib/logflare/source/bigquery/schema.ex index d8362413f..d2029599c 100644 --- a/lib/logflare/source/bigquery/schema.ex +++ b/lib/logflare/source/bigquery/schema.ex @@ -191,7 +191,7 @@ defmodule Logflare.Source.BigQuery.Schema do }} {:error, response} -> - Logger.warn("Source schema update error!", + Logger.warning("Source schema update error!", tesla_response: BigQuery.GenUtils.get_tesla_error_message(response) ) @@ -199,7 +199,7 @@ defmodule Logflare.Source.BigQuery.Schema do end {:error, response} -> - Logger.warn("Source schema update error!", + Logger.warning("Source schema update error!", tesla_response: BigQuery.GenUtils.get_tesla_error_message(response) ) @@ -207,7 +207,7 @@ defmodule Logflare.Source.BigQuery.Schema do end message -> - Logger.warn("Source schema update error!", + Logger.warning("Source schema update error!", tesla_response: message ) @@ -307,7 +307,7 @@ defmodule Logflare.Source.BigQuery.Schema do pipeline_process_data_stacktrace: LogflareLogger.Stacktrace.format(__STACKTRACE__) }) - Logger.warn("Field schema type change error!", error_string: inspect(e)) + Logger.warning("Field schema type change error!", error_string: inspect(e)) schema end diff --git a/lib/logflare/source/slack_hook_server/client.ex b/lib/logflare/source/slack_hook_server/client.ex index 07b809269..44b475759 100644 --- a/lib/logflare/source/slack_hook_server/client.ex +++ b/lib/logflare/source/slack_hook_server/client.ex @@ -39,7 +39,7 @@ defmodule Logflare.Source.SlackHookServer.Client do {:ok, %Tesla.Env{body: "invalid_blocks"} = response} -> resp = prep_tesla_resp_for_log(response) - Logger.warn("Slack hook response: invalid_blocks", + Logger.warning("Slack hook response: invalid_blocks", slackhook_response: resp, slackhook_request: %{url: url, body: inspect(body)} ) @@ -49,11 +49,11 @@ defmodule Logflare.Source.SlackHookServer.Client do {:ok, %Tesla.Env{body: "no_service"} = response} -> resp = prep_tesla_resp_for_log(response) - Logger.warn("Slack hook response: no_service", slackhook_response: resp) + Logger.warning("Slack hook response: no_service", slackhook_response: resp) case Sources.delete_slack_hook_url(source) do {:ok, _source} -> - Logger.warn("Slack hook url deleted.") + Logger.warning("Slack hook url deleted.") {:error, _changeset} -> Logger.error("Error deleting Slack hook url.") @@ -64,14 +64,14 @@ defmodule Logflare.Source.SlackHookServer.Client do {:ok, %Tesla.Env{} = response} -> resp = prep_tesla_resp_for_log(response) - Logger.warn("Slack hook error!", slackhook_response: resp) + Logger.warning("Slack hook error!", slackhook_response: resp) {:error, response} {:error, response} -> resp = prep_tesla_resp_for_log(response) - Logger.warn("Slack hook error!", slackhook_response: resp) + Logger.warning("Slack hook error!", slackhook_response: resp) {:error, response} end end diff --git a/lib/logflare/source/webhook_notification_server/client.ex b/lib/logflare/source/webhook_notification_server/client.ex index 7e00604ea..29e54e9ec 100644 --- a/lib/logflare/source/webhook_notification_server/client.ex +++ b/lib/logflare/source/webhook_notification_server/client.ex @@ -45,7 +45,7 @@ defmodule Logflare.Source.WebhookNotificationServer.Client do {:ok, response} {:ok, %Tesla.Env{} = response} -> - Logger.warn("Webhook error!", + Logger.warning("Webhook error!", webhook_request: %{url: url, body: inspect(payload)}, webhook_response: %{ body: inspect(response.body), @@ -58,7 +58,7 @@ defmodule Logflare.Source.WebhookNotificationServer.Client do {:error, response} {:error, response} -> - Logger.warn("Webhook error!", webhook_response: %{error: inspect(response)}) + Logger.warning("Webhook error!", webhook_response: %{error: inspect(response)}) {:error, response} end end diff --git a/lib/logflare/source/webhook_notification_server/discord_client.ex b/lib/logflare/source/webhook_notification_server/discord_client.ex index a9dc483bb..e7215328c 100644 --- a/lib/logflare/source/webhook_notification_server/discord_client.ex +++ b/lib/logflare/source/webhook_notification_server/discord_client.ex @@ -60,7 +60,7 @@ defmodule Logflare.Source.WebhookNotificationServer.DiscordClient do {:ok, response} {:ok, %Tesla.Env{} = response} -> - Logger.warn("Webhook error!", + Logger.warning("Webhook error!", webhook_request: %{url: url, body: inspect(payload)}, webhook_response: %{ body: inspect(response.body), @@ -73,7 +73,7 @@ defmodule Logflare.Source.WebhookNotificationServer.DiscordClient do {:error, response} {:error, response} -> - Logger.warn("Webhook error!", webhook_response: %{error: inspect(response)}) + Logger.warning("Webhook error!", webhook_response: %{error: inspect(response)}) {:error, response} end end diff --git a/lib/logflare/system_metrics/all_logs_logged/poller.ex b/lib/logflare/system_metrics/all_logs_logged/poller.ex index 140b965d3..834b948da 100644 --- a/lib/logflare/system_metrics/all_logs_logged/poller.ex +++ b/lib/logflare/system_metrics/all_logs_logged/poller.ex @@ -53,7 +53,7 @@ defmodule Logflare.SystemMetrics.AllLogsLogged.Poller do # Getting messages from tracker here for some reason. # Logflare.SystemMetrics.AllLogsLogged.Poller.handle_info({#Reference<0.2515045418.1638137859.219426>, {:ok, "Fl6TQMxzPJKX90GH"}}, %{init_total: 1384387391, inserts_since_init: 93034149, last_second: 472, last_total: 1480439241}) - Logger.warn("Handle Tracker message.") + Logger.warning("Handle Tracker message.") {:noreply, state} end diff --git a/lib/logflare_web/controllers/admin_controller.ex b/lib/logflare_web/controllers/admin_controller.ex index f244bb0ad..bf513cb1f 100644 --- a/lib/logflare_web/controllers/admin_controller.ex +++ b/lib/logflare_web/controllers/admin_controller.ex @@ -103,7 +103,7 @@ defmodule LogflareWeb.AdminController do |> put_status(:ok) |> json(%{"message" => "Success, shutting down node: #{node}"}) else - Logger.warn("Node shutdown requested!") + Logger.warning("Node shutdown requested!") conn |> put_status(:unauthorized) @@ -124,7 +124,7 @@ defmodule LogflareWeb.AdminController do end defp do_unauthorized_code_shutdown(conn, _params) do - Logger.warn("Node shutdown requested!") + Logger.warning("Node shutdown requested!") conn |> put_status(:unauthorized) diff --git a/lib/logflare_web/controllers/auth/oauth_controller.ex b/lib/logflare_web/controllers/auth/oauth_controller.ex index 1ebd48453..e757b4286 100644 --- a/lib/logflare_web/controllers/auth/oauth_controller.ex +++ b/lib/logflare_web/controllers/auth/oauth_controller.ex @@ -10,7 +10,7 @@ defmodule LogflareWeb.Auth.OauthController do alias Logflare.Alerting def request(conn, params) do - Logger.warn("Received unrecognized Oauth provider request", error_string: inspect(params)) + Logger.warning("Received unrecognized Oauth provider request", error_string: inspect(params)) auth_error_redirect(conn) end @@ -106,7 +106,7 @@ defmodule LogflareWeb.Auth.OauthController do %{assigns: %{ueberauth_failure: failure}} = conn, %{"provider" => provider} = params ) do - Logger.warn("Oauth failure for #{provider}. #{inspect(failure)}", + Logger.warning("Oauth failure for #{provider}. #{inspect(failure)}", error_string: inspect(params) ) @@ -114,7 +114,7 @@ defmodule LogflareWeb.Auth.OauthController do end def callback(conn, params) do - Logger.warn("Received unrecognized Oauth provider callback request", + Logger.warning("Received unrecognized Oauth provider callback request", error_string: inspect(params) ) diff --git a/lib/logflare_web/controllers/stripe_controller.ex b/lib/logflare_web/controllers/stripe_controller.ex index 941852671..c9567aeb0 100644 --- a/lib/logflare_web/controllers/stripe_controller.ex +++ b/lib/logflare_web/controllers/stripe_controller.ex @@ -215,7 +215,7 @@ defmodule LogflareWeb.StripeController do type = LogflareLogger.context().billing.webhook_type message = "customer not found: #{customer}" - Logger.warn("Stripe webhook: #{type}") + Logger.warning("Stripe webhook: #{type}") ok(conn, message) end diff --git a/lib/logflare_web/live/admin/cluster_live.ex b/lib/logflare_web/live/admin/cluster_live.ex index 7d6865cf6..d704a899c 100644 --- a/lib/logflare_web/live/admin/cluster_live.ex +++ b/lib/logflare_web/live/admin/cluster_live.ex @@ -18,7 +18,7 @@ defmodule LogflareWeb.Admin.ClusterLive do def handle_event("shutdown", %{"node" => node}, socket) do msg = "Node shutdown initiated for #{node}" - Logger.warn(msg) + Logger.warning(msg) String.to_atom(node) |> Admin.shutdown() diff --git a/lib/logflare_web/live/log_event_live/search_log_event_viewer_component.ex b/lib/logflare_web/live/log_event_live/search_log_event_viewer_component.ex index 30b55dbea..9d7b0e1c2 100644 --- a/lib/logflare_web/live/log_event_live/search_log_event_viewer_component.ex +++ b/lib/logflare_web/live/log_event_live/search_log_event_viewer_component.ex @@ -160,7 +160,7 @@ defmodule LogflareWeb.Search.LogEventViewerComponent do [from, to] = params.partitions_range err = "Log event with id #{params[:id]} between #{from} and #{to} was not found" - Logger.warn(err) + Logger.warning(err) err e -> diff --git a/lib/sig_term_handler.ex b/lib/sig_term_handler.ex index 57298416e..c340d07fc 100644 --- a/lib/sig_term_handler.ex +++ b/lib/sig_term_handler.ex @@ -16,7 +16,7 @@ defmodule Logflare.SigtermHandler do @impl true def handle_info(:proceed_with_sigterm, state) do - Logger.warn("#{__MODULE__}: shutdown grace period reached, stopping the app...") + Logger.warning("#{__MODULE__}: shutdown grace period reached, stopping the app...") System.stop() @@ -25,7 +25,7 @@ defmodule Logflare.SigtermHandler do @impl true def handle_event(:sigterm, state) do - Logger.warn( + Logger.warning( "#{__MODULE__}: SIGTERM received: waiting for #{env_grace_period() / 1_000} seconds" ) @@ -38,7 +38,7 @@ defmodule Logflare.SigtermHandler do end def handle_event(:sigquit, state) do - Logger.warn( + Logger.warning( "#{__MODULE__}: SIGQUIT received: waiting for #{env_grace_period() / 1_000} seconds" ) @@ -49,14 +49,14 @@ defmodule Logflare.SigtermHandler do @impl true def handle_event(ev, state) do - Logger.warn("#{__MODULE__}: has received a system signal: #{ev} and is ignoring it") + Logger.warning("#{__MODULE__}: has received a system signal: #{ev} and is ignoring it") {:ok, state} end @impl true def handle_call(msg, state) do - Logger.warn("#{__MODULE__} has received an unexpected call: #{inspect(msg)}") + Logger.warning("#{__MODULE__} has received an unexpected call: #{inspect(msg)}") {:ok, :ok, state} end end From 6126e09b825f743495dd6d406ebf46eacd598738 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Niemier?= Date: Fri, 6 Oct 2023 14:11:42 +0200 Subject: [PATCH 3/3] chore: bump OTP and Elixir version in .tool-versions --- .github/workflows/elixir-ci.yml | 6 +++--- .tool-versions | 4 ++-- Dockerfile | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/elixir-ci.yml b/.github/workflows/elixir-ci.yml index d719b8406..abc3c1ab7 100644 --- a/.github/workflows/elixir-ci.yml +++ b/.github/workflows/elixir-ci.yml @@ -40,8 +40,8 @@ jobs: - name: Set up Elixir uses: erlef/setup-beam@v1 with: - elixir-version: "1.14.4" # Define the elixir version [required] - otp-version: "25" # Define the OTP version [required] + version-file: .tool-versions + version-type: strict - name: Set up Rust uses: ATiltedTree/setup-rust@v1 with: @@ -66,4 +66,4 @@ jobs: # - name: Code quality - typings # run: mix test.typings - name: Code quality - linting - run: mix lint --only warnings \ No newline at end of file + run: mix lint --only warnings diff --git a/.tool-versions b/.tool-versions index 004aaff2d..bf3edc87a 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1,4 +1,4 @@ -elixir 1.14.4-otp-25 +elixir 1.15.5-otp-26 nodejs 18.13.0 rust 1.64.0 -erlang 25.3.1 +erlang 26.0.2 diff --git a/Dockerfile b/Dockerfile index 24d48f3a4..425f36576 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM elixir:1.14.4-alpine as builder +FROM elixir:1.15-alpine as builder ENV MIX_ENV prod # Due to some Rust caveats with SSL on Alpine images, we need to use GIT to fecth cargo registry index