Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: use OTP 26 #1719

Merged
merged 3 commits into from
Oct 6, 2023
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
6 changes: 3 additions & 3 deletions .github/workflows/elixir-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -66,4 +66,4 @@ jobs:
# - name: Code quality - typings
# run: mix test.typings
- name: Code quality - linting
run: mix lint --only warnings
run: mix lint --only warnings
4 changes: 2 additions & 2 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/logflare/admin.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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, [])
Expand Down
2 changes: 1 addition & 1 deletion lib/logflare/application.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
6 changes: 3 additions & 3 deletions lib/logflare/context_cache.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/logflare/endpoints/cache.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
5 changes: 4 additions & 1 deletion lib/logflare/google/bigquery/bigquery.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/logflare/google/bigquery/schema_utils/schema_utils.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion lib/logflare/logs/log_event.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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)}"
# )

Expand Down
4 changes: 3 additions & 1 deletion lib/logflare/logs/lql/bigquery/lql_ecto_helpers.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/logflare/logs/netlify.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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} ->
Expand Down
2 changes: 1 addition & 1 deletion lib/logflare/logs/search/logs_search_query_executor.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 ->
Expand Down
12 changes: 6 additions & 6 deletions lib/logflare/source/bigquery/pipeline.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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)
)

Expand All @@ -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
Expand Down Expand Up @@ -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}",
Expand Down
8 changes: 4 additions & 4 deletions lib/logflare/source/bigquery/schema.ex
Original file line number Diff line number Diff line change
Expand Up @@ -191,23 +191,23 @@ 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)
)

{:reply, :error, %{state | next_update: next_update()}}
end

{:error, response} ->
Logger.warn("Source schema update error!",
Logger.warning("Source schema update error!",
tesla_response: BigQuery.GenUtils.get_tesla_error_message(response)
)

{:reply, :error, %{state | next_update: next_update()}}
end

message ->
Logger.warn("Source schema update error!",
Logger.warning("Source schema update error!",
tesla_response: message
)

Expand Down Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions lib/logflare/source/slack_hook_server/client.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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)}
)
Expand All @@ -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.")
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions lib/logflare/source/webhook_notification_server/client.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/logflare/system_metrics/all_logs_logged/poller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions lib/logflare_web/controllers/admin_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions lib/logflare_web/controllers/auth/oauth_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -106,15 +106,15 @@ 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)
)

auth_error_redirect(conn)
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)
)

Expand Down
2 changes: 1 addition & 1 deletion lib/logflare_web/controllers/stripe_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/logflare_web/live/admin/cluster_live.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
5 changes: 4 additions & 1 deletion lib/logflare_web/live/endpoints/actions/index.html.heex
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
</p>

<div class="tw-flex tw-gap-4 tw-items-center">
<%= 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 ->
Expand Down
Loading
Loading