Skip to content

Commit

Permalink
Fixed revive warning
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikhail Grigorev committed Oct 29, 2024
1 parent 47e69a0 commit dcd6509
Show file tree
Hide file tree
Showing 52 changed files with 183 additions and 88 deletions.
1 change: 1 addition & 0 deletions cmd/pgscv.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package main is a pgSCV main package
package main

import (
Expand Down
1 change: 1 addition & 0 deletions internal/collector/collector.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package collector is a pgSCV collectors
package collector

import (
Expand Down
10 changes: 6 additions & 4 deletions internal/collector/collector_common.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
// Package collector is a pgSCV collectors
package collector

import (
"database/sql"
"github.com/jackc/pgx/v4"
"regexp"
"strconv"
"strings"

"github.com/cherts/pgscv/internal/filter"
"github.com/cherts/pgscv/internal/log"
"github.com/cherts/pgscv/internal/model"
"github.com/cherts/pgscv/internal/store"
"github.com/jackc/pgx/v4"
"github.com/prometheus/client_golang/prometheus"
"regexp"
"strconv"
"strings"
)

// labels is a local wrapper over prometheus.Labels which is a simple map[string]string.
Expand Down
1 change: 1 addition & 0 deletions internal/collector/config.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package collector is a pgSCV collectors
package collector

import (
Expand Down
4 changes: 3 additions & 1 deletion internal/collector/filesystem_common.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
// Package collector is a pgSCV collectors
package collector

import (
"bufio"
"fmt"
"github.com/cherts/pgscv/internal/log"
"io"
"os"
"strings"

"github.com/cherts/pgscv/internal/log"
)

// mount describes properties of mounted filesystems
Expand Down
8 changes: 5 additions & 3 deletions internal/collector/linux_cpu.go
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
// Package collector is a pgSCV collectors
package collector

import (
"bufio"
"bytes"
"fmt"
"github.com/cherts/pgscv/internal/log"
"github.com/cherts/pgscv/internal/model"
"github.com/prometheus/client_golang/prometheus"
"io"
"os"
"os/exec"
"path/filepath"
"strconv"
"strings"

"github.com/cherts/pgscv/internal/log"
"github.com/cherts/pgscv/internal/model"
"github.com/prometheus/client_golang/prometheus"
)

type cpuCollector struct {
Expand Down
10 changes: 6 additions & 4 deletions internal/collector/linux_diskstats.go
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
// Package collector is a pgSCV collectors
package collector

import (
"bufio"
"bytes"
"fmt"
"github.com/cherts/pgscv/internal/filter"
"github.com/cherts/pgscv/internal/log"
"github.com/cherts/pgscv/internal/model"
"github.com/prometheus/client_golang/prometheus"
"io"
"os"
"path/filepath"
"regexp"
"strconv"
"strings"

"github.com/cherts/pgscv/internal/filter"
"github.com/cherts/pgscv/internal/log"
"github.com/cherts/pgscv/internal/model"
"github.com/prometheus/client_golang/prometheus"
)

const (
Expand Down
10 changes: 6 additions & 4 deletions internal/collector/linux_filesystem.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
// Package collector is a pgSCV collectors
package collector

import (
"errors"
"fmt"
"github.com/cherts/pgscv/internal/filter"
"github.com/cherts/pgscv/internal/log"
"github.com/cherts/pgscv/internal/model"
"github.com/prometheus/client_golang/prometheus"
"io"
"os"
"syscall"
"time"

"github.com/cherts/pgscv/internal/filter"
"github.com/cherts/pgscv/internal/log"
"github.com/cherts/pgscv/internal/model"
"github.com/prometheus/client_golang/prometheus"
)

var (
Expand Down
8 changes: 5 additions & 3 deletions internal/collector/linux_load_average.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
// Package collector is a pgSCV collectors
package collector

import (
"fmt"
"github.com/cherts/pgscv/internal/log"
"github.com/cherts/pgscv/internal/model"
"github.com/prometheus/client_golang/prometheus"
"os"
"strconv"
"strings"

"github.com/cherts/pgscv/internal/log"
"github.com/cherts/pgscv/internal/model"
"github.com/prometheus/client_golang/prometheus"
)

type loadaverageCollector struct {
Expand Down
10 changes: 6 additions & 4 deletions internal/collector/linux_memory.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
// Package collector is a pgSCV collectors
package collector

import (
"bufio"
"fmt"
"github.com/cherts/pgscv/internal/filter"
"github.com/cherts/pgscv/internal/log"
"github.com/cherts/pgscv/internal/model"
"github.com/prometheus/client_golang/prometheus"
"io"
"os"
"regexp"
"strconv"
"strings"

"github.com/cherts/pgscv/internal/filter"
"github.com/cherts/pgscv/internal/log"
"github.com/cherts/pgscv/internal/model"
"github.com/prometheus/client_golang/prometheus"
)

type meminfoCollector struct {
Expand Down
10 changes: 6 additions & 4 deletions internal/collector/linux_netdev.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
// Package collector is a pgSCV collectors
package collector

import (
"bufio"
"fmt"
"github.com/cherts/pgscv/internal/filter"
"github.com/cherts/pgscv/internal/log"
"github.com/cherts/pgscv/internal/model"
"github.com/prometheus/client_golang/prometheus"
"io"
"os"
"strconv"
"strings"

"github.com/cherts/pgscv/internal/filter"
"github.com/cherts/pgscv/internal/log"
"github.com/cherts/pgscv/internal/model"
"github.com/prometheus/client_golang/prometheus"
)

type netdevCollector struct {
Expand Down
7 changes: 5 additions & 2 deletions internal/collector/linux_network.go
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
// Package collector is a pgSCV collectors
package collector

import (
"fmt"
"net"
"strings"

"github.com/cherts/pgscv/internal/log"
"github.com/cherts/pgscv/internal/model"
"github.com/prometheus/client_golang/prometheus"
"net"
"strings"
)

type networkCollector struct {
privateAddresses typedDesc
publicAddresses typedDesc
}

// NewNetworkCollector returns a new Collector exposing network interfaces addresses.
func NewNetworkCollector(constLabels labels, settings model.CollectorSettings) (Collector, error) {
return &networkCollector{
publicAddresses: newBuiltinTypedDesc(
Expand Down
10 changes: 6 additions & 4 deletions internal/collector/linux_sysconfig.go
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
// Package collector is a pgSCV collectors
package collector

import (
"bufio"
"bytes"
"fmt"
"github.com/cherts/pgscv/internal/log"
"github.com/cherts/pgscv/internal/model"
"github.com/prometheus/client_golang/prometheus"
"io"
"os"
"path"
"path/filepath"
"regexp"
"strconv"
"strings"

"github.com/cherts/pgscv/internal/log"
"github.com/cherts/pgscv/internal/model"
"github.com/prometheus/client_golang/prometheus"
)

type systemCollector struct {
Expand All @@ -27,7 +29,7 @@ type systemCollector struct {
btime typedDesc
}

// NewSystemCollector returns a new Collector exposing system-wide stats.
// NewSysconfigCollector returns a new Collector exposing system-wide stats.
func NewSysconfigCollector(constLabels labels, settings model.CollectorSettings) (Collector, error) {
return &systemCollector{
sysctlList: []string{
Expand Down
8 changes: 5 additions & 3 deletions internal/collector/linux_sysinfo.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
// Package collector is a pgSCV collectors
package collector

import (
"bufio"
"fmt"
"github.com/cherts/pgscv/internal/log"
"github.com/cherts/pgscv/internal/model"
"github.com/prometheus/client_golang/prometheus"
"io"
"os"
"path/filepath"
"strings"

"github.com/cherts/pgscv/internal/log"
"github.com/cherts/pgscv/internal/model"
"github.com/prometheus/client_golang/prometheus"
)

type sysinfoCollector struct {
Expand Down
1 change: 1 addition & 0 deletions internal/collector/patroni_common.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package collector is a pgSCV collectors
package collector

import (
Expand Down
6 changes: 4 additions & 2 deletions internal/collector/pgbouncer_pools.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
// Package collector is a pgSCV collectors
package collector

import (
"strconv"
"strings"

"github.com/cherts/pgscv/internal/log"
"github.com/cherts/pgscv/internal/model"
"github.com/cherts/pgscv/internal/store"
"github.com/prometheus/client_golang/prometheus"
"strconv"
"strings"
)

const (
Expand Down
12 changes: 7 additions & 5 deletions internal/collector/pgbouncer_settings.go
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
// Package collector is a pgSCV collectors
package collector

import (
"bufio"
"context"
"fmt"
"github.com/jackc/pgx/v4"
"github.com/cherts/pgscv/internal/log"
"github.com/cherts/pgscv/internal/model"
"github.com/cherts/pgscv/internal/store"
"github.com/prometheus/client_golang/prometheus"
"os"
"path/filepath"
"regexp"
"strconv"
"strings"

"github.com/cherts/pgscv/internal/log"
"github.com/cherts/pgscv/internal/model"
"github.com/cherts/pgscv/internal/store"
"github.com/jackc/pgx/v4"
"github.com/prometheus/client_golang/prometheus"
)

const (
Expand Down
4 changes: 3 additions & 1 deletion internal/collector/pgbouncer_stats.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
// Package collector is a pgSCV collectors
package collector

import (
"strconv"

"github.com/cherts/pgscv/internal/log"
"github.com/cherts/pgscv/internal/model"
"github.com/cherts/pgscv/internal/store"
"github.com/prometheus/client_golang/prometheus"
"strconv"
)

const pgbouncerStatsQuery = "SHOW STATS"
Expand Down
1 change: 1 addition & 0 deletions internal/collector/pgscv_services.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package collector is a pgSCV collectors
package collector

import (
Expand Down
12 changes: 7 additions & 5 deletions internal/collector/postgres_activity.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
// Package collector is a pgSCV collectors
package collector

import (
"context"
"regexp"
"strconv"
"strings"

"github.com/cherts/pgscv/internal/log"
"github.com/cherts/pgscv/internal/model"
"github.com/cherts/pgscv/internal/store"
"github.com/prometheus/client_golang/prometheus"
"regexp"
"strconv"
"strings"
)

const (
Expand Down Expand Up @@ -82,8 +84,8 @@ type postgresActivityCollector struct {

// NewPostgresActivityCollector returns a new Collector exposing postgres activity stats.
// For details see:
// 1. https://www.postgresql.org/docs/current/monitoring-stats.html#PG-STAT-ACTIVITY-VIEW
// 2. https://www.postgresql.org/docs/current/view-pg-prepared-xacts.html
// 1. https://www.postgresql.org/docs/current/monitoring-stats.html#PG-STAT-ACTIVITY-VIEW
// 2. https://www.postgresql.org/docs/current/view-pg-prepared-xacts.html
func NewPostgresActivityCollector(constLabels labels, settings model.CollectorSettings) (Collector, error) {
return &postgresActivityCollector{
up: newBuiltinTypedDesc(
Expand Down
4 changes: 3 additions & 1 deletion internal/collector/postgres_archiver.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
// Package collector is a pgSCV collectors
package collector

import (
"strconv"

"github.com/cherts/pgscv/internal/log"
"github.com/cherts/pgscv/internal/model"
"github.com/cherts/pgscv/internal/store"
"github.com/prometheus/client_golang/prometheus"
"strconv"
)

const walArchivingQuery = "SELECT archived_count, failed_count, " +
Expand Down
1 change: 1 addition & 0 deletions internal/collector/postgres_bgwriter.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package collector is a pgSCV collectors
package collector

import (
Expand Down
Loading

0 comments on commit dcd6509

Please sign in to comment.