Skip to content

Commit 98e5671

Browse files
authored
[+] add packages doc.go files (#623)
1 parent ccc769d commit 98e5671

File tree

13 files changed

+135
-11
lines changed

13 files changed

+135
-11
lines changed

api/doc.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// package api contains the API definitions for external use, such as the RPC sink.
2+
package api

cmd/convert_metrics/doc.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// convert_metrics is a tool that converts v2 metric definitions to v3 format.
2+
package main

cmd/pgwatch/doc.go

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
// pgwatch is a command line tool that collects metrics from PostgreSQL databases and forwards to external sinks.
2+
//
3+
// Usage:
4+
//
5+
// pgwatch [OPTIONS] [config | metric | source]
6+
//
7+
// Sources:
8+
//
9+
// -s, --sources= Postgres URI, file or folder of YAML
10+
// files containing info on which DBs
11+
// to monitor [$PW_SOURCES]
12+
// --refresh= How frequently to resync sources and
13+
// metrics (default: 120) [$PW_REFRESH]
14+
// -g, --group= Groups for filtering which databases
15+
// to monitor. By default all are
16+
// monitored [$PW_GROUP]
17+
// --min-db-size-mb= Smaller size DBs will be ignored and
18+
// not monitored until they reach the
19+
// threshold. (default: 0)
20+
// [$PW_MIN_DB_SIZE_MB]
21+
// --max-parallel-connections-per-db= Max parallel metric fetches per DB.
22+
// Note the multiplication effect on
23+
// multi-DB instances (default: 4)
24+
// [$PW_MAX_PARALLEL_CONNECTIONS_PER_DB]
25+
// --try-create-listed-exts-if-missing= Try creating the listed extensions
26+
// (comma sep.) on first connect for
27+
// all monitored DBs when missing. Main
28+
// usage - pg_stat_statements
29+
// [$PW_TRY_CREATE_LISTED_EXTS_IF_MISSING]
30+
//
31+
// Metrics:
32+
//
33+
// -m, --metrics= File or folder of YAML files with
34+
// metrics definitions [$PW_METRICS]
35+
// --create-helpers Create helper database objects from
36+
// metric definitions
37+
// [$PW_CREATE_HELPERS]
38+
// --direct-os-stats Extract OS related psutil statistics
39+
// not via PL/Python wrappers but
40+
// directly on host
41+
// [$PW_DIRECT_OS_STATS]
42+
// --instance-level-cache-max-seconds= Max allowed staleness for instance
43+
// level metric data shared between DBs
44+
// of an instance. Affects 'continuous'
45+
// host types only. Set to 0 to disable
46+
// (default: 30)
47+
// [$PW_INSTANCE_LEVEL_CACHE_MAX_SECONDS]
48+
// --emergency-pause-triggerfile= When the file exists no metrics will
49+
// be temporarily fetched / scraped
50+
// (default:
51+
// /tmp/pgwatch-emergency-pause)
52+
// [$PW_EMERGENCY_PAUSE_TRIGGERFILE]
53+
//
54+
// Sinks:
55+
//
56+
// --sink= URI where metrics will be stored,
57+
// can be used multiple times [$PW_SINK]
58+
// --batching-delay= Max milliseconds to wait for a
59+
// batched metrics flush. [Default:
60+
// 250ms] (default: 250ms)
61+
// [$PW_BATCHING_MAX_DELAY]
62+
// --retention= If set, metrics older than that will
63+
// be deleted (default: 14)
64+
// [$PW_RETENTION]
65+
// --real-dbname-field= Tag key for real database name
66+
// (default: real_dbname)
67+
// [$PW_REAL_DBNAME_FIELD]
68+
// --system-identifier-field= Tag key for system identifier value
69+
// (default: sys_id)
70+
// [$PW_SYSTEM_IDENTIFIER_FIELD]
71+
//
72+
// Logging:
73+
//
74+
// -v, --log-level=[debug|info|error] Verbosity level for stdout and log
75+
// file (default: info)
76+
// --log-file= File name to store logs
77+
// --log-file-format=[json|text] Format of file logs (default: json)
78+
// --log-file-rotate Rotate log files
79+
// --log-file-size= Maximum size in MB of the log file
80+
// before it gets rotated (default: 100)
81+
// --log-file-age= Number of days to retain old log
82+
// files, 0 means forever (default: 0)
83+
// --log-file-number= Maximum number of old log files to
84+
// retain, 0 to retain all (default: 0)
85+
//
86+
// WebUI:
87+
//
88+
// --web-disable=[all|ui] Disable REST API and/or web UI
89+
// [$PW_WEBDISABLE]
90+
// --web-addr= TCP address in the form 'host:port'
91+
// to listen on (default: :8080)
92+
// [$PW_WEBADDR]
93+
// --web-user= Admin login [$PW_WEBUSER]
94+
// --web-password= Admin password [$PW_WEBPASSWORD]
95+
//
96+
// Help Options:
97+
//
98+
// -h, --help Show this help message
99+
//
100+
// Available commands:
101+
//
102+
// config Manage configurations
103+
// init Initialize configuration
104+
// upgrade Upgrade configuration schema
105+
// metric Manage metrics
106+
// print-init Get and print init SQL for a given metric or preset
107+
// print-sql Get and print SQL for a given metric
108+
// source Manage sources
109+
// ping Try to connect to configured sources, report errors if any and exit
110+
package main

internal/cmdopts/doc.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// Package cmdopts provides functionality to parse command line options and ENV variables.
2+
package cmdopts

internal/db/doc.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// Package db provides common functionality to work with databases.
2+
package db

internal/log/doc.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// Package log contains the logger interface and its implementation used in the project.
2+
package log

internal/metrics/doc.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
// # Metrics
1+
// Package metrics is responsible for reading and writing metric definitions.
22
//
3-
// Code in this folder is responsible for reading and writing metric definitions.
43
// At the moment, metric definitions support two storages:
54
// - PostgreSQL database
65
// - YAML file

internal/metrics/psutil/doc.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// Package psutil provides a way to read local system metrics using the psutil library.
2+
package psutil

internal/reaper/doc.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// Package reaper is responsible to query the metrics from monitored sources
2+
// and send measurements to sinks.
3+
package reaper

internal/sinks/doc.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Package sinks provides functionality to store monitored data in different ways.
1+
// Package sinks rovides functionality to store monitored data in different ways.
22
//
33
// At the moment we provide sink connectors for
44
// - PostgreSQL and flavours,

0 commit comments

Comments
 (0)