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

Iterate on Elixir update #459

Merged
merged 2 commits into from
Jun 19, 2024
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
4 changes: 0 additions & 4 deletions apps/cf/config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@ config :cf,

config :guardian, Guardian.DB, repo: DB.Repo

config :scout_apm,
name: "CaptainFact",
key: {:system, "CF_SCOUT_APM_KEY"}

# To send records to Algolia (search engine)
config :algoliax,
batch_size: 500,
Expand Down
1 change: 1 addition & 0 deletions apps/cf/config/dev.exs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ config :logger, :console, format: "[$level] $message\n"
# Set a higher stacktrace during development. Avoid configuring such
# in production as building large stacktraces may be expensive.
config :phoenix, :stacktrace_depth, 20
config :phoenix, :json_library, Jason

# Mails
config :cf, CF.Mailer, adapter: Bamboo.LocalAdapter
Expand Down
1 change: 0 additions & 1 deletion apps/cf/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ defmodule CF.Mixfile do
{:sweet_xml, "~> 0.6"},
{:burnex, "~> 3.1"},
{:yaml_elixir, "~> 2.9.0"},
{:scout_apm, "~> 1.0.6"},

# ---- Internal ----
{:db, in_umbrella: true},
Expand Down
1 change: 1 addition & 0 deletions apps/cf_graphql/config/dev.exs
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ config :logger, :console, format: "[$level] $message\n"
# Set a higher stacktrace during development. Avoid configuring such
# in production as building large stacktraces may be expensive.
config :phoenix, :stacktrace_depth, 20
config :phoenix, :json_library, Jason
1 change: 0 additions & 1 deletion apps/cf_graphql/lib/endpoint.ex
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ defmodule CF.GraphQLWeb.Endpoint do
json_decoder: Poison
)

plug(ScoutApm.Absinthe.Plug)
plug(Plug.MethodOverride)
plug(Plug.Head)
plug(CF.GraphQLWeb.Router)
Expand Down
32 changes: 0 additions & 32 deletions apps/cf_graphql/lib/scout_apm_absinthe_plug.ex

This file was deleted.

