:goberserk: go fmt all the things
This commit is contained in:
parent
fb9a7ebb02
commit
0bf1933886
6 changed files with 34 additions and 33 deletions
|
@ -14,13 +14,13 @@
|
||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/spf13/cobra"
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
"github.com/davecgh/go-spew/spew"
|
"github.com/davecgh/go-spew/spew"
|
||||||
"github.com/gosuri/uitable"
|
"github.com/gosuri/uitable"
|
||||||
"fmt"
|
|
||||||
"time"
|
|
||||||
"encoding/json"
|
|
||||||
"github.com/hipages/php-fpm_exporter/phpfpm"
|
"github.com/hipages/php-fpm_exporter/phpfpm"
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Configuration variables
|
// Configuration variables
|
||||||
|
|
|
@ -17,11 +17,11 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
"github.com/hipages/php-fpm_exporter/phpfpm"
|
||||||
"github.com/mitchellh/go-homedir"
|
"github.com/mitchellh/go-homedir"
|
||||||
|
"github.com/sirupsen/logrus"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
"github.com/sirupsen/logrus"
|
|
||||||
"github.com/hipages/php-fpm_exporter/phpfpm"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var log = logrus.New()
|
var log = logrus.New()
|
||||||
|
|
|
@ -14,11 +14,11 @@
|
||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/spf13/cobra"
|
|
||||||
"github.com/prometheus/client_golang/prometheus"
|
|
||||||
"net/http"
|
|
||||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
|
||||||
"github.com/hipages/php-fpm_exporter/phpfpm"
|
"github.com/hipages/php-fpm_exporter/phpfpm"
|
||||||
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
|
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Configuration variables
|
// Configuration variables
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package phpfpm
|
package phpfpm
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"sync"
|
|
||||||
"github.com/prometheus/client_golang/prometheus"
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"sync"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
|
@ -14,14 +14,14 @@
|
||||||
package phpfpm
|
package phpfpm
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"net/url"
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
"github.com/tomasen/fcgi_client"
|
"github.com/tomasen/fcgi_client"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"encoding/json"
|
"net/url"
|
||||||
"time"
|
|
||||||
"fmt"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
"sync"
|
"sync"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
var log logger
|
var log logger
|
||||||
|
@ -39,7 +39,6 @@ type Pool struct {
|
||||||
// The address of the pool, e.g. tcp://127.0.0.1:9000 or unix:///tmp/php-fpm.sock
|
// The address of the pool, e.g. tcp://127.0.0.1:9000 or unix:///tmp/php-fpm.sock
|
||||||
Address string
|
Address string
|
||||||
CollectionError error
|
CollectionError error
|
||||||
|
|
||||||
Name string `json:"pool"`
|
Name string `json:"pool"`
|
||||||
ProcessManager string `json:"process manager"`
|
ProcessManager string `json:"process manager"`
|
||||||
StartTime Timestamp `json:"start time"`
|
StartTime Timestamp `json:"start time"`
|
||||||
|
@ -84,7 +83,7 @@ func (pm *PoolManager) Update() (err error) {
|
||||||
|
|
||||||
started := time.Now()
|
started := time.Now()
|
||||||
|
|
||||||
for idx, _ := range pm.pools {
|
for idx := range pm.pools {
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
go func(p *Pool) {
|
go func(p *Pool) {
|
||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
|
@ -107,7 +106,9 @@ func (pm *PoolManager) Pools() []Pool {
|
||||||
|
|
||||||
// Implement custom Marshaler due to "pools" being unexported
|
// Implement custom Marshaler due to "pools" being unexported
|
||||||
func (pm PoolManager) MarshalJSON() ([]byte, error) {
|
func (pm PoolManager) MarshalJSON() ([]byte, error) {
|
||||||
return json.Marshal(struct{Pools []Pool `json:"pools"` }{Pools: pm.pools})
|
return json.Marshal(struct {
|
||||||
|
Pools []Pool `json:"pools"`
|
||||||
|
}{Pools: pm.pools})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Pool) Update() (err error) {
|
func (p *Pool) Update() (err error) {
|
||||||
|
@ -151,7 +152,7 @@ func (p *Pool) Update() (err error) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Pool) error(err error) (error) {
|
func (p *Pool) error(err error) error {
|
||||||
p.CollectionError = err
|
p.CollectionError = err
|
||||||
log.Error(err)
|
log.Error(err)
|
||||||
return err
|
return err
|
||||||
|
|
Loading…
Reference in a new issue