Skip to content

Commit

Permalink
Merge pull request #27 from chatwork/bump_go_and_library
Browse files Browse the repository at this point in the history
Bump go and library
  • Loading branch information
cw-sakamoto authored May 30, 2022
2 parents 54112a1 + 73d2b0f commit 5eaa284
Show file tree
Hide file tree
Showing 7 changed files with 331 additions and 245 deletions.
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ linters-settings:

run:
deadline: 1m
go: '1.15'
go: '1.18'

issues:
exclude:
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.15.4-alpine3.12 as build
FROM golang:1.18.2 as build

COPY ./ /go/src/github.com/chatwork/sendgrid-stats-exporter
WORKDIR /go/src/github.com/chatwork/sendgrid-stats-exporter
Expand All @@ -7,12 +7,12 @@ RUN go mod download \
# && go test ./... \
&& CGO_ENABLED=0 GOOS=linux go build -o /bin/exporter

FROM alpine:3.12
FROM alpine:3.15

RUN apk --no-cache add ca-certificates \
&& addgroup exporter \
&& adduser -S -G exporter exporter
USER exporter
COPY --from=build /bin/exporter /bin/exporter

ENTRYPOINT [ "/bin/exporter" ]
ENTRYPOINT [ "/bin/exporter" ]
6 changes: 3 additions & 3 deletions collect.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package main
import (
"time"

"github.com/go-kit/kit/log"
"github.com/go-kit/kit/log/level"
"github.com/prometheus/client_golang/prometheus"
"github.com/go-kit/log"
"github.com/go-kit/log/level"
"github.com/jinzhu/now"
"github.com/prometheus/client_golang/prometheus"
)

type Collector struct {
Expand Down
25 changes: 20 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,11 +1,26 @@
module github.com/chatwork/sendgrid-stats-exporter

go 1.15
go 1.18

require (
github.com/go-kit/kit v0.10.0
github.com/prometheus/client_golang v1.8.0
github.com/prometheus/common v0.14.0
github.com/go-kit/kit v0.12.0
github.com/jinzhu/now v1.1.5
github.com/prometheus/client_golang v1.12.2
github.com/prometheus/common v0.34.0
gopkg.in/alecthomas/kingpin.v2 v2.2.6
mvdan.cc/gofumpt v0.0.0-20201107090320-a024667a00f1 // indirect
)

require (
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 // indirect
github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/go-kit/log v0.2.0 // indirect
github.com/go-logfmt/logfmt v0.5.1 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/procfs v0.7.3 // indirect
golang.org/x/sys v0.0.0-20220114195835-da31bd327af9 // indirect
google.golang.org/protobuf v1.27.1 // indirect
)
525 changes: 298 additions & 227 deletions go.sum

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ package main

import (
"context"
"github.com/prometheus/client_golang/prometheus/collectors"
"net/http"
"os"
"os/signal"
"syscall"
"time"

"github.com/go-kit/kit/log/level"
"github.com/go-kit/log/level"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp"
"github.com/prometheus/common/promlog"
Expand Down Expand Up @@ -56,7 +57,6 @@ var (
"sendgrid.accumulated-metrics",
"[Optional] Accumulated SendGrid Metrics by month, to calculate monthly email limit.",
).Default("False").Envar("SENDGRID_ACCUMULATED_METRICS").Bool()

)

func main() {
Expand All @@ -75,13 +75,13 @@ func main() {

collector := collector(logger)
prometheus.MustRegister(collector)
prometheus.Unregister(prometheus.NewGoCollector())
prometheus.Unregister(collectors.NewGoCollector())
registry := prometheus.NewRegistry()

if !*disableExporterMetrics {
registry.MustRegister(
prometheus.NewProcessCollector(prometheus.ProcessCollectorOpts{}),
prometheus.NewGoCollector(),
collectors.NewProcessCollector(collectors.ProcessCollectorOpts{}),
collectors.NewGoCollector(),
)
}

Expand Down
2 changes: 1 addition & 1 deletion scripts/errcheck_excludes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
(net/http.ResponseWriter).Write

// Never check for logger errors.
(github.com/go-kit/kit/log.Logger).Log
(github.com/go-kit/log.Logger).Log

0 comments on commit 5eaa284

Please sign in to comment.