Documentation ¶
Index ¶
- Constants
- Variables
- func BoolPtrToBool(ptr *bool) bool
- func CheckLabelSelectorMismatch(labels map[string]string, selectors []string) bool
- func CleanHTTPError(error error) error
- func FingerprintQuery(query string, filterQueryText string, trackActivityQuerySize int) (fp uint64)
- func FingerprintText(query string) (fp uint64)
- func HttpRedirectToApp(w http.ResponseWriter, r *http.Request)
- func Int32PtrToInt(ptr *int32) int32
- func IntPtrToInt(ptr *int64) int64
- func IsHeroku() bool
- func IsUtilityStmt(query string) ([]bool, error)
- func NormalizeQuery(query string, filterQueryText string, trackActivityQuerySize int) string
- func Reload() (reloadedPid int, err error)
- func SetupHttpHandlerDummy()
- func StringCustomTypePtrToString[T ~string](ptr *T) string
- func StringPtrToString(ptr *string) string
- func TimeFromStr(value string) (time.Time, error)
- func TimePtrToTime(ptr *time.Time) time.Time
- func TimePtrToUnixTimestamp(ptr *time.Time) int64
- type Logger
- func (logger *Logger) PrintError(format string, args ...interface{})
- func (logger *Logger) PrintInfo(format string, args ...interface{})
- func (logger *Logger) PrintVerbose(format string, args ...interface{})
- func (logger *Logger) PrintWarning(format string, args ...interface{})
- func (logger *Logger) WithPrefix(prefix string) *Logger
- func (logger *Logger) WithPrefixAndRememberErrors(prefix string) *Logger
- type TTLMap
- type Timestamp
Constants ¶
const CollectorNameAndVersion = "pganalyze-collector " + CollectorVersion
const CollectorVersion = "0.63.0"
const QueryTextCollector string = "<pganalyze-collector>"
QueryTextCollector - Query generated by the pganalyze collector itself.
const QueryTextInsufficientPrivs string = "<insufficient privilege>"
QueryTextInsufficientPrivs - We did not have permissions to read this query text.
const QueryTextTruncated string = "<truncated query>"
QueryTextTruncated - Query was unparsable and is exactly track_activity_query_size-1 long. Only applies to query text from pg_stat_activity. This can be mitigated by raising track_activity_query_size.
QueryTextUnavailable - We only have the pg_stat_statement queryid for this query, not the actual query text. This occurs when there is high churn on the pg_stat_statements data and the less frequent query text collection didn't contain the text anymore for a query ID we saw earlier. Can be mitigated by increasing pg_stat_statements.max.
const QueryTextUnparsable string = "<unparsable query>"
QueryTextUnparsable - Query was unparsable and we don't know why. This could be because of the pg_query parser not yet understanding the syntax of newer Postgres versions.
const TruncatedQueryMarker string = "/* truncated-query */ "
TruncatedQueryMarker - Added to queries that were truncated and caused a parsing error, but we were able to "fix" to allow grouping in the UI
Variables ¶
var K8sSelectorRegexp = regexp.MustCompile(`\s*([^!=\s]+)\s*(=|==|!=)\s*([^!=\s]+)\s*`)
Functions ¶
func BoolPtrToBool ¶
func CheckLabelSelectorMismatch ¶ added in v0.57.0
CheckLabelSelectorMismatch checks if selectors do not match the given labels It uses Kubernetes Label selectors with Equality-based requirement: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors
func CleanHTTPError ¶ added in v0.41.0
Removes duplicate URLs added by retryablehttp
func FingerprintQuery ¶
FingerprintQuery - Generates a unique fingerprint for the given query
func FingerprintText ¶ added in v0.42.1
FingerprintText - Generates a fingerprint for static texts (used for error scenarios)
func HttpRedirectToApp ¶ added in v0.43.0
func HttpRedirectToApp(w http.ResponseWriter, r *http.Request)
HttpRedirectToApp - Provides a HTTP redirect to the pganalyze app
func Int32PtrToInt ¶ added in v0.59.0
func IntPtrToInt ¶
func IsUtilityStmt ¶
IsUtilityStmt determines whether each statement in the query text is a utility statement or a standard SELECT/INSERT/UPDATE/DELETE statement.
func NormalizeQuery ¶
NormalizeQuery - Normalizes the query text with an improved variant of the pg_stat_statements normalization logic.
func SetupHttpHandlerDummy ¶ added in v0.43.0
func SetupHttpHandlerDummy()
func StringCustomTypePtrToString ¶ added in v0.59.0
func StringPtrToString ¶
func TimeFromStr ¶ added in v0.52.3
TimeFromStr returns a time of the given value in string. The value is the value of time either as a floating point number of seconds since the Epoch, or it can also be a integer number of seconds.
func TimePtrToUnixTimestamp ¶
Types ¶
type Logger ¶
type Logger struct { Verbose bool Quiet bool Prefix *string Destination *log.Logger RememberErrors bool ErrorMessages []string UseJSON bool // if true, emit newline delimited JSON }