Weather CSV: Observability
Goal
Add one domain-specific metric to the Weather CSV plugin and verify the plugin still writes a Zarr product.
Continue from Weather CSV Plugin. You will keep the same
plugin and add one metric through ctx.telemetry.
Add One Metric
In plugins_dev/firecube-weather-csv/src/firecube_weather_csv/ingestor.py, add
this block near the end of build_dataset, just before return ds:
if ctx.telemetry is not None:
ctx.telemetry.emit(
"weather_csv_files",
len(items),
kind="counter",
meta={"group": group, "status": "success"},
)
counter is the right kind here because the value is a count that increases
during the run. Firecube exports it as:
Run The Plugin
PRODUCT_URI="file://$PWD/tutorial-output/weather_csv_observed.zarr"
uv run firecube ingest weather_csv \
--input-data tutorial-data/weather-csv \
--target "$PRODUCT_URI" \
--product-name weather_csv_observed \
--storage-type local \
--storage-driver fsspec \
--output-format zarr \
--write-mode direct \
--option 'include_patterns=["*.csv"]'
Expected logs on stderr include:
Expected command output on stdout includes:
Verify The Product
uv run python - <<'PY'
import xarray as xr
ds = xr.open_zarr(
"tutorial-output/weather_csv_observed.zarr",
group="default",
consolidated=False,
)
assert ds.sizes["timestamp"] == 4
print("ok")
PY
Expected output:
Optional: Push Metrics
When a Prometheus Pushgateway is available, set its URL before running ingestion:
Rerun ingestion, then query the pushed metric:
Expected output includes:
Pushgateway grouping, labels, and environment variables are listed in Observability Reference.
Next Steps
- Metrics — metric kinds, labels, and Pushgateway behavior
- Plugin Observability — plugin telemetry rules
- Sentinel-3 FRP Plugin — build a Parquet plugin from downloaded data
- Direct Parallel Zarr — continue to the advanced write path