mirror of
https://github.com/nikdoof/hg612-exporter.git
synced 2025-12-13 18:22:15 +00:00
chore: gofmt/goimports
This commit is contained in:
@@ -2,10 +2,12 @@ package metrics
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"github.com/jakekeeys/hg612-exporter/pkg/hg612"
|
"time"
|
||||||
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
"time"
|
|
||||||
|
"github.com/jakekeeys/hg612-exporter/pkg/hg612"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Collector interface {
|
type Collector interface {
|
||||||
@@ -33,7 +35,6 @@ func (c MetricsCollector) Collect() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Error(errors.Wrap(err, "error collecting dsl metrics"))
|
logrus.Error(errors.Wrap(err, "error collecting dsl metrics"))
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c MetricsCollector) Start() {
|
func (c MetricsCollector) Start() {
|
||||||
|
|||||||
@@ -1,15 +1,16 @@
|
|||||||
package metrics
|
package metrics
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/jakekeeys/hg612-exporter/pkg/hg612"
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/prometheus/client_golang/prometheus"
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
"github.com/prometheus/client_golang/prometheus/promauto"
|
"github.com/prometheus/client_golang/prometheus/promauto"
|
||||||
|
|
||||||
|
"github.com/jakekeeys/hg612-exporter/pkg/hg612"
|
||||||
)
|
)
|
||||||
|
|
||||||
type dslMetricsCollector struct {
|
type dslMetricsCollector struct {
|
||||||
client hg612.Client
|
client hg612.Client
|
||||||
host string
|
host string
|
||||||
identifier string
|
identifier string
|
||||||
|
|
||||||
status *prometheus.GaugeVec
|
status *prometheus.GaugeVec
|
||||||
@@ -221,8 +222,8 @@ func newDSLMetricsCollector(client hg612.Client, host string, identifier string)
|
|||||||
)
|
)
|
||||||
|
|
||||||
return dslMetricsCollector{
|
return dslMetricsCollector{
|
||||||
client: client,
|
client: client,
|
||||||
host: host,
|
host: host,
|
||||||
identifier: identifier,
|
identifier: identifier,
|
||||||
|
|
||||||
status: status,
|
status: status,
|
||||||
|
|||||||
11
main.go
11
main.go
@@ -2,21 +2,22 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/jakekeeys/hg612-exporter/internal/metrics"
|
|
||||||
"github.com/jakekeeys/hg612-exporter/internal/rest"
|
|
||||||
"github.com/jakekeeys/hg612-exporter/pkg/hg612"
|
|
||||||
"github.com/sirupsen/logrus"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
|
"github.com/sirupsen/logrus"
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli/v2"
|
||||||
|
|
||||||
|
"github.com/jakekeeys/hg612-exporter/internal/metrics"
|
||||||
|
"github.com/jakekeeys/hg612-exporter/internal/rest"
|
||||||
|
"github.com/jakekeeys/hg612-exporter/pkg/hg612"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
app := &cli.App{
|
app := &cli.App{
|
||||||
Name: "hg612 prometheus exporter",
|
Name: "hg612 prometheus exporter",
|
||||||
Usage: "a metrics exporter for the hg612",
|
Usage: "a metrics exporter for the hg612",
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
|
|||||||
Reference in New Issue
Block a user