Yet more Sentry
This commit is contained in:
parent
6916647737
commit
5ece9cd21c
|
@ -23,6 +23,10 @@ defmodule Frenzy.Network do
|
|||
|
||||
@spec http_get(String.t()) :: Tesla.Env.result()
|
||||
def http_get(url) do
|
||||
if Frenzy.sentry_enabled?() do
|
||||
Sentry.Context.add_breadcrumb(%{category: "http_get", message: url})
|
||||
end
|
||||
|
||||
HTTP.get(url)
|
||||
end
|
||||
|
||||
|
@ -77,6 +81,10 @@ defmodule Frenzy.Network do
|
|||
@spec gemini_request(String.t() | URI.t()) :: {:ok, Gemini.Response.t()} | {:error, term()}
|
||||
|
||||
def gemini_request(uri) do
|
||||
if Frenzy.sentry_enabled?() do
|
||||
Sentry.Context.add_breadcrumb(%{category: "gemini_request", message: uri})
|
||||
end
|
||||
|
||||
case Gemini.request(uri) do
|
||||
{:ok, %Gemini.Response{status: code} = response} when code in @gemini_success_codes ->
|
||||
{:ok, response}
|
||||
|
|
|
@ -47,6 +47,13 @@ defmodule Frenzy.Task.CreateItem do
|
|||
feed.pipeline.stages
|
||||
|> Enum.reduce({:ok, item_params}, fn
|
||||
stage, {:ok, item_params} ->
|
||||
if Frenzy.sentry_enabled?() do
|
||||
Sentry.Context.add_breadcrumb(%{
|
||||
category: "pipeline",
|
||||
message: stage["module_name"]
|
||||
})
|
||||
end
|
||||
|
||||
apply(String.to_existing_atom("Elixir." <> stage["module_name"]), :apply, [
|
||||
stage["options"],
|
||||
item_params
|
||||
|
@ -69,8 +76,12 @@ defmodule Frenzy.Task.CreateItem do
|
|||
|
||||
if Frenzy.sentry_enabled?() do
|
||||
Sentry.capture_message(
|
||||
"Error evaluating pipeline '#{feed.pipeline.name}': #{inspect(error)}",
|
||||
extra: %{feed_id: feed.id, pipeline_id: feed.pipeline.id}
|
||||
"Error evaluating pipeline: #{inspect(error)}",
|
||||
extra: %{
|
||||
feed_id: feed.id,
|
||||
pipeline_id: feed.pipeline.id,
|
||||
pipeline_name: feed.pipeline.name
|
||||
}
|
||||
)
|
||||
end
|
||||
|
||||
|
@ -106,8 +117,12 @@ defmodule Frenzy.Task.CreateItem do
|
|||
Logger.error(changeset.errors)
|
||||
|
||||
if Frenzy.sentry_enabled?() do
|
||||
Sentry.capture_message("Error inserting item '#{item_params.guid}'",
|
||||
extra: %{feed_id: feed.id, errors: changeset.errors}
|
||||
Sentry.capture_message("Error inserting item: #{inspect(changeset.errors)}",
|
||||
extra: %{
|
||||
item_guid: item_params.guid,
|
||||
feed_id: feed.id,
|
||||
errors: changeset.errors
|
||||
}
|
||||
)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -151,8 +151,8 @@ defmodule Frenzy.UpdateFeeds do
|
|||
Logger.error("Couldn't load feed #{feed.feed_url}: #{inspect(reason)}")
|
||||
|
||||
if Frenzy.sentry_enabled?() do
|
||||
Sentry.capture_message("Error loading HTTP feed '#{feed.feed_url}': #{inspect(reason)}",
|
||||
extra: %{feed_id: feed.id}
|
||||
Sentry.capture_message("Error loading HTTP feed: #{inspect(reason)}",
|
||||
extra: %{feed_id: feed.id, feed_url: feed.feed_url}
|
||||
)
|
||||
end
|
||||
end
|
||||
|
@ -168,8 +168,8 @@ defmodule Frenzy.UpdateFeeds do
|
|||
|
||||
if Frenzy.sentry_enabled?() do
|
||||
Sentry.capture_message(
|
||||
"Error loading Gemini feed '#{feed.feed_url}': #{inspect(reason)}",
|
||||
extra: %{feed_id: feed.id}
|
||||
"Error loading Gemini feed: #{inspect(reason)}",
|
||||
extra: %{feed_id: feed.id, feed_url: feed.feed_url}
|
||||
)
|
||||
end
|
||||
end
|
||||
|
@ -184,8 +184,8 @@ defmodule Frenzy.UpdateFeeds do
|
|||
Logger.error("Unable to parse feed at '#{feed.feed_url}': #{inspect(reason)}")
|
||||
|
||||
if Frenzy.sentry_enabled?() do
|
||||
Sentry.capture_message("Unable to parse feed '#{feed.feed_url}': #{inspect(reason)}",
|
||||
extra: %{feed_id: feed.id}
|
||||
Sentry.capture_message("Unable to parse feed: #{inspect(reason)}",
|
||||
extra: %{feed_id: feed.id, feed_url: feed.feed_url}
|
||||
)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue