Documentation ¶
Index ¶
- Constants
- Variables
- func ReaderPoolAfterConnect(schemaLocker LockFunc) func(context.Context, *pgx.Conn) error
- func Validate(cfg *Config, lcfg limits.Config) error
- func WriterPoolAfterConnect(schemaLocker LockFunc, synchronousCommit bool) func(context.Context, *pgx.Conn) error
- type Client
- func (c *Client) Close()
- func (c *Client) HealthCheck() error
- func (c *Client) IngestMetrics(ctx context.Context, r *prompb.WriteRequest) (uint64, uint64, error)
- func (c *Client) IngestTraces(ctx context.Context, tr ptrace.Traces) error
- func (c *Client) InitPromQLEngine(cfg *query.Config) error
- func (c *Client) Inserter() ingestor.DBInserter
- func (c *Client) LabelsCacheCapacity() int
- func (c *Client) MaintenanceConnection() pgxconn.PgxConn
- func (c *Client) MetricNamesCacheCapacity() int
- func (c *Client) NumCachedLabels() int
- func (c *Client) NumCachedMetricNames() int
- func (c *Client) QueryEngine() *promql.Engine
- func (c *Client) Queryable() promql.Queryable
- func (c *Client) Read(ctx context.Context, req *prompb.ReadRequest) (*prompb.ReadResponse, error)
- func (c *Client) ReadOnlyConnection() pgxconn.PgxConn
- type Config
- type LockFunc
Constants ¶
View Source
const (
MinPoolSize = 2
)
Variables ¶
View Source
var (
DefaultApp = fmt.Sprintf("promscale@%s", version.Promscale)
)
Functions ¶
func ReaderPoolAfterConnect ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client sends Prometheus samples to TimescaleDB
func NewClient ¶
func NewClient(r prometheus.Registerer, cfg *Config, mt tenancy.Authorizer, schemaLocker LockFunc, readOnly bool) (*Client, error)
NewClient creates a new PostgreSQL client
func NewClientWithPool ¶
func NewClientWithPool(r prometheus.Registerer, cfg *Config, numCopiers int, writerPool, readerPool, maintPool *pgxpool.Pool, mt tenancy.Authorizer, readOnly bool) (*Client, error)
NewClientWithPool creates a new PostgreSQL client with an existing connection pool.
func (*Client) HealthCheck ¶
HealthCheck checks that the client is properly connected
func (*Client) IngestMetrics ¶
IngestMetrics writes the timeseries object into the DB
func (*Client) IngestTraces ¶
IngestTraces writes the traces object into the DB.
func (*Client) Inserter ¶
func (c *Client) Inserter() ingestor.DBInserter
func (*Client) LabelsCacheCapacity ¶
func (*Client) MaintenanceConnection ¶
func (*Client) MetricNamesCacheCapacity ¶
func (*Client) NumCachedLabels ¶
func (*Client) NumCachedMetricNames ¶
func (*Client) QueryEngine ¶
func (*Client) Queryable ¶
Queryable returns the Prometheus promql.Queryable interface that's running with the same underlying Querier as the Client.
func (*Client) Read ¶
func (c *Client) Read(ctx context.Context, req *prompb.ReadRequest) (*prompb.ReadResponse, error)
Read returns the promQL query results
func (*Client) ReadOnlyConnection ¶
type Config ¶
type Config struct { CacheConfig cache.Config AppName string Host string Port int User string Password string Database string SslMode string DbConnectionTimeout time.Duration IgnoreCompressedChunks bool MetricsAsyncAcks bool TracesAsyncAcks bool WriteConnections int WriterPoolSize int WriterSynchronousCommit bool ReaderPoolSize int MaintPoolSize int MaxConnections int UsesHA bool DbUri string EnableStatementsCache bool TracesBatchTimeout time.Duration TracesMaxBatchSize int TracesBatchWorkers int }
Config for the database.
func ParseFlags ¶
ParseFlags parses the configuration flags specific to PostgreSQL and TimescaleDB
func (*Config) GetConnectionStr ¶
GetConnectionStr returns a Postgres connection string
func (*Config) GetNumCopiers ¶
Click to show internal directories.
Click to hide internal directories.