Skip to content

Commit

Permalink
Removing go-kit/metrics/provider to save us from dependency overload (#…
Browse files Browse the repository at this point in the history
…177)

* removing go-kit/metrics/provider to save us from dependency overload

* comment styling

* setting prom-specific configs for better latency charts
  • Loading branch information
jprobinson committed Feb 5, 2019
1 parent 27bac81 commit 30c33e4
Show file tree
Hide file tree
Showing 10 changed files with 184 additions and 776 deletions.
110 changes: 0 additions & 110 deletions config/metrics/metrics.go

This file was deleted.

12 changes: 0 additions & 12 deletions examples/pubsub/sqs-sub/service/sub.go
Expand Up @@ -9,12 +9,10 @@ import (
"syscall"

"github.com/NYTimes/gizmo/config"
cmetrics "github.com/NYTimes/gizmo/config/metrics"
"github.com/NYTimes/gizmo/examples/nyt"
"github.com/NYTimes/gizmo/pubsub"
"github.com/NYTimes/gizmo/pubsub/aws"
"github.com/NYTimes/logrotate"
"github.com/go-kit/kit/metrics/provider"
"github.com/golang/protobuf/proto"
"github.com/sirupsen/logrus"
)
Expand All @@ -24,8 +22,6 @@ var (

sub pubsub.Subscriber

metrics provider.Provider

client nyt.Client

articles []nyt.SemanticConceptArticle
Expand All @@ -35,7 +31,6 @@ type Config struct {
MostPopularToken string
SemanticToken string
Log *string
Metrics cmetrics.Config
SQS aws.SQSConfig
}

Expand All @@ -58,8 +53,6 @@ func Init() {
pubsub.Log = Log

var err error
cfg.Metrics.Prefix = metricsNamespace()
metrics = cfg.Metrics.NewProvider()
client = nyt.NewClient(cfg.MostPopularToken, cfg.SemanticToken)

sub, err = aws.NewSubscriber(cfg.SQS)
Expand All @@ -71,9 +64,6 @@ func Init() {
func Run() (err error) {
stream := sub.Start()

totalMsgsConsumed := metrics.NewCounter("total-consumed")
errorCount := metrics.NewCounter("error-count")

go func() {
ch := make(chan os.Signal, 1)
signal.Notify(ch, syscall.SIGTERM, syscall.SIGINT)
Expand All @@ -83,11 +73,9 @@ func Run() (err error) {

var article nyt.SemanticConceptArticle
for msg := range stream {
totalMsgsConsumed.Add(1)

if err = proto.Unmarshal(msg.Message(), &article); err != nil {
Log.Error("unable to unmarshal article from SQS: ", err)
errorCount.Add(1)
if err = msg.Done(); err != nil {
Log.Error("unable to delete message from SQS: ", err)
}
Expand Down
2 changes: 0 additions & 2 deletions examples/pubsub/sqs-sub/service/sub_test.go
Expand Up @@ -6,7 +6,6 @@ import (

"github.com/NYTimes/gizmo/pubsub"
"github.com/NYTimes/gizmo/pubsub/pubsubtest"
"github.com/go-kit/kit/metrics/provider"
"github.com/golang/protobuf/proto"

"github.com/NYTimes/gizmo/examples/nyt"
Expand Down Expand Up @@ -45,7 +44,6 @@ func TestRun(t *testing.T) {

// set test env
sub = test.givenSub
metrics = provider.NewDiscardProvider()

Run()

Expand Down
49 changes: 21 additions & 28 deletions go.mod
@@ -1,16 +1,18 @@
module github.com/NYTimes/gizmo

require (
cloud.google.com/go v0.33.1
contrib.go.opencensus.io/exporter/stackdriver v0.8.0
cloud.google.com/go v0.35.1
contrib.go.opencensus.io/exporter/ocagent v0.4.3 // indirect
contrib.go.opencensus.io/exporter/stackdriver v0.9.1
github.com/DataDog/zstd v1.3.5 // indirect
github.com/NYTimes/gziphandler v1.0.1
github.com/NYTimes/logrotate v0.0.0-20170824154650-2b6e866fd507
github.com/NYTimes/sqliface v0.0.0-20180310195202-f8e6c8b78d37
github.com/Shopify/sarama v1.19.0
github.com/Shopify/toxiproxy v2.1.3+incompatible // indirect
github.com/VividCortex/gohistogram v1.0.0 // indirect
github.com/aws/aws-sdk-go v1.15.83
github.com/Shopify/sarama v1.20.1
github.com/Shopify/toxiproxy v2.1.4+incompatible // indirect
github.com/aws/aws-sdk-go v1.16.26
github.com/bradfitz/gomemcache v0.0.0-20180710155616-bc664df96737
github.com/census-instrumentation/opencensus-proto v0.1.0 // indirect
github.com/eapache/go-resiliency v1.1.0 // indirect
github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21 // indirect
github.com/eapache/queue v1.1.0 // indirect
Expand All @@ -19,35 +21,26 @@ require (
github.com/go-sql-driver/mysql v1.4.1
github.com/go-stack/stack v1.8.0 // indirect
github.com/golang/protobuf v1.2.0
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db // indirect
github.com/google/go-cmp v0.2.0
github.com/google/martian v2.1.0+incompatible // indirect
github.com/googleapis/gax-go v2.0.2+incompatible // indirect
github.com/gorilla/context v1.1.1
github.com/gorilla/handlers v1.4.0
github.com/gorilla/mux v1.6.2
github.com/gorilla/mux v1.7.0
github.com/gorilla/websocket v1.4.0
github.com/grpc-ecosystem/go-grpc-middleware v1.0.0
github.com/influxdata/influxdb v1.7.1 // indirect
github.com/influxdata/platform v0.0.0-20181127204756-e2959c61b782 // indirect
github.com/julienschmidt/httprouter v1.2.0
github.com/kelseyhightower/envconfig v1.3.0
github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d
github.com/pkg/errors v0.8.0
github.com/prometheus/client_golang v0.9.1
github.com/prometheus/common v0.0.0-20181126121408-4724e9255275 // indirect
github.com/prometheus/procfs v0.0.0-20181126161756-619930b0b471 // indirect
github.com/pierrec/lz4 v2.0.5+incompatible // indirect
github.com/pkg/errors v0.8.1
github.com/prometheus/client_golang v0.9.2
github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a // indirect
github.com/sirupsen/logrus v1.2.0
go.opencensus.io v0.18.0
golang.org/x/crypto v0.0.0-20181127143415-eb0de9b17e85 // indirect
golang.org/x/lint v0.0.0-20181217174547-8f45f776aaf1 // indirect
golang.org/x/net v0.0.0-20181114220301-adae6a3d119a
golang.org/x/oauth2 v0.0.0-20181120190819-8f65e3013eba
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f // indirect
golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b // indirect
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c // indirect
google.golang.org/api v0.0.0-20181127174356-0a71a4356c3f
google.golang.org/appengine v1.3.0 // indirect
google.golang.org/genproto v0.0.0-20181127195345-31ac5d88444a
google.golang.org/grpc v1.16.0
github.com/sirupsen/logrus v1.3.0
go.opencensus.io v0.19.0
golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9 // indirect
golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3
golang.org/x/oauth2 v0.0.0-20190130055435-99b60b757ec1
google.golang.org/api v0.1.0
google.golang.org/genproto v0.0.0-20190128161407-8ac453e89fca
google.golang.org/grpc v1.18.0
)

0 comments on commit 30c33e4

Please sign in to comment.