You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 4, 2021. It is now read-only.
flag.StringVar(&cfg.database, "pg.database", "postgres", "The PostgreSQL database")
51
51
flag.StringVar(&cfg.schema, "pg.schema", "", "The PostgreSQL schema")
52
52
flag.StringVar(&cfg.sslMode, "pg.ssl-mode", "disable", "The PostgreSQL connection ssl mode")
53
-
flag.StringVar(&cfg.table, "pg.table", "metrics", "The PostgreSQL table")
54
-
flag.StringVar(&cfg.copyTable, "pg.copy-table", "", "The PostgreSQL table")
53
+
flag.StringVar(&cfg.table, "pg.table", "metrics", "Override prefix for internal tables. It is also a view name used for querying")
54
+
flag.StringVar(&cfg.copyTable, "pg.copy-table", "", "Override default table to COPY data to")
55
55
flag.IntVar(&cfg.maxOpenConns, "pg.max-open-conns", 50, "The max number of open connections to the database")
56
56
flag.IntVar(&cfg.maxIdleConns, "pg.max-idle-conns", 10, "The max number of idle connections to the database")
57
57
flag.BoolVar(&cfg.pgPrometheusNormalize, "pg.prometheus-normalized-schema", true, "Insert metric samples into normalized schema")
@@ -68,10 +68,12 @@ type Client struct {
68
68
cfg*Config
69
69
}
70
70
71
-
constsqlCreateTmpTable="CREATE TEMPORARY TABLE IF NOT EXISTS %s_tmp(sample prom_sample) ON COMMIT DELETE ROWS;"
72
-
constsqlCopyTable="COPY \"%s\" FROM STDIN"
73
-
constsqlInsertLabels="INSERT INTO %s_labels (metric_name, labels) SELECT prom_name(tmp.sample), prom_labels(tmp.sample) FROM %s_tmp tmp ON CONFLICT (metric_name, labels) DO NOTHING;"
74
-
constsqlInsertValues="INSERT INTO %s_values SELECT tmp.prom_time, tmp.prom_value, l.id FROM (SELECT prom_time(sample), prom_value(sample), prom_name(sample), prom_labels(sample) FROM %s_tmp) tmp INNER JOIN %s_labels l on tmp.prom_name=l.metric_name AND tmp.prom_labels=l.labels;"
71
+
const (
72
+
sqlCreateTmpTable="CREATE TEMPORARY TABLE IF NOT EXISTS %s_tmp(sample prom_sample) ON COMMIT DELETE ROWS;"
73
+
sqlCopyTable="COPY \"%s\" FROM STDIN"
74
+
sqlInsertLabels="INSERT INTO %s_labels (metric_name, labels) SELECT prom_name(tmp.sample), prom_labels(tmp.sample) FROM %s_tmp tmp ON CONFLICT (metric_name, labels) DO NOTHING;"
75
+
sqlInsertValues="INSERT INTO %s_values SELECT tmp.prom_time, tmp.prom_value, l.id FROM (SELECT prom_time(sample), prom_value(sample), prom_name(sample), prom_labels(sample) FROM %s_tmp) tmp INNER JOIN %s_labels l on tmp.prom_name=l.metric_name AND tmp.prom_labels=l.labels;"
0 commit comments