Skip to content

Commit

Permalink
fix: gtfs-api: grant access to gtfs_data_imported_at metric to PostgREST
Browse files Browse the repository at this point in the history
  • Loading branch information
derhuerst committed Jan 4, 2025
1 parent 68c363b commit a71503f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
- `dagster-pipeline`/`dagster-daemon`/`dagster-dagit`: upgrade to [`2024-12-03t09-35`](https://github.com/mobidata-bw/ipl-dagster-pipeline/blob/7ceecb4f622dc3a6ac9e6a3179885b4d17b62301/CHANGELOG.md#2024-12-03)
- `lamassu`: upgraded [`lamassu`](https://github.com/entur/lamassu) to [2024-12-17T19-37](https://hub.docker.com/layers/entur/lamassu/2024-12-17T19-37/images/sha256-7fb67b8f7a7395a9ec726dda7ed411679ef900fe0c4f3ec2da636cd4da5f603a). This i.e. includes immediate update after successful feed subscription (https://github.com/entur/lamassu/pull/592). As consequence, `X2GBFS_HEALTHCHECK_START_INTERVAL` is not necessary any longer and has been removed.
- `gtfs-api`: fix `gtfs_data_imported_at` Prometheus metric:
- grant access to the PostgreSQL function to PostgREST
- move `text/plain` PostgreSQL domain into the `api` schema


Expand Down
2 changes: 2 additions & 0 deletions etc/gtfs/postprocessing.d/41-postgrest-domain-text-plain.sql
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
-- see https://postgrest.org/en/stable/references/api/media_type_handlers.html
CREATE DOMAIN api."text/plain" AS text;

GRANT USAGE ON DOMAIN api."text/plain" TO postgrest;
2 changes: 2 additions & 0 deletions etc/gtfs/postprocessing.d/42-postgrest-imported-at-metric.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ RETURNS api."text/plain"
AS $$
SELECT E'# HELP gtfs_data_imported_at when the GTFS data has been imported\n# TYPE gtfs_data_imported_at gauge\ngtfs_data_imported_at=' || floor(EXTRACT(EPOCH FROM api.gtfs_data_imported_at())) || E'\n';
$$ LANGUAGE SQL IMMUTABLE;

GRANT EXECUTE ON FUNCTION api.gtfs_data_imported_at_metric TO postgrest;

0 comments on commit a71503f

Please sign in to comment.