garf exporter - Prometheus exporter for garf.
garf-exporter is responsible exposing garf-extracted data to Prometheus.
Installation
pip install garf-exporter
uv pip install garf-exporter
Usage
garf-exporter expects a configuration file that contains garf-queries mapped to collector names.
Config file may contains one or several queries.
- title: test
query: |
SELECT
dimension,
metric,
metric_clicks,
campaign
FROM resource
Important
To treat any field in SELECT statement as metric prefix with with metric_.
You need to explicitly specify source of API and path to config file to start exporting data.
garf-exporter --source API_SOURCE -c config.yaml
Once garf-exporter is running you can see exposed metrics at localhost:8000/metrics.
Customization
Exporter
--config- path togarf_exporter.yaml, can be taken from local or remote file.--expose-type- type of exposition (httporpushgateway,httpis used by default)--host- address of your http server (localhostby default)--port- port of your http server (8000by default)--delay-minutes- delay in minutes between scrapings (15by default)
Source
Depending on a source selected you may need to provide source-specific parameters
in --source.key=value format (i.e. --source.credentials_file=/app/credentials.json).
Macro
If queries contain macros you need provide them
in --macros.key=value format (i.e. --macro.start-date=20250101).
Examples
Bid Manager API
-
Ensure that Bid Manager access is configured.
-
Specify config
- title: performance
query: |
SELECT
advertiser,
metric_clicks
FROM standard
WHERE advertiser = {advertiser}
AND dataRange = CURRENT_DAY
suffix: "Remove"
- Start exporting
garf-exporter \
--source bid-manager \
-c config.yaml \
--macro.advertiser=ADVERTISER_ID