{"id":16788112,"url":"https://github.com/bobbyiliev/materialize-sql-exporter-demo","last_synced_at":"2026-03-06T09:02:36.133Z","repository":{"id":113651149,"uuid":"592254153","full_name":"bobbyiliev/materialize-sql-exporter-demo","owner":"bobbyiliev","description":"Materialize + Prometheus SQL Exporter + Grafana","archived":false,"fork":false,"pushed_at":"2023-01-23T10:50:25.000Z","size":6,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-14T18:50:06.145Z","etag":null,"topics":["grafana","materialize","prometheus","sql","streaming-data"],"latest_commit_sha":null,"homepage":"https://materialize.com/docs","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bobbyiliev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-01-23T10:22:57.000Z","updated_at":"2024-04-24T07:37:40.000Z","dependencies_parsed_at":"2023-07-20T20:15:25.302Z","dependency_job_id":null,"html_url":"https://github.com/bobbyiliev/materialize-sql-exporter-demo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bobbyiliev/materialize-sql-exporter-demo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bobbyiliev%2Fmaterialize-sql-exporter-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bobbyiliev%2Fmaterialize-sql-exporter-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bobbyiliev%2Fmaterialize-sql-exporter-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bobbyiliev%2Fmaterialize-sql-exporter-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bobbyiliev","download_url":"https://codeload.github.com/bobbyiliev/materialize-sql-exporter-demo/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bobbyiliev%2Fmaterialize-sql-exporter-demo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30168608,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-06T07:56:45.623Z","status":"ssl_error","status_checked_at":"2026-03-06T07:55:55.621Z","response_time":250,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["grafana","materialize","prometheus","sql","streaming-data"],"created_at":"2024-10-13T08:16:56.860Z","updated_at":"2026-03-06T09:02:36.124Z","avatar_url":"https://github.com/bobbyiliev.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Materialize + Prometheus SQL Exporter + Grafana\n\nThis is a demo of how to use the [Prometheus SQL Exporter](https://github.com/justwatchcom/sql_exporter/) to export data from Materialize to Prometheus, and then use Grafana to visualize the data.\n\n![](https://imgur.com/JN2PVUz.png)\n\n## Overview\n\nThe demo consists of the following components:\n\n* A Materialize instance\n* A Prometheus instance\n* A Prometheus SQL Exporter instance\n* A Grafana instance\n\n## Prerequisites\n\n- [Docker](https://docs.docker.com/get-docker/)\n- [Docker Compose](https://docs.docker.com/compose/install/)\n- [Materialize instance](https://materialize.com/cloud/).\n\n## Running the demo\n\n- Start by cloning the repository:\n\n    ```bash\n    git clone TODO_URL\n    cd TODO_DIR\n    ```\n\n- Copy the `config.yml.example` file to `config.yml`:\n\n    ```bash\n    cp config.yml.example config.yml\n    ```\n\n- Edit the `config.yml` file and set your Materialize details under the connection section:\n\n    ```yaml\n      - \"postgres://YOUR_MATERIALIZE_USER:YOUR_MATERIALIZE_PASSWORD@YOUR_MATERIALIZE_HOST.materialize.cloud:6875/materialize\"\n    ```\n\n- Start the demo:\n\n    ```bash\n    docker-compose up -d\n    ```\n\n- Open Grafana at http://localhost:3000 and check out the `Materialize Example` dashboard.\n\n## Configuration overview\n\nThe `config.yml` file contains the configuration for the SQL exporter. In the `jobs` section, there are two main sections:\n\n- The `connections` section where you can configure the SQL exporter to connect to multiple Materialize instances:\n\n```yaml\njobs:\n- name: \"global\"\n  interval: '1m'\n  connections:\n  - \"postgres://YOUR_MATERIALIZE_USER:YOUR_MATERIALIZE_PASSWORD@YOUR_MATERIALIZE_HOST.materialize.cloud:6875/materialize\"\n```\n\nYou can change the interval at which the exporter queries Materialize by changing the `interval` value. The `connections` section contains the connection string for the Materialize instance.\n\n- The `queries` section where you can configure the SQL exporter to export metrics from Materialize:\n\n```yaml\n  queries:\n  - name: \"replica_memory_usage\"\n    help: \"Replica memory usage\"\n    labels:\n      - \"replica_name\"\n      - \"cluster_id\"\n    values:\n      - \"memory_percent\"\n    query:  |\n            SELECT\n              name::text as replica_name,\n              cluster_id::text as cluster_id,\n              memory_percent::float as memory_percent\n            FROM mz_cluster_replicas r join mz_internal.mz_cluster_replica_utilization u on r.id=u.replica_id;\n```\n\nThe `queries` section contains all the queries that the SQL exporter will run to export metrics from Materialize. Each query has the following fields:\n- **The name of the metric**: This is the name of the metric that will be exported to Prometheus\n- **The help text**: This is the text that will be displayed in the Grafana UI\n- **The labels to export**: These are the columns that will be used as labels in the exported metric\n- **The values to export**: These are the columns that will be used as values in the exported metric\n- **The query to run to get the data**: This is the SQL query that will be run to get the data for the metric\n\n\n\n## Adding extra SQL exporter checks\n\nTo configure the SQL exporter to export additional metrics, add a new entry to the `sql_exporter` section of the `config.yml` file. For example, to export the number of rows in the `orders` table, add the following:\n\n```yaml\nsql_exporter:\n- name: \"total_orders\"\n    help: \"Total Orders\"\n    values:\n    - \"count\"\n    query:  |\n            select count(*) from orders\n```\n\n## Helpful links\n\n- [Materialize](https://materialize.com/)\n- [Materialize internal schema](https://materialize.com/docs/sql/system-catalog/mz_internal/)\n- [Prometheus SQL Exporter](https://github.com/justwatchcom/sql_exporter/)\n- [Grafana](https://grafana.com/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbobbyiliev%2Fmaterialize-sql-exporter-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbobbyiliev%2Fmaterialize-sql-exporter-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbobbyiliev%2Fmaterialize-sql-exporter-demo/lists"}