All Projects → CrunchyData → postgresql-prometheus-adapter

CrunchyData / postgresql-prometheus-adapter

Licence: Apache-2.0 license
Remote storage adapter enabling Prometheus to use PostgreSQL as a long-term store for time-series metrics.

Programming Languages

go
31211 projects - #10 most used programming language
shell
77523 projects
Makefile
30231 projects
Dockerfile
14818 projects

Projects that are alternatives of or similar to postgresql-prometheus-adapter

StockPriceGenerator
Python application to write stock security data to a MongoDB Cluster. Supports a variable amount of stocks, variable amount of time and can write to a MongoDB time-series collection
Stars: ✭ 21 (-64.41%)
Mutual labels:  timeseries
tsam
A python-based time series aggregation module (tsam) which can be used to reduce the number of time steps using typical periods or by decreasing the temporal resolution
Stars: ✭ 112 (+89.83%)
Mutual labels:  timeseries
ncdfgeom
NetCDF-CF Geometry and Timeseries Tools for R: https://code.usgs.gov/water/ncdfgeom
Stars: ✭ 13 (-77.97%)
Mutual labels:  timeseries
cortex-tenant
Prometheus remote write proxy that adds Cortex tenant ID based on metric labels
Stars: ✭ 60 (+1.69%)
Mutual labels:  timeseries
HydroSight
A flexible statistical toolbox for deriving quantitative insights from groundwater data.
Stars: ✭ 31 (-47.46%)
Mutual labels:  timeseries
DelayEmbeddings.jl
Delay coordinates embedding and Dataset definitions
Stars: ✭ 21 (-64.41%)
Mutual labels:  timeseries
timemachines
Predict time-series with one line of code.
Stars: ✭ 342 (+479.66%)
Mutual labels:  timeseries
tempo
API for manipulating time series on top of Apache Spark: lagged time values, rolling statistics (mean, avg, sum, count, etc), AS OF joins, downsampling, and interpolation
Stars: ✭ 212 (+259.32%)
Mutual labels:  timeseries
ARFIMA.jl
Simulate stochastic timeseries that follow ARFIMA, ARMA, ARIMA, AR, etc. processes
Stars: ✭ 44 (-25.42%)
Mutual labels:  timeseries
modeltime.ensemble
Time Series Ensemble Forecasting
Stars: ✭ 65 (+10.17%)
Mutual labels:  timeseries
chartjs-plugin-datasource-prometheus
Chart.js plugin for Prometheus data loading
Stars: ✭ 77 (+30.51%)
Mutual labels:  timeseries
sherlock
Sherlock is an anomaly detection service built on top of Druid
Stars: ✭ 137 (+132.2%)
Mutual labels:  timeseries
InfluxDB.Client.Net
A C# client object model to help integrate with InfluxDB with CLI languages. Supports both .Net traditional and .Net Core.
Stars: ✭ 95 (+61.02%)
Mutual labels:  timeseries
fhub
Python client for Finnhub API
Stars: ✭ 31 (-47.46%)
Mutual labels:  timeseries
MusicManipulations.jl
Manipulate music data, humanize, quantize and analyze music performances with Julia
Stars: ✭ 41 (-30.51%)
Mutual labels:  timeseries
influxdb-client-ruby
InfluxDB 2.0 Ruby Client
Stars: ✭ 30 (-49.15%)
Mutual labels:  timeseries
unitdb
Fast specialized time-series database for IoT, real-time internet connected devices and AI analytics.
Stars: ✭ 97 (+64.41%)
Mutual labels:  timeseries
grafana-redistimeseries
This project is deprecated in favor of https://github.com/RedisTimeSeries/grafana-redis-datasource
Stars: ✭ 19 (-67.8%)
Mutual labels:  timeseries
dtw-python
Python port of R's Comprehensive Dynamic Time Warp algorithms package
Stars: ✭ 139 (+135.59%)
Mutual labels:  timeseries
microprediction
If you can measure it, consider it predicted
Stars: ✭ 158 (+167.8%)
Mutual labels:  timeseries

PostgreSQL Prometheus Adapter

Remote storage adapter enabling Prometheus to use PostgreSQL as a long-term store for time-series metrics. Code is based on Prometheus - Remote storage adapter.

