

If not specified, default buckets are applied. Column names mustįor histogram metrics, a list of buckets for the metrics. Values for each label in addition to the metric value. If specified, queries updating the metric must return rows that include labels:Īn optional list of label names to apply to the metric. summary: each result from queries is added to observationsĭescription: an optional description of the metric.histogram: each result from queries is added to observations.gauge: value is set with each result from queries.enum: value is set with each result from queries.counter: value is incremented with each result from queries.The type of the metric, must be specified. Names, and must therefore be valid metric identifiers.Įach metric definition can have the following keys: type: This section contains Prometheus metrics definitions. When labels are used, all databases must define the same set of labels. labels: an optional mapping of label names and values to tag metrics collected from each database. This should only be changed to false if specific autocommit: whether to set autocommit for the database connection. With very long interval, to avoid holding idle connections. This option to false might be useful if queries on a database are run keep-connected: whether to keep the connection open for the database between queries, orĭisconnect after each one. This canīe used to set up connection-wise parameters and configurations. connect-sql: An optional list of queries to run right after database connection. These forms only support specifying the actual DNS in the string form. $CONNECTION_STRING) by setting dsn to: env:CONNECTION_STRINGįrom a file, containing only the DSN value, by setting dsn to: file:/path/to/file It’s also possible to get the connection string indirectly from other sources:įrom an environment variable (e.g.

See database-specific options page for some extra details on database URL-encoded, whereas this is done automatically for the key/value form.
#Prometheus postgres exporter password#
Note that in the string form, username, password and options need to be Options), or as key/value pairs: dialect : user : password : host : port : database : options : : : Īll entries are optional, except dialect. It can be provided as a string in the following format: SQLAlchemy documentation for details on available engines and Key names areĪrbitrary and only used to reference databases in the queries section.Įach database defintions can have the following keys: dsn: This section contains defintions for databases to connect to. A sample configuration file for the application looks like this: databases : db1 : dsn : sqlite:// connect-sql : - PRAGMA application_id = 123 - PRAGMA auto_vacuum = 1 labels : region : us1 app : app1 db2 : dsn : sqlite:// keep-connected : false labels : region : us2 app : app1 metrics : metric1 : type : gauge description : A sample gauge metric2 : type : summary description : A sample summary labels : expiration : 24h metric3 : type : histogram description : A sample histogram buckets : metric4 : type : enum description : A sample enum states : queries : query1 : interval : 5 databases : metrics : sql : SELECT random() / 1000000000000000 AS metric1 query2 : interval : 20 timeout : 0.5 databases : metrics : sql : | SELECT abs(random() / 1000000000000000) AS metric2, abs(random() / 10000000000000000) AS metric3, "value1" AS l1, "value2" AS l2 quer圓 : schedule : "*/5 * * * *" databases : metrics : sql : | SELECT value FROM ( SELECT "foo" AS metric4 UNION SELECT "bar" AS metric3 UNION SELECT "baz" AS metric4 ) ORDER BY random() LIMIT 1
