{"id":13564844,"url":"https://github.com/timescale/prometheus-postgresql-adapter","last_synced_at":"2025-04-03T21:31:59.242Z","repository":{"id":56543062,"uuid":"97645128","full_name":"timescale/prometheus-postgresql-adapter","owner":"timescale","description":"Use PostgreSQL as a remote storage database for Prometheus","archived":true,"fork":false,"pushed_at":"2020-11-01T17:32:25.000Z","size":144,"stargazers_count":336,"open_issues_count":35,"forks_count":66,"subscribers_count":19,"default_branch":"master","last_synced_at":"2024-11-16T09:15:54.615Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/timescale.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-07-18T21:22:31.000Z","updated_at":"2024-09-23T07:42:34.000Z","dependencies_parsed_at":"2022-08-15T20:40:25.726Z","dependency_job_id":null,"html_url":"https://github.com/timescale/prometheus-postgresql-adapter","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timescale%2Fprometheus-postgresql-adapter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timescale%2Fprometheus-postgresql-adapter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timescale%2Fprometheus-postgresql-adapter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timescale%2Fprometheus-postgresql-adapter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/timescale","download_url":"https://codeload.github.com/timescale/prometheus-postgresql-adapter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247083892,"owners_count":20880938,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-08-01T13:01:36.880Z","updated_at":"2025-04-03T21:31:58.896Z","avatar_url":"https://github.com/timescale.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# **NOTICE: THIS PROJECT HAS BEEN SUPERSEDED BY PROMSCALE**\n\nThis project has been superseded by [Promscale](https://github.com/timescale/Promscale). \nLike this project, Promscale allows easy storage of Prometheus metrics in TimescaleDB + Postgres, \nbut also offers: automatic partitioning, native compression (typically 95% storage savings), \nnative data retention policies, full SQL and PromQL, and more.\n\nYou can find the new project at [https://github.com/timescale/promscale](https://github.com/timescale/promscale) \nand more details can be found in our [design document](https://tsdb.co/prom-design-doc).\n\nThis project will continue only in maintenance mode.\n\n# Prometheus remote storage adapter for PostgreSQL\n\nWith this remote storage adapter, Prometheus can use PostgreSQL as a long-term store for time-series metrics.\n\nRelated packages to install:\n- [pg_prometheus extension for PostgreSQL](https://github.com/timescale/pg_prometheus) (required)\n- [TimescaleDB](https://github.com/timescale/timescaledb) (optional\nfor better performance and scalability)\n\n## Quick start\n\nYou can download pre-built binaries [here](https://github.com/timescale/prometheus-postgresql-adapter/releases)\n\n## Docker instructions\n\nA docker image for the prometheus-postgreSQL storage adapter is available\non Docker Hub at [timescale/prometheus-postgresql-adapter](https://hub.docker.com/r/timescale/prometheus-postgresql-adapter/).\n\nThe easiest way to use this image is in conjunction with the `pg_prometheus`\ndocker [image](https://hub.docker.com/r/timescale/pg_prometheus/) provided by Timescale.\nThis image packages PostgreSQL, `pg_prometheus`, and TimescaleDB together in one\ndocker image.\n\nTo run this image use:\n```\ndocker run --name pg_prometheus -d -e POSTGRES_PASSWORD=mypass -p 5432:5432 timescale/pg_prometheus:latest \\\n postgres -csynchronous_commit=off\n```\n\nThen, start the prometheus-postgreSQL storage adapter using:\n```\n docker run --name prometheus_postgresql_adapter --link pg_prometheus -d -p 9201:9201 \\\n timescale/prometheus-postgresql-adapter:latest \\\n -pg-host=pg_prometheus \\\n -pg-password=mypass \\\n -pg-prometheus-log-samples\n```\n\nFinally, you can start Prometheus with:\n```\ndocker run -p 9090:9090 --link prometheus_postgresql_adapter -v /path/to/prometheus.yml:/etc/prometheus/prometheus.yml \\\n       prom/prometheus\n```\n(a sample `prometheus.yml` file can be found in `sample-docker-prometheus.yml` in this repository).\n\n## Configuring Prometheus to use this remote storage adapter\n\nYou must tell prometheus to use this remote storage adapter by adding the\nfollowing lines to `prometheus.yml`:\n```\nremote_write:\n  - url: \"http://\u003cadapter-address\u003e:9201/write\"\nremote_read:\n  - url: \"http://\u003cadapter-address\u003e:9201/read\"\n```\n\n## Environment variables\n\nAll of the CLI flags are also available as environment variables, and begin with the prefix `TS_PROM`.\nFor example, the following mappings apply:\n\n```\n-adapter-send-timeout =\u003e TS_PROM_ADAPTER_SEND_TIMEOUT\n-leader-election-rest =\u003e TS_PROM_LEADER_ELECTION_REST\n-pg-host              =\u003e TS_PROM_PG_HOST\n-web-telemetry-path   =\u003e TS_PROM_WEB_TELEMETRY_PATH\n...\n```\n\nEach CLI flag and equivalent environment variable is also displayed on the help `prometheus-postgresql-adapter -h` command.\n\n## Configuring Prometheus to filter which metrics are sent\n\nYou can limit the metrics being sent to the adapter (and thus being stored in your long-term storage) by \nsetting up `write_relabel_configs` in Prometheus, via the `prometheus.yml` file.\nDoing this can reduce the amount of space used by your database and thus increase query performance. \n\nThe example below drops all metrics starting with the prefix `go_`, which matches Golang process information\nexposed by exporters like `node_exporter`:\n\n```\nremote_write:\n - url: \"http://prometheus_postgresql_adapter:9201/write\"\n   write_relabel_configs:\n      - source_labels: [__name__]\n        regex: 'go_.*'\n        action: drop\n```\n\nAdditional information about setting up relabel configs, the `source_labels` field, and the possible actions can be found in the [Prometheus Docs](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#remote_write).\n\n## Building\n\nBefore building, make sure the following prerequisites are installed:\n\n* [Go](https://golang.org/dl/)\n\nThen build as follows:\n\n```bash\n\n# Build binary\nmake\n```\n\n## Building new Docker images\n\n```bash\n\n# Build Docker image\nmake docker-image\n\n# Push to Docker registry (requires permission)\nmake docker-push ORGANIZATION=myorg\n```\n\n## Contributing\n\nWe welcome contributions to this adaptor, which like TimescaleDB is released under the Apache2 Open Source License.  The same [Contributors Agreement](//github.com/timescale/timescaledb/blob/master/CONTRIBUTING.md) applies; please sign the [Contributor License Agreement](https://cla-assistant.io/timescale/prometheus-postgresql-adapter) (CLA) if you're a new contributor.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimescale%2Fprometheus-postgresql-adapter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftimescale%2Fprometheus-postgresql-adapter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimescale%2Fprometheus-postgresql-adapter/lists"}