collector

package
v0.0.0-...-3f388d4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 8, 2022 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

-------------------------------------------------------------------------

*
* polardb_pg_collector.go
*    Polardb pg metrics collector
*
*
* Copyright (c) 2021, Alibaba Group Holding Limited
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* IDENTIFICATION
*           plugins/polardb_pg_opensource/collector/polardb_pg_collector.go
*-------------------------------------------------------------------------

Index

Constants

View Source
const (
	PolarMinReleaseDate = int64(20190101)
	MinDBVersion        = -1 // means no limit
	MaxDBVersion        = -1 // means no limit
	CollectMinDBVersion = 90200
	CollectMaxDBVersion = MaxDBVersion
	DBConnTimeout       = 10
	DBQueryTimeout      = 60
	CollectTotalTimeout = 5
	DBPrepareTimeout    = 10
	DBBatchQueryTimeout = 60

	DefaultLocalDiskCollectInterval = 15
	DefaultPFSCollectInterval       = 1
	DBConfigCheckVersionInterval    = 5
	DefaultLCMForAllIntervals       = 60

	KEY_SEND_TO_MULTIBACKEND = "send_to_multibackend"
	KEY_MULTIDIMENSION       = "multidimension"
	KEY_SYS_INFO             = "sysinfo"

	DefaultCollectLongIntervalThreshold = 600
	MIN_TRACKLOG_TIME                   = 500

	DB_STAT_ROUTINE_KEY       = "dbstat"
	RESOURCE_STAT_ROUTINE_KEY = "resource"
	SYSINFO_ROUTINE_KEY       = "sysinfo"

	Splitter = "^^^"

	INTERNAL_MARK          = "/* rds internal mark */"
	SET_CLIENT_MIN_MESSAGE = "SET log_min_messages=FATAL"
)
View Source
const (
	All     = 0
	RW      = 1
	RO      = 2
	StandBy = 3
	DataMax = 4
	User    = 5
)

Variables

View Source
var DefaultCollectCycle int64
View Source
var EL_REG = regexp.MustCompile(`\\$\\{.*?\\}`)

Functions

func NormalizeColumn

func NormalizeColumn(name string) string

func PostProcessGroupBy

func PostProcessGroupBy(
	resultset []map[string]interface{}, info *SQLCollectInfo) ([]map[string]interface{}, error)

func PostProcessTop

func PostProcessTop(
	resultset []map[string]interface{}, info *SQLCollectInfo) ([]map[string]interface{}, error)

Types

type CollectorInfo

type CollectorInfo struct {
	// contains filtered or unexported fields
}

type DBInfo

type DBInfo struct {
	// contains filtered or unexported fields
}

type Dimension

type Dimension struct {
	// contains filtered or unexported fields
}

type DimensionPropertyType

type DimensionPropertyType int
const (
	Reserve DimensionPropertyType = iota
	Ignore
)

type Metric

type Metric struct {
	// contains filtered or unexported fields
}

type MetricPropertyType

type MetricPropertyType int
const (
	Top MetricPropertyType = iota
	Sum
)

type PolarDBPgCollector

type PolarDBPgCollector struct {
	DataDir          string
	Endpoint         string
	Port             int
	InsName          string
	InsId            int
	PhyInsId         int
	HostInsId        int
	HostInsIdStr     string
	HostInsIdStrList []string
	Role             string
	PolarVersion     string
	PolarReleaseDate string
	SystemIdentifier string
	UserName         string
	Database         string

	DbPath      string
	ClusterName string
	Envs        map[string]string
	ConfigMap   map[string]interface{}
	// contains filtered or unexported fields
}

func New

func New() *PolarDBPgCollector

func (*PolarDBPgCollector) Collect

func (c *PolarDBPgCollector) Collect(out map[string]interface{}) error

func (*PolarDBPgCollector) Init

func (c *PolarDBPgCollector) Init(m map[string]interface{}) error

func (*PolarDBPgCollector) Stop

func (c *PolarDBPgCollector) Stop() error

stop this collector, release resources

type PostProcess

type PostProcess func([]map[string]interface{}, *SQLCollectInfo) ([]map[string]interface{}, error)

type PreValue

type PreValue struct {
	LastTime int64
	Value    float64
}

type SQLCollectInfo

type SQLCollectInfo struct {
	// contains filtered or unexported fields
}

func ParseCols

func ParseCols(cols []*sql.ColumnType) (*SQLCollectInfo, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL