Metadata-Version: 2.4
Name: garf-exporter
Version: 0.1.0
Summary: Exports data from APIs to Prometheus
Author-email: Andrei Markin <andrey.markin.ppc@gmail.com>, "Google Inc. (gTech gPS CSE team)" <no-reply@google.com>
License: Apache 2.0
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Operating System :: OS Independent
Classifier: License :: OSI Approved :: Apache Software License
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: garf-executors
Requires-Dist: pyyaml
Requires-Dist: prometheus-client
Requires-Dist: pydantic
Requires-Dist: fastapi
Requires-Dist: uvicorn
Requires-Dist: typer
Requires-Dist: opentelemetry-api
Requires-Dist: opentelemetry-sdk
Requires-Dist: opentelemetry-instrumentation-fastapi
Requires-Dist: opentelemetry-exporter-otlp

# garf exporter - Prometheus exporter for garf.

[![PyPI](https://img.shields.io/pypi/v/garf-exporter?logo=pypi&logoColor=white&style=flat-square)](https://pypi.org/project/garf-exporter)
[![Downloads PyPI](https://img.shields.io/pypi/dw/garf-exporter?logo=pypi)](https://pypi.org/project/garf-exporter/)

`garf-exporter` allows you to transform responses from APIs into metrics consumable for by Prometheus.
Simply define a config file with garf queries and run a single `garf-exporter` command to start exporting in no time!


## Installation


```bash
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.

```yaml
- title: test
  query: |
    SELECT
      dimension,
      metric,
      metric_clicks,
      campaign
    FROM resource
```

> 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.

```bash
garf-exporter --source API_SOURCE -c config.yaml
```

Once `garf-exporter` is running you can see exposed metrics at `localhost:8000/metrics`.

### Customization

* `--config` - path to `garf_exporter.yaml`, can be taken from local or remote file.
* `--expose-type` - type of exposition (`http` or `pushgateway`, `http` is used by default)
* `--host` - address of your http server (`localhost` by default)
* `--port` - port of your http server (`8000` by default)
* `--delay-minutes` - delay in minutes between scrapings (`15` by default)

## Documentation

Explore full documentation on using `garf-exporter`

* [Documentation](https://google.github.io/garf/usage/exporters.md)