The PostgreSQL Prometheus Adapter is designed to utilize native partitioning enhancements available in recent versions of core PostgreSQL to efficiently store Prometheus time series data in a PostgreSQL database, and is not dependent on external PostgreSQL extensions.

The design is based on partitioning and threads. Incoming data is processed by one or more threads and one or more writer threads will store data in PostgreSQL daily or hourly partitions. Partitions will be auto-created by the adapter based on the timestamp of incoming data.

The PostgreSQL Prometheus Adapter accepts Prometheus remote read/write requests, and sends them to PostgreSQL.

Additional information regarding the adapter and getting started is provided below and available in this blog post introducing the PostgreSQL Prometheus Adapter.

PostgreSQL Version Support

PostgreSQL Prometheus Adapter supports:

  • PostgreSQL 14
  • PostgreSQL 13
  • PostgreSQL 12
  • PostgreSQL 11

Building

Compile

make

Make a container (optional)

make container

Running

Running adapter

export DATABASE_URL=...
./postgresql-prometheus-adapter

Database Connection

DATABASE_URL environment variable defines PostgreSQL connection string.

export DATABASE_URL=...
Default: None
Description: Database connection parameters
Ex: “user=<> password=<> host=<> port=<> database=<>

Adapter parameters

Following parameters can be used to tweak adapter behavior.

./postgresql-prometheus-adapter --help
usage: postgresql-prometheus-adapter [<flags>]

Remote storage adapter [ PostgreSQL ]

Flags:
  -h, --help                           Show context-sensitive help (also try --help-long and --help-man).
      --adapter-send-timeout=30s       The timeout to use when sending samples to the remote storage.
      --web-listen-address=":9201"     Address to listen on for web endpoints.
      --web-telemetry-path="/metrics"  Address to listen on for web endpoints.
      --log.level=info                 Only log messages with the given severity or above. One of: [debug, info, warn, error]
      --log.format=logfmt              Output format of log messages. One of: [logfmt, json]
      --pg-partition="hourly"          daily or hourly partitions, default: hourly
      --pg-commit-secs=15              Write data to database every N seconds
      --pg-commit-rows=20000           Write data to database every N Rows
      --pg-threads=1                   Writer DB threads to run 1-10
      --parser-threads=5               parser threads to run per DB writer 1-10

👉 Note: pg_commit_secs and pg_commit_rows controls when data rows will be flushed to database. First one to reach threshold will trigger the flush.

Container

Run container

podman run --rm \
  --name postgresql-prometheus-adapter \
  -p 9201:9201 \
  -e DATABASE_URL="user=testuser password=test123 host=192.168.12.36 port=5432 database=testdb" \
  --detach \
  crunchydata/postgresql-prometheus-adapterl:latest

Stop container

podman stop postgresql-prometheus-adapter

Adapter ENV

Following -e NAME:VALUE can be used to tweak adapter behavior.

adapter_send_timeout=30s       The timeout to use when sending samples to the remote storage.
web_listen_address=":9201"     Address to listen on for web endpoints.
web_telemetry_path="/metrics"  Address to listen on for web endpoints.
log_level=info                 Only log messages with the given severity or above. One of: [debug, info, warn, error]
log_format=logfmt              Output format of log messages. One of: [logfmt, json]
pg_partition="hourly"          daily or hourly partitions, default: hourly
pg_commit_secs=15              Write data to database every N seconds
pg_commit_rows=20000           Write data to database every N Rows
pg_threads=1                   Writer DB threads to run 1-10
parser_threads=5               parser threads to run per DB writer 1-10

👉 Note: pg_commit_secs and pg_commit_rows controls when data rows will be flushed to database. First one to reach threshold will trigger the flush.

Prometheus Configuration

Add the following to your prometheus.yml:

remote_write:
    - url: "http://<ip address>:9201/write"
remote_read:
    - url: "http://<ip address>:9201/read"

Maintainers

The PostgreSQL Prometheus Adapter is maintained by the team at Crunchy Data.

Contributing to the Project

Want to contribute to the PostgreSQL Prometheus Adapter? Great! Please use GitHub to submit an issue for the PostgreSQL Prometheus Adapter project. If you would like to work the issue, please add that information in the issue so that we can confirm we are not already working no need to duplicate efforts.

License

The PostgreSQL Prometheus Adapter is available under the Apache 2.0 license. See LICENSE for details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].