don't log crawl times with appsignal
This commit is contained in:
parent
235952b072
commit
74fc30e8a5
|
@ -10,7 +10,6 @@ defmodule Backend.Crawler do
|
||||||
import Ecto.Query
|
import Ecto.Query
|
||||||
import Backend.Util
|
import Backend.Util
|
||||||
require Logger
|
require Logger
|
||||||
use Appsignal.Instrumentation.Decorators
|
|
||||||
|
|
||||||
defstruct [
|
defstruct [
|
||||||
# the instance domain (a string)
|
# the instance domain (a string)
|
||||||
|
@ -32,7 +31,6 @@ defmodule Backend.Crawler do
|
||||||
error: String.t() | nil
|
error: String.t() | nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@decorate transaction()
|
|
||||||
def run(domain) do
|
def run(domain) do
|
||||||
Logger.debug("Starting crawl of #{domain}")
|
Logger.debug("Starting crawl of #{domain}")
|
||||||
|
|
||||||
|
@ -60,13 +58,11 @@ defmodule Backend.Crawler do
|
||||||
|
|
||||||
# Recursive function to check whether `domain` has an API that the head of the api_crawlers list can read.
|
# Recursive function to check whether `domain` has an API that the head of the api_crawlers list can read.
|
||||||
# If so, crawls it. If not, continues with the tail of the api_crawlers list.
|
# If so, crawls it. If not, continues with the tail of the api_crawlers list.
|
||||||
@decorate transaction_event()
|
|
||||||
defp crawl(%Crawler{api_crawlers: [], domain: domain} = state) do
|
defp crawl(%Crawler{api_crawlers: [], domain: domain} = state) do
|
||||||
Logger.debug("Found no compatible API for #{domain}")
|
Logger.debug("Found no compatible API for #{domain}")
|
||||||
Map.put(state, :found_api?, false)
|
Map.put(state, :found_api?, false)
|
||||||
end
|
end
|
||||||
|
|
||||||
@decorate transaction_event()
|
|
||||||
defp crawl(%Crawler{domain: domain, api_crawlers: [curr | remaining_crawlers]} = state) do
|
defp crawl(%Crawler{domain: domain, api_crawlers: [curr | remaining_crawlers]} = state) do
|
||||||
if curr.is_instance_type?(domain) do
|
if curr.is_instance_type?(domain) do
|
||||||
Logger.debug("Found #{curr} instance")
|
Logger.debug("Found #{curr} instance")
|
||||||
|
@ -97,7 +93,6 @@ defmodule Backend.Crawler do
|
||||||
end
|
end
|
||||||
|
|
||||||
# Save the state (after crawling) to the database.
|
# Save the state (after crawling) to the database.
|
||||||
@decorate transaction_event()
|
|
||||||
defp save(%Crawler{
|
defp save(%Crawler{
|
||||||
domain: domain,
|
domain: domain,
|
||||||
result: result,
|
result: result,
|
||||||
|
@ -214,7 +209,6 @@ defmodule Backend.Crawler do
|
||||||
|> Repo.insert_all(interactions)
|
|> Repo.insert_all(interactions)
|
||||||
end
|
end
|
||||||
|
|
||||||
@decorate transaction_event()
|
|
||||||
defp save(%{domain: domain, error: error, allows_crawling?: allows_crawling}) do
|
defp save(%{domain: domain, error: error, allows_crawling?: allows_crawling}) do
|
||||||
error =
|
error =
|
||||||
cond do
|
cond do
|
||||||
|
|
Loading…
Reference in a new issue