feat(radar): log NEXRAD fetches + worker progress
Previously the CommonVolumeRadarWorker ran silently — no URL logged, no sign in the logs that it was doing any work. Added info-level fetch/ok/error logs in NexradClient (same shape as WeatherFetchWorker RAOB logs) plus start-of-work + ingestion lines in the worker itself. Unchanged: the existing "no frame" warning and all control flow.
This commit is contained in:
parent
af6c676df5
commit
ced5e3d1a6
2 changed files with 21 additions and 3 deletions
|
|
@ -33,14 +33,19 @@ defmodule Microwaveprop.Weather.NexradClient do
|
||||||
|
|
||||||
req_opts = Application.get_env(:microwaveprop, :nexrad_req_options, [])
|
req_opts = Application.get_env(:microwaveprop, :nexrad_req_options, [])
|
||||||
|
|
||||||
|
Logger.info("NexradClient: fetching #{url}")
|
||||||
|
|
||||||
case Req.get(url, [receive_timeout: 60_000, retry: false] ++ req_opts) do
|
case Req.get(url, [receive_timeout: 60_000, retry: false] ++ req_opts) do
|
||||||
{:ok, %{status: 200, body: body}} when is_binary(body) ->
|
{:ok, %{status: 200, body: body}} when is_binary(body) ->
|
||||||
|
Logger.info("NexradClient: ok #{byte_size(body)} bytes from #{url}")
|
||||||
process_frame(body, rounded, points_of_interest)
|
process_frame(body, rounded, points_of_interest)
|
||||||
|
|
||||||
{:ok, %{status: status}} ->
|
{:ok, %{status: status}} ->
|
||||||
|
Logger.warning("NexradClient: HTTP #{status} for #{url}")
|
||||||
{:error, "NEXRAD n0q HTTP #{status}"}
|
{:error, "NEXRAD n0q HTTP #{status}"}
|
||||||
|
|
||||||
{:error, reason} ->
|
{:error, reason} ->
|
||||||
|
Logger.warning("NexradClient: transport error for #{url}: #{inspect(reason)}")
|
||||||
{:error, reason}
|
{:error, reason}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -109,10 +114,20 @@ defmodule Microwaveprop.Weather.NexradClient do
|
||||||
url = frame_url(rounded)
|
url = frame_url(rounded)
|
||||||
req_opts = Application.get_env(:microwaveprop, :nexrad_req_options, [])
|
req_opts = Application.get_env(:microwaveprop, :nexrad_req_options, [])
|
||||||
|
|
||||||
|
Logger.info("NexradClient: fetching #{url}")
|
||||||
|
|
||||||
case Req.get(url, [receive_timeout: 60_000, retry: false] ++ req_opts) do
|
case Req.get(url, [receive_timeout: 60_000, retry: false] ++ req_opts) do
|
||||||
{:ok, %{status: 200, body: body}} when is_binary(body) -> decode_png_to_pixels(body)
|
{:ok, %{status: 200, body: body}} when is_binary(body) ->
|
||||||
{:ok, %{status: status}} -> {:error, "NEXRAD n0q HTTP #{status}"}
|
Logger.info("NexradClient: ok #{byte_size(body)} bytes from #{url}")
|
||||||
{:error, reason} -> {:error, reason}
|
decode_png_to_pixels(body)
|
||||||
|
|
||||||
|
{:ok, %{status: status}} ->
|
||||||
|
Logger.warning("NexradClient: HTTP #{status} for #{url}")
|
||||||
|
{:error, "NEXRAD n0q HTTP #{status}"}
|
||||||
|
|
||||||
|
{:error, reason} ->
|
||||||
|
Logger.warning("NexradClient: transport error for #{url}: #{inspect(reason)}")
|
||||||
|
{:error, reason}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -77,11 +77,14 @@ defmodule Microwaveprop.Workers.CommonVolumeRadarWorker do
|
||||||
qso_at = contact.qso_timestamp
|
qso_at = contact.qso_timestamp
|
||||||
rounded = NexradClient.round_to_5min(DateTime.from_naive!(qso_at, "Etc/UTC"))
|
rounded = NexradClient.round_to_5min(DateTime.from_naive!(qso_at, "Etc/UTC"))
|
||||||
|
|
||||||
|
Logger.info("CommonVolumeRadarWorker: #{contact.id} fetching n0q frame for #{DateTime.to_iso8601(rounded)}")
|
||||||
|
|
||||||
case NexradClient.fetch_decoded_frame(rounded) do
|
case NexradClient.fetch_decoded_frame(rounded) do
|
||||||
{:ok, pixels, width} ->
|
{:ok, pixels, width} ->
|
||||||
stats = aggregate_stats(pixels, width, pos1, pos2)
|
stats = aggregate_stats(pixels, width, pos1, pos2)
|
||||||
upsert_row!(contact, rounded, stats)
|
upsert_row!(contact, rounded, stats)
|
||||||
mark_status(contact, :complete)
|
mark_status(contact, :complete)
|
||||||
|
Logger.info("CommonVolumeRadarWorker: #{contact.id} ingested (max_dbz=#{stats.max_dbz || "nil"})")
|
||||||
:ok
|
:ok
|
||||||
|
|
||||||
{:error, reason} ->
|
{:error, reason} ->
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue