Skip to content
3 changes: 2 additions & 1 deletion config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ config :arrow, ArrowWeb.Endpoint,
url: [host: "localhost"],
render_errors: [view: ArrowWeb.ErrorView, accepts: ~w(html json)],
pubsub_server: Arrow.PubSub,
live_view: [signing_salt: "35DDvOCJ"]
live_view: [signing_salt: "35DDvOCJ"],
adapter: Bandit.PhoenixAdapter

# Configures Oban, the job processing library
config :arrow, Oban,
Expand Down
22 changes: 21 additions & 1 deletion config/runtime.exs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,25 @@ if config_env() == :prod do
root_source_code_path: File.cwd!(),
tags: %{
env: sentry_env
}
},
traces_sample_rate: 1.0,
traces_sampler: fn sampling_context ->
Copy link
Contributor Author

@Whoops Whoops Jun 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't have many traces available (interestingly enough, even less than the free plan), and Oban checking for new work was chewing through them fast (~2k in 10 minutes). Since that's not particularly interesting to us for now, this filters out those spans.

if !sampling_context.parent_sampled &&
sampling_context.transaction_context.op in [
"arrow.repo.query:oban_jobs",
"arrow.repo.query",
"Elixir.Oban.Stager process",
"Elixir.Oban.Plugins.Cron process",
"arrow.repo.query:oban_peers"
] do
false
else
1.0
end
end

config :opentelemetry, span_processor: {Sentry.OpenTelemetry.SpanProcessor, []}
config :opentelemetry, sampler: {Sentry.OpenTelemetry.Sampler, []}

config :logger, Sentry.LoggerBackend,
level: :warning,
Expand Down Expand Up @@ -89,6 +107,8 @@ if config_env() == :prod do
shape_storage_prefix_env: System.get_env("S3_PREFIX"),
gtfs_archive_storage_prefix_env: System.get_env("S3_PREFIX"),
hastus_export_storage_prefix_env: System.get_env("S3_PREFIX")
else
config :opentelemetry, traces_exporter: :none
end

sync_enabled = System.get_env("ARROW_SYNC_ENABLED") == "true"
Expand Down
4 changes: 4 additions & 0 deletions lib/arrow/application.ex
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ defmodule Arrow.Application do
use Application

def start(_type, _args) do
OpentelemetryBandit.setup()
OpentelemetryPhoenix.setup(adapter: :cowboy2)
:ok = OpentelemetryEcto.setup([:arrow, :repo], db_statement: :enabled)
OpentelemetryOban.setup()
run_adjustment_fetcher? = Application.get_env(:arrow, :fetch_adjustments?)
run_migrations_at_startup? = Application.get_env(:arrow, :run_migrations_at_startup?)

Expand Down
17 changes: 13 additions & 4 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ defmodule Arrow.MixProject do
def application do
[
mod: {Arrow.Application, []},
extra_applications: [:logger, :runtime_tools]
extra_applications: [:logger, :runtime_tools, :tls_certificate_check]
]
end

Expand All @@ -53,7 +53,7 @@ defmodule Arrow.MixProject do
{:ex_aws_secretsmanager, "~> 2.0"},
{:ex_aws, "~> 2.1"},
{:ex_aws_s3, "~> 2.1"},
{:floki, ">= 0.30.0", only: :test},
{:floki, "~> 0.37.1", only: :test},
{:sweet_xml, "~> 0.7.4"},
{:ex_machina, "~> 2.3", only: :test},
{:gettext, "~> 0.11"},
Expand All @@ -66,6 +66,7 @@ defmodule Arrow.MixProject do
{:lcov_ex, "~> 0.2", only: [:dev, :test], runtime: false},
{:mox, "~> 1.2", only: :test},
{:oban, "~> 2.18"},
{:bandit, "~> 1.0"},
{:phoenix_ecto, "~> 4.0"},
{:phoenix_live_reload, "~> 1.5", only: :dev},
{:phoenix_html, "~> 4.0"},
Expand All @@ -75,7 +76,6 @@ defmodule Arrow.MixProject do
{:phoenix_live_dashboard, "~> 0.7"},
{:phoenix_pubsub, "~> 2.0"},
{:phoenix, "~> 1.7.12"},
{:plug_cowboy, "~> 2.1"},
{:telemetry, "~> 1.2", override: true},
{:telemetry_poller, "~> 1.1"},
{:telemetry_metrics, "~> 1.0"},
Expand All @@ -86,7 +86,16 @@ defmodule Arrow.MixProject do
{:ueberauth_oidcc, "~> 0.4.0"},
{:ueberauth, "~> 0.10"},
{:wallaby, "~> 0.30", runtime: false, only: :test},
{:sentry, "~> 10.7"},
{:sentry, "~> 11.0"},
{:opentelemetry, "~> 1.5"},
{:opentelemetry_api, "~> 1.4"},
{:opentelemetry_exporter, "~> 1.0"},
# https://github.com/open-telemetry/opentelemetry-erlang-contrib/issues/428
{:opentelemetry_semantic_conventions, "~> 1.27", override: true},
{:opentelemetry_phoenix, "~> 2.0"},
{:opentelemetry_ecto, "~> 1.2"},
{:opentelemetry_bandit, "~> 0.2.0"},
{:opentelemetry_oban, "~> 1.1"},
{:tailwind, "~> 0.2", runtime: Mix.env() == :dev},
{:heroicons,
github: "tailwindlabs/heroicons",
Expand Down
Loading