4 changes: 2 additions & 2 deletions apps/cf_graphql/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ defmodule CF.Graphql.Mixfile do
defp deps do
[
{:phoenix, "~> 1.5.14"},
{:plug, "~> 1.7"},
{:phoenix_pubsub, "~> 2.0"},
{:jason, "~> 1.4"},
{:plug, "~> 1.7"},
{:cowboy, "~> 2.0"},
{:corsica, "~> 2.1"},
{:absinthe_ecto, "~> 0.1.3"},
{:absinthe_plug, "~> 1.4.1"},
{:kaur, "~> 1.1"},
{:poison, "~> 3.1"},
{:scout_apm, "~> 1.0.6"},

# Internal dependencies
{:db, in_umbrella: true},
Expand Down
1 change: 0 additions & 1 deletion apps/cf_jobs/lib/job.ex
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ defmodule CF.Jobs.Job do
@type t :: module

use GenServer
import ScoutApm.Tracing

def init(args) do
{:ok, args}
Expand Down
3 changes: 1 addition & 2 deletions apps/cf_jobs/lib/jobs/create_notifications.ex
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ defmodule CF.Jobs.CreateNotifications do

require Logger
import Ecto.Query
import ScoutApm.Tracing

alias DB.Repo
alias DB.Schema.UsersActionsReport
Expand Down Expand Up @@ -66,7 +65,7 @@ defmodule CF.Jobs.CreateNotifications do
end

# --- Server callbacks ---
@transaction_opts [type: "background", name: "update_notifications"]

def handle_call({:update, force}, _from, _state) do
last_action_id = ReportManager.get_last_action_id(@analyser_id)

Expand Down
2 changes: 0 additions & 2 deletions apps/cf_jobs/lib/jobs/download_captions.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ defmodule CF.Jobs.DownloadCaptions do

require Logger
import Ecto.Query
import ScoutApm.Tracing

alias DB.Repo
alias DB.Schema.UserAction
Expand Down Expand Up @@ -35,7 +34,6 @@ defmodule CF.Jobs.DownloadCaptions do
end

# --- Server callbacks ---
@transaction_opts [type: "background", name: "download_captions"]
def handle_call(:download_captions, _from, _state) do
get_videos()
|> Enum.map(fn video ->
Expand Down
3 changes: 1 addition & 2 deletions apps/cf_jobs/lib/jobs/flags.ex
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ defmodule CF.Jobs.Flags do

require Logger
import Ecto.Query
import ScoutApm.Tracing

alias DB.Repo
alias DB.Schema.UserAction
Expand Down Expand Up @@ -42,7 +41,7 @@ defmodule CF.Jobs.Flags do
end

# --- Server callbacks ---
@transaction_opts [type: "background", name: "update_flags"]

def handle_call(:update_flags, _from, _state) do
last_action_id = ReportManager.get_last_action_id(@analyser_id)

Expand Down
2 changes: 0 additions & 2 deletions apps/cf_jobs/lib/jobs/moderation.ex
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ defmodule CF.Jobs.Moderation do

require Logger
import Ecto.Query
import ScoutApm.Tracing

alias DB.Repo
alias DB.Schema.ModerationUserFeedback
Expand Down Expand Up @@ -79,7 +78,6 @@ defmodule CF.Jobs.Moderation do

# --- Internal API ---

@transaction_opts [type: "background", name: "update_moderation"]
def handle_call(:update, _, _) do
UserAction
|> join(:inner, [a], uf in ModerationUserFeedback, on: uf.action_id == a.id)
Expand Down
4 changes: 1 addition & 3 deletions apps/cf_jobs/lib/jobs/reputation.ex
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ defmodule CF.Jobs.Reputation do

require Logger
import Ecto.Query
import ScoutApm.Tracing

alias DB.Repo
alias DB.Schema.User
Expand Down Expand Up @@ -100,7 +99,7 @@ defmodule CF.Jobs.Reputation do
do: max(change, @daily_loss_limit - today_change)

# --- Server callbacks ---
@transaction_opts [type: "background", name: "update_reputation"]

def handle_call(:update_reputations, _from, _state) do
last_action_id = ReportManager.get_last_action_id(@analyser_id)

Expand All @@ -115,7 +114,6 @@ defmodule CF.Jobs.Reputation do
{:reply, :ok, :ok}
end

@transaction_opts [type: "background", name: "reset_reputation_limits"]
def handle_call(:reset_daily_limits, _from, _state) do
Logger.info("[Jobs.Reputation] Reset daily limits")

Expand Down
1 change: 0 additions & 1 deletion apps/cf_jobs/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ defmodule CF.Jobs.Mixfile do
[
{:quantum, "~> 2.3"},
{:timex, "~> 3.0"},
{:scout_apm, "~> 1.0.6"},

# ---- Internal ----
{:cf, in_umbrella: true},
Expand Down
1 change: 1 addition & 0 deletions apps/cf_rest_api/config/dev.exs
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ config :cf_rest_api, CF.RestApi.Endpoint,
# Set a higher stacktrace during development. Avoid configuring such
# in production as building large stacktraces may be expensive.
config :phoenix, :stacktrace_depth, 20
config :phoenix, :json_library, Jason
3 changes: 1 addition & 2 deletions apps/cf_rest_api/lib/channels/video_debate_channel.ex
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
defmodule CF.RestApi.VideoDebateChannel do
use CF.RestApi, :channel
import ScoutApm.Tracing
alias CF.RestApi.Presence

import CF.Actions.ActionCreator,
only: [
Expand All @@ -26,7 +26,6 @@ defmodule CF.RestApi.VideoDebateChannel do
alias CF.Notifications.Subscriptions
alias CF.RestApi.{VideoView, SpeakerView, ChangesetView}

@transaction_opts [type: "web", name: "VideoDebateChannel.join"]
def join("video_debate:" <> video_hash_id, _payload, socket) do
Video
|> Video.with_speakers()
Expand Down
1 change: 0 additions & 1 deletion apps/cf_rest_api/lib/rest_api.ex
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ defmodule CF.RestApi do
def controller do
quote do
use Phoenix.Controller, namespace: CF.RestApi
use ScoutApm.Instrumentation

alias DB.Repo
import Ecto
Expand Down
2 changes: 1 addition & 1 deletion apps/cf_rest_api/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ defmodule CF.RestApi.Mixfile do
{:phoenix, "~> 1.5.14", override: true},
{:phoenix_html, "~> 2.14.3"},
{:phoenix_pubsub, "~> 2.0"},
{:jason, "~> 1.4"},
{:poison, "~> 3.1"},
{:scout_apm, "~> 1.0.6"},
{:plug_cowboy, "~> 2.1"},

# ---- Internal ----
Expand Down
1 change: 1 addition & 0 deletions apps/cf_reverse_proxy/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ defmodule CF.ReverseProxy.Mixfile do
{:cf_graphql, in_umbrella: true},
{:cf_atom_feed, in_umbrella: true},
{:phoenix, "~> 1.5.14"},
{:jason, "~> 1.4"},
{:cowboy, "~> 2.0"},
{:corsica, "~> 2.1"}
]
Expand Down
3 changes: 1 addition & 2 deletions apps/db/config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ config :db, DB.Repo,
adapter: Ecto.Adapters.Postgres,
pool_size: 3,
loggers: [
{Ecto.LogEntry, :log, []},
{ScoutApm.Instruments.EctoLogger, :log, []}
{Ecto.LogEntry, :log, []}
]

# Import environment specific config
Expand Down
1 change: 0 additions & 1 deletion apps/db/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ defmodule DB.Mixfile do
{:kaur, "~> 1.1"},
{:mime, "~> 1.2"},
{:scrivener_ecto, "~> 2.0"},
{:scout_apm, "~> 1.0.6"},
{:algoliax, "~> 0.7.1"},

# Dev only
Expand Down
3 changes: 0 additions & 3 deletions config/releases.exs
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,6 @@ end

# ---- [APP CONFIG] :cf_graphql ----

config :scout_apm,
key: load_secret.("scout_apm_key")

config :cf_graphql, CF.GraphQLWeb.Endpoint,
url: [host: load_secret.("host")],
secret_key_base: [host: load_secret.("secret_key_base")]
Expand Down
Loading