From 0427b4618540d4523d0c8c354686995c00227bde Mon Sep 17 00:00:00 2001 From: kpacha Date: Fri, 20 Apr 2018 20:53:02 +0200 Subject: [PATCH 01/15] dependencies updated --- Gopkg.lock | 100 ++++++++++++++++------------------------------------- Gopkg.toml | 12 ++----- 2 files changed, 31 insertions(+), 81 deletions(-) diff --git a/Gopkg.lock b/Gopkg.lock index df1ccac6..f1c718cd 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -1,24 +1,6 @@ # This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. -[[projects]] - name = "github.com/PuerkitoBio/goquery" - packages = ["."] - revision = "e1271ee34c6a305e38566ecd27ae374944907ee9" - version = "v1.1.0" - -[[projects]] - branch = "master" - name = "github.com/andybalholm/cascadia" - packages = ["."] - revision = "349dd0209470eabd9514242c688c403c0926d266" - -[[projects]] - name = "github.com/clbanning/mxj" - packages = ["."] - revision = "1cda74d18ebbb04f525b355309c16d594e1f8f77" - version = "v1.6.1" - [[projects]] name = "github.com/coreos/etcd" packages = [ @@ -37,6 +19,7 @@ version = "v0.2.0" [[projects]] + branch = "0.5-dev" name = "github.com/devopsfaith/krakend" packages = [ "config", @@ -44,14 +27,15 @@ "encoding", "logging", "proxy", + "register", + "register/internal", "router", "router/gin", "router/mux", "sd", "sd/dnssrv" ] - revision = "f7f27225f65abd50ae1ef168970649f8fab3fbf3" - version = "0.4.2" + revision = "5e350dfe07900b23ee541fc5bcbae4d610de0797" [[projects]] branch = "master" @@ -102,14 +86,14 @@ revision = "2757b21be9ac45e04bebee8feb7481f695d62b79" [[projects]] - branch = "master" + branch = "0.5-dev" name = "github.com/devopsfaith/krakend-metrics" packages = [ ".", "gin", "mux" ] - revision = "a7d7c2d6d320d1045f9fccd3cf692dfce4a3556a" + revision = "6a8158d15863f6c46e96470bf3794c71341b1528" [[projects]] branch = "master" @@ -129,24 +113,12 @@ ] revision = "407bf6926e70a985ee6b21a7bbcc2260b5c3c41a" -[[projects]] - branch = "master" - name = "github.com/devopsfaith/krakend-rss" - packages = ["."] - revision = "2c0f89d6735db2f22b05c6cef01d4a72f2e0f251" - [[projects]] branch = "master" name = "github.com/devopsfaith/krakend-viper" packages = ["."] revision = "3abc4134a773578643b46aa11431f72cc6d41e8a" -[[projects]] - branch = "master" - name = "github.com/devopsfaith/krakend-xml" - packages = ["."] - revision = "3b0341aed8c1eecbb59e58fdd5a392c21034731c" - [[projects]] name = "github.com/fsnotify/fsnotify" packages = ["."] @@ -219,12 +191,33 @@ revision = "76626ae9c91c4f2a10f34cad8ce83ea42c93bb75" version = "v1.0" +[[projects]] + name = "github.com/influxdata/influxdb" + packages = [ + "client", + "client/v2", + "models", + "pkg/escape" + ] + revision = "02d7d4f043b34ecb4e9b2dbec298c6f9450c2a32" + version = "v1.5.2" + [[projects]] branch = "master" name = "github.com/juju/ratelimit" packages = ["."] revision = "59fac5042749a5afb9af70e813da1dd5474f0167" +[[projects]] + branch = "master" + name = "github.com/letgoapp/krakend-influx" + packages = [ + ".", + "counter", + "gauge" + ] + revision = "2ad377d8da418ddacdc7bf4651b8aba332d1b97d" + [[projects]] name = "github.com/magiconair/properties" packages = ["."] @@ -243,24 +236,6 @@ packages = ["."] revision = "06020f85339e21b2478f756a78e295255ffa4d6a" -[[projects]] - name = "github.com/mmcdole/gofeed" - packages = [ - ".", - "atom", - "extensions", - "internal/shared", - "rss" - ] - revision = "303223474e837398b2f8a265e5572958bb5568c0" - version = "v1.0.0-beta" - -[[projects]] - branch = "master" - name = "github.com/mmcdole/goxpp" - packages = ["."] - revision = "77e4a51a73ed99ee3f33c1474dc166866304acbd" - [[projects]] name = "github.com/op/go-logging" packages = ["."] @@ -343,10 +318,7 @@ name = "golang.org/x/net" packages = [ "context", - "context/ctxhttp", - "html", - "html/atom", - "html/charset" + "context/ctxhttp" ] revision = "a8b9294777976932365dabb6640cf1468d95c70f" @@ -370,23 +342,9 @@ branch = "master" name = "golang.org/x/text" packages = [ - "encoding", - "encoding/charmap", - "encoding/htmlindex", - "encoding/internal", - "encoding/internal/identifier", - "encoding/japanese", - "encoding/korean", - "encoding/simplifiedchinese", - "encoding/traditionalchinese", - "encoding/unicode", "internal/gen", - "internal/tag", "internal/triegen", "internal/ucd", - "internal/utf8internal", - "language", - "runes", "transform", "unicode/cldr", "unicode/norm" @@ -422,6 +380,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "c9fab6dc84233853b3fe68f4d64d29dc88901fcd7075a205ee154980ff791478" + inputs-digest = "fa6b609b28b16058bdcc7ff3d7c46ceab689b96dc3721c73e66454efddf0500c" solver-name = "gps-cdcl" solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml index f9068566..0ffe834b 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -16,8 +16,8 @@ version = "1.2.0" [[constraint]] + branch = "0.5-dev" name = "github.com/devopsfaith/krakend" - version = "0.4.2" [[constraint]] branch = "master" @@ -48,7 +48,7 @@ name = "github.com/devopsfaith/krakend-martian" [[constraint]] - branch = "master" + branch = "0.5-dev" name = "github.com/devopsfaith/krakend-metrics" [[constraint]] @@ -59,14 +59,6 @@ branch = "master" name = "github.com/devopsfaith/krakend-ratelimit" -[[constraint]] - branch = "master" - name = "github.com/devopsfaith/krakend-rss" - [[constraint]] branch = "master" name = "github.com/devopsfaith/krakend-viper" - -[[constraint]] - branch = "master" - name = "github.com/devopsfaith/krakend-xml" From 66d041a061a750df287cafb539a3eab635aedbb3 Mon Sep 17 00:00:00 2001 From: kpacha Date: Fri, 20 Apr 2018 20:53:17 +0200 Subject: [PATCH 02/15] remove encoding modules until fixed --- encoding.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/encoding.go b/encoding.go index eb8f8ec4..18a1a54f 100644 --- a/encoding.go +++ b/encoding.go @@ -1,12 +1,12 @@ package main -import ( - "github.com/devopsfaith/krakend-rss" - "github.com/devopsfaith/krakend-xml" -) +// import ( +// "github.com/devopsfaith/krakend-rss" +// "github.com/devopsfaith/krakend-xml" +// ) // RegisterEncoders registers all the available encoders func RegisterEncoders() { - xml.Register() - rss.Register() + // xml.Register() + // rss.Register() } From bbfca3c5698f34ec638b683797cbcbd1b06f59bc Mon Sep 17 00:00:00 2001 From: kpacha Date: Fri, 20 Apr 2018 20:53:55 +0200 Subject: [PATCH 03/15] influx module added --- executor.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/executor.go b/executor.go index bd170d9e..16119bd9 100644 --- a/executor.go +++ b/executor.go @@ -12,6 +12,7 @@ import ( "github.com/devopsfaith/krakend/logging" router "github.com/devopsfaith/krakend/router/gin" "github.com/gin-gonic/gin" + "github.com/letgoapp/krakend-influx" ) func NewExecutor(ctx context.Context) cmd.Executor { @@ -31,6 +32,11 @@ func NewExecutor(ctx context.Context) cmd.Executor { // create the metrics collector metricCollector := metrics.New(ctx, time.Minute, logger) + if err := influxdb.New(ctx, cfg.ExtraConfig, metricCollector, logger); err != nil { + logger.Error(err.Error()) + return + } + // setup the krakend router routerFactory := router.NewFactory(router.Config{ Engine: NewEngine(cfg, logger, metricCollector), From 6906ddebc750e9c9e57437a631d1fc741b264827 Mon Sep 17 00:00:00 2001 From: kpacha Date: Wed, 25 Apr 2018 15:05:58 +0200 Subject: [PATCH 04/15] dependencies updated --- Gopkg.lock | 12 ++++++------ Gopkg.toml | 4 ++++ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Gopkg.lock b/Gopkg.lock index f1c718cd..296ccdb0 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -35,7 +35,7 @@ "sd", "sd/dnssrv" ] - revision = "5e350dfe07900b23ee541fc5bcbae4d610de0797" + revision = "ed0d73dcd173a5e34b9adb41db81217b32ea8bfd" [[projects]] branch = "master" @@ -93,7 +93,7 @@ "gin", "mux" ] - revision = "6a8158d15863f6c46e96470bf3794c71341b1528" + revision = "c6bc38ddbbc0e30efc78cdfeda079741c0d40264" [[projects]] branch = "master" @@ -194,7 +194,6 @@ [[projects]] name = "github.com/influxdata/influxdb" packages = [ - "client", "client/v2", "models", "pkg/escape" @@ -214,9 +213,10 @@ packages = [ ".", "counter", - "gauge" + "gauge", + "histogram" ] - revision = "2ad377d8da418ddacdc7bf4651b8aba332d1b97d" + revision = "b87584e771c2debeb7f99310bbe0edb3d249fe5b" [[projects]] name = "github.com/magiconair/properties" @@ -380,6 +380,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "fa6b609b28b16058bdcc7ff3d7c46ceab689b96dc3721c73e66454efddf0500c" + inputs-digest = "0a209c641e79a357e08ec5e62455f6a978739aadf46456727b1a6e8bd6521261" solver-name = "gps-cdcl" solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml index 0ffe834b..b16706b3 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -15,6 +15,10 @@ name = "github.com/gin-gonic/gin" version = "1.2.0" +[[constraint]] + branch = "master" + name = "github.com/letgoapp/krakend-influx" + [[constraint]] branch = "0.5-dev" name = "github.com/devopsfaith/krakend" From 781a13c3a3850c3cfde6178a015618b2bf7b5285 Mon Sep 17 00:00:00 2001 From: kpacha Date: Mon, 21 May 2018 20:23:34 +0200 Subject: [PATCH 05/15] opencensus component added --- Gopkg.lock | 120 ++++++++++++++++++++++++++++++++++++++++++++- Gopkg.toml | 4 ++ backend_factory.go | 10 ++-- executor.go | 10 +++- handler_factory.go | 2 + proxy_factory.go | 2 + 6 files changed, 140 insertions(+), 8 deletions(-) diff --git a/Gopkg.lock b/Gopkg.lock index 296ccdb0..67c8ad50 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -1,6 +1,19 @@ # This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. +[[projects]] + branch = "master" + name = "git.apache.org/thrift.git" + packages = ["lib/go/thrift"] + revision = "88591e32e710a0524327153c8b629d5b461e35e0" + source = "github.com/apache/thrift" + +[[projects]] + branch = "master" + name = "github.com/beorn7/perks" + packages = ["quantile"] + revision = "3a771d992973f24aa725d07868b467d1ddfceafb" + [[projects]] name = "github.com/coreos/etcd" packages = [ @@ -101,6 +114,19 @@ packages = ["."] revision = "401bac10b674c03508691b701fd6719e3e71ca4a" +[[projects]] + branch = "master" + name = "github.com/devopsfaith/krakend-opencensus" + packages = [ + ".", + "exporter/influxdb", + "exporter/jaeger", + "exporter/prometheus", + "exporter/zipkin", + "router/gin" + ] + revision = "0fbca20d515bde8001e505bb41d2af69523798af" + [[projects]] branch = "master" name = "github.com/devopsfaith/krakend-ratelimit" @@ -207,6 +233,12 @@ packages = ["."] revision = "59fac5042749a5afb9af70e813da1dd5474f0167" +[[projects]] + branch = "master" + name = "github.com/kpacha/opencensus-influxdb" + packages = ["."] + revision = "1b490a38de4c5c98e0414e4676aba2e00c5cfd45" + [[projects]] branch = "master" name = "github.com/letgoapp/krakend-influx" @@ -230,6 +262,12 @@ revision = "0360b2af4f38e8d38c7fce2a9f4e702702d73a39" version = "v0.0.3" +[[projects]] + name = "github.com/matttproud/golang_protobuf_extensions" + packages = ["pbutil"] + revision = "3247c84500bff8d9fb6d579d800f20b3e091582c" + version = "v1.0.0" + [[projects]] branch = "master" name = "github.com/mitchellh/mapstructure" @@ -241,12 +279,58 @@ packages = ["."] revision = "970db520ece77730c7e4724c61121037378659d9" +[[projects]] + name = "github.com/openzipkin/zipkin-go" + packages = [ + "model", + "reporter", + "reporter/http" + ] + revision = "f197ec29e729f226d23370ea60f0e49b8f44ccf4" + version = "v0.1.0" + [[projects]] name = "github.com/pelletier/go-toml" packages = ["."] revision = "16398bac157da96aa88f98a2df640c7f32af1da2" version = "v1.0.1" +[[projects]] + name = "github.com/prometheus/client_golang" + packages = [ + "prometheus", + "prometheus/promhttp" + ] + revision = "c5b7fccd204277076155f10851dad72b76a49317" + version = "v0.8.0" + +[[projects]] + branch = "master" + name = "github.com/prometheus/client_model" + packages = ["go"] + revision = "99fa1f4be8e564e8a6b613da7fa6f46c9edafc6c" + +[[projects]] + branch = "master" + name = "github.com/prometheus/common" + packages = [ + "expfmt", + "internal/bitbucket.org/ww/goautoneg", + "model" + ] + revision = "7600349dcfe1abd18d72d3a1770870d9800a7801" + +[[projects]] + branch = "master" + name = "github.com/prometheus/procfs" + packages = [ + ".", + "internal/util", + "nfs", + "xfs" + ] + revision = "8b1c2da0d56deffdbb9e48d4414b4e674bd8083e" + [[projects]] branch = "master" name = "github.com/rcrowley/go-metrics" @@ -313,6 +397,28 @@ packages = ["."] revision = "0f73fc7feba662a2ad5ff887fe203af08f8f8716" +[[projects]] + branch = "master" + name = "go.opencensus.io" + packages = [ + "exporter/jaeger", + "exporter/jaeger/internal/gen-go/jaeger", + "exporter/prometheus", + "exporter/zipkin", + "internal", + "internal/tagencoding", + "plugin/ochttp", + "plugin/ochttp/propagation/b3", + "stats", + "stats/internal", + "stats/view", + "tag", + "trace", + "trace/internal", + "trace/propagation" + ] + revision = "ebd8d31470fedf6c27d0e3056653ddff642509b8" + [[projects]] branch = "master" name = "golang.org/x/net" @@ -332,6 +438,12 @@ ] revision = "2f32c3ac0fa4fb807a0fcefb0b6f2468a0d99bd0" +[[projects]] + branch = "master" + name = "golang.org/x/sync" + packages = ["semaphore"] + revision = "1d60e4601c6fd243af51cc01ddf169918a5407ca" + [[projects]] branch = "master" name = "golang.org/x/sys" @@ -351,6 +463,12 @@ ] revision = "75cc3cad82b5f47d3fb229ddda8c5167da14f294" +[[projects]] + branch = "master" + name = "google.golang.org/api" + packages = ["support/bundler"] + revision = "4f7dd2b006a4ffd9fd683c1c734d2fe91ca0ea1c" + [[projects]] name = "google.golang.org/appengine" packages = [ @@ -380,6 +498,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "0a209c641e79a357e08ec5e62455f6a978739aadf46456727b1a6e8bd6521261" + inputs-digest = "847f165795d03c64d97dfa8eb6fb7e7a101bbc2437f95af305ad37d68b9f4791" solver-name = "gps-cdcl" solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml index b16706b3..b1ceaacf 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -66,3 +66,7 @@ [[constraint]] branch = "master" name = "github.com/devopsfaith/krakend-viper" + +[[constraint]] + branch = "master" + name = "github.com/devopsfaith/krakend-opencensus" diff --git a/backend_factory.go b/backend_factory.go index 6300e32c..3b8f939b 100644 --- a/backend_factory.go +++ b/backend_factory.go @@ -1,14 +1,12 @@ package main import ( - "context" - "net/http" - cb "github.com/devopsfaith/krakend-circuitbreaker/gobreaker/proxy" httpcache "github.com/devopsfaith/krakend-httpcache" "github.com/devopsfaith/krakend-martian" metrics "github.com/devopsfaith/krakend-metrics/gin" "github.com/devopsfaith/krakend-oauth2-clientcredentials" + opencensus "github.com/devopsfaith/krakend-opencensus" juju "github.com/devopsfaith/krakend-ratelimit/juju/proxy" "github.com/devopsfaith/krakend/config" "github.com/devopsfaith/krakend/logging" @@ -21,6 +19,7 @@ import ( // - rate-limit // - circuit breaker // - metrics collector +// - opencensus collector func NewBackendFactory(logger logging.Logger, metricCollector *metrics.Metrics) proxy.BackendFactory { requestExecutorFactory := func(cfg *config.Backend) proxy.HTTPRequestExecutor { var clientFactory proxy.HTTPClientFactory @@ -29,13 +28,12 @@ func NewBackendFactory(logger logging.Logger, metricCollector *metrics.Metrics) } else { clientFactory = httpcache.NewHTTPClient(cfg) } - return func(ctx context.Context, req *http.Request) (*http.Response, error) { - return clientFactory(ctx).Do(req.WithContext(ctx)) - } + return opencensus.HTTPRequestExecutor(clientFactory) } backendFactory := martian.NewConfiguredBackendFactory(logger, requestExecutorFactory) backendFactory = juju.BackendFactory(backendFactory) backendFactory = cb.BackendFactory(backendFactory) backendFactory = metricCollector.BackendFactory("backend", backendFactory) + backendFactory = opencensus.BackendFactory(backendFactory) return backendFactory } diff --git a/executor.go b/executor.go index 16119bd9..5cca1377 100644 --- a/executor.go +++ b/executor.go @@ -8,6 +8,11 @@ import ( "github.com/devopsfaith/krakend-cobra" "github.com/devopsfaith/krakend-gologging" metrics "github.com/devopsfaith/krakend-metrics/gin" + opencensus "github.com/devopsfaith/krakend-opencensus" + _ "github.com/devopsfaith/krakend-opencensus/exporter/influxdb" + _ "github.com/devopsfaith/krakend-opencensus/exporter/jaeger" + _ "github.com/devopsfaith/krakend-opencensus/exporter/prometheus" + _ "github.com/devopsfaith/krakend-opencensus/exporter/zipkin" "github.com/devopsfaith/krakend/config" "github.com/devopsfaith/krakend/logging" router "github.com/devopsfaith/krakend/router/gin" @@ -34,7 +39,10 @@ func NewExecutor(ctx context.Context) cmd.Executor { if err := influxdb.New(ctx, cfg.ExtraConfig, metricCollector, logger); err != nil { logger.Error(err.Error()) - return + } + + if err := opencensus.Register(ctx, cfg); err != nil { + logger.Error(err.Error()) } // setup the krakend router diff --git a/handler_factory.go b/handler_factory.go index 3fb3582f..8327174b 100644 --- a/handler_factory.go +++ b/handler_factory.go @@ -2,6 +2,7 @@ package main import ( metrics "github.com/devopsfaith/krakend-metrics/gin" + opencensus "github.com/devopsfaith/krakend-opencensus/router/gin" juju "github.com/devopsfaith/krakend-ratelimit/juju/router/gin" "github.com/devopsfaith/krakend/logging" router "github.com/devopsfaith/krakend/router/gin" @@ -11,5 +12,6 @@ import ( func NewHandlerFactory(logger logging.Logger, metricCollector *metrics.Metrics) router.HandlerFactory { handlerFactory := juju.HandlerFactory handlerFactory = metricCollector.NewHTTPHandlerFactory(handlerFactory) + handlerFactory = opencensus.New(handlerFactory) return handlerFactory } diff --git a/proxy_factory.go b/proxy_factory.go index 8acda0d1..a1f11061 100644 --- a/proxy_factory.go +++ b/proxy_factory.go @@ -2,6 +2,7 @@ package main import ( metrics "github.com/devopsfaith/krakend-metrics/gin" + opencensus "github.com/devopsfaith/krakend-opencensus" "github.com/devopsfaith/krakend/logging" "github.com/devopsfaith/krakend/proxy" ) @@ -10,5 +11,6 @@ import ( func NewProxyFactory(logger logging.Logger, backendFactory proxy.BackendFactory, metricCollector *metrics.Metrics) proxy.Factory { proxyFactory := proxy.NewDefaultFactory(backendFactory, logger) proxyFactory = metricCollector.ProxyFactory("pipe", proxyFactory) + proxyFactory = opencensus.ProxyFactory(proxyFactory) return proxyFactory } From 594498f74fc36cd4117cf7c9a4449ad60c875e41 Mon Sep 17 00:00:00 2001 From: kpacha Date: Wed, 23 May 2018 12:32:22 +0200 Subject: [PATCH 06/15] use the 0.5.0 version of the decoders --- Gopkg.lock | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++-- Gopkg.toml | 8 +++++++ encoding.go | 12 +++++----- 3 files changed, 81 insertions(+), 8 deletions(-) diff --git a/Gopkg.lock b/Gopkg.lock index 67c8ad50..a2fe17ca 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -8,12 +8,30 @@ revision = "88591e32e710a0524327153c8b629d5b461e35e0" source = "github.com/apache/thrift" +[[projects]] + name = "github.com/PuerkitoBio/goquery" + packages = ["."] + revision = "a86ea073017a6beddef78c8659e7224e8ca634b0" + version = "v1.4.0" + +[[projects]] + name = "github.com/andybalholm/cascadia" + packages = ["."] + revision = "901648c87902174f774fac311d7f176f8647bdaa" + version = "v1.0.0" + [[projects]] branch = "master" name = "github.com/beorn7/perks" packages = ["quantile"] revision = "3a771d992973f24aa725d07868b467d1ddfceafb" +[[projects]] + name = "github.com/clbanning/mxj" + packages = ["."] + revision = "1f00e0bf9bacd7ea9c93d27594d1d1f5a41bac36" + version = "v1.8" + [[projects]] name = "github.com/coreos/etcd" packages = [ @@ -139,12 +157,24 @@ ] revision = "407bf6926e70a985ee6b21a7bbcc2260b5c3c41a" +[[projects]] + name = "github.com/devopsfaith/krakend-rss" + packages = ["."] + revision = "4c18c62a99ee830ab298ea422ba8568c7bcf7951" + version = "0.5.0" + [[projects]] branch = "master" name = "github.com/devopsfaith/krakend-viper" packages = ["."] revision = "3abc4134a773578643b46aa11431f72cc6d41e8a" +[[projects]] + name = "github.com/devopsfaith/krakend-xml" + packages = ["."] + revision = "5ce94062a4cccce87e791e86272c9d95512529d4" + version = "0.5.0" + [[projects]] name = "github.com/fsnotify/fsnotify" packages = ["."] @@ -274,6 +304,24 @@ packages = ["."] revision = "06020f85339e21b2478f756a78e295255ffa4d6a" +[[projects]] + name = "github.com/mmcdole/gofeed" + packages = [ + ".", + "atom", + "extensions", + "internal/shared", + "rss" + ] + revision = "42010a154d249f5f753dfe03a6390b59671e403e" + version = "v1.0.0-beta2" + +[[projects]] + branch = "master" + name = "github.com/mmcdole/goxpp" + packages = ["."] + revision = "77e4a51a73ed99ee3f33c1474dc166866304acbd" + [[projects]] name = "github.com/op/go-logging" packages = ["."] @@ -424,7 +472,10 @@ name = "golang.org/x/net" packages = [ "context", - "context/ctxhttp" + "context/ctxhttp", + "html", + "html/atom", + "html/charset" ] revision = "a8b9294777976932365dabb6640cf1468d95c70f" @@ -454,9 +505,23 @@ branch = "master" name = "golang.org/x/text" packages = [ + "encoding", + "encoding/charmap", + "encoding/htmlindex", + "encoding/internal", + "encoding/internal/identifier", + "encoding/japanese", + "encoding/korean", + "encoding/simplifiedchinese", + "encoding/traditionalchinese", + "encoding/unicode", "internal/gen", + "internal/tag", "internal/triegen", "internal/ucd", + "internal/utf8internal", + "language", + "runes", "transform", "unicode/cldr", "unicode/norm" @@ -498,6 +563,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "847f165795d03c64d97dfa8eb6fb7e7a101bbc2437f95af305ad37d68b9f4791" + inputs-digest = "531ee1209e5bff2a786631528eafe484c7a782b840ec417038eb6f8e7cbd766c" solver-name = "gps-cdcl" solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml index b1ceaacf..e00bc83e 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -15,6 +15,14 @@ name = "github.com/gin-gonic/gin" version = "1.2.0" +[[constraint]] + version = "0.5.0" + name = "github.com/letgoapp/krakend-xml" + +[[constraint]] + version = "0.5.0" + name = "github.com/letgoapp/krakend-rss" + [[constraint]] branch = "master" name = "github.com/letgoapp/krakend-influx" diff --git a/encoding.go b/encoding.go index 18a1a54f..eb8f8ec4 100644 --- a/encoding.go +++ b/encoding.go @@ -1,12 +1,12 @@ package main -// import ( -// "github.com/devopsfaith/krakend-rss" -// "github.com/devopsfaith/krakend-xml" -// ) +import ( + "github.com/devopsfaith/krakend-rss" + "github.com/devopsfaith/krakend-xml" +) // RegisterEncoders registers all the available encoders func RegisterEncoders() { - // xml.Register() - // rss.Register() + xml.Register() + rss.Register() } From 0f050bbb986f5397737928e605ec45d39b7fbfec Mon Sep 17 00:00:00 2001 From: kpacha Date: Wed, 23 May 2018 21:34:29 +0200 Subject: [PATCH 07/15] flexibleconfig module added --- Gopkg.lock | 10 ++++++++-- Gopkg.toml | 8 ++++++-- main.go | 15 ++++++++++++++- 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/Gopkg.lock b/Gopkg.lock index a2fe17ca..139d40c6 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -89,6 +89,12 @@ packages = ["."] revision = "bd645943ff8ce2135252caafa42abc34f2c14a7d" +[[projects]] + branch = "master" + name = "github.com/devopsfaith/krakend-flexibleconfig" + packages = ["."] + revision = "1c8c8897842abec29842d5669c4abdc84e6398be" + [[projects]] branch = "master" name = "github.com/devopsfaith/krakend-gologging" @@ -143,7 +149,7 @@ "exporter/zipkin", "router/gin" ] - revision = "0fbca20d515bde8001e505bb41d2af69523798af" + revision = "e8bd6c9fc4af12f58bd9b520184526b2ea152c94" [[projects]] branch = "master" @@ -563,6 +569,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "531ee1209e5bff2a786631528eafe484c7a782b840ec417038eb6f8e7cbd766c" + inputs-digest = "41fa7cb652a49cd55fe6c1fb1a645fa8d5f629c9eac7f3a9b6a00b10fca5ea94" solver-name = "gps-cdcl" solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml index e00bc83e..c8e876f3 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -15,13 +15,17 @@ name = "github.com/gin-gonic/gin" version = "1.2.0" +[[constraint]] + branch = "master" + name = "github.com/devopsfaith/krakend-flexibleconfig" + [[constraint]] version = "0.5.0" - name = "github.com/letgoapp/krakend-xml" + name = "github.com/devopsfaith/krakend-xml" [[constraint]] version = "0.5.0" - name = "github.com/letgoapp/krakend-rss" + name = "github.com/devopsfaith/krakend-rss" [[constraint]] branch = "master" diff --git a/main.go b/main.go index 600bb511..ad80d728 100644 --- a/main.go +++ b/main.go @@ -8,9 +8,15 @@ import ( "syscall" "github.com/devopsfaith/krakend-cobra" + flexibleconfig "github.com/devopsfaith/krakend-flexibleconfig" "github.com/devopsfaith/krakend-viper" ) +const ( + fcPartials = "FC_PARTIALS" + fcSettings = "FC_SETTINGS" +) + func main() { sigs := make(chan os.Signal, 1) signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM) @@ -28,5 +34,12 @@ func main() { RegisterEncoders() - cmd.Execute(viper.New(), NewExecutor(ctx)) + cmd.Execute( + flexibleconfig.NewTemplateParser(flexibleconfig.Config{ + Parser: viper.New(), + Partials: os.Getenv(fcPartials), + Settings: os.Getenv(fcSettings), + }), + NewExecutor(ctx), + ) } From d3b0ac70a3284f64ba6646fece5524b2fb52df28 Mon Sep 17 00:00:00 2001 From: taik0 Date: Fri, 1 Jun 2018 19:05:08 +0200 Subject: [PATCH 08/15] Update the krakend-metrics package that now uses ExtraConfig as source of configuration. --- Gopkg.lock | 2 +- executor.go | 3 +-- krakend.json | 8 +++++++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Gopkg.lock b/Gopkg.lock index 139d40c6..ff6c749a 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -130,7 +130,7 @@ "gin", "mux" ] - revision = "c6bc38ddbbc0e30efc78cdfeda079741c0d40264" + revision = "208fe67a6129789936e58eda7c4bc6d205943f4f" [[projects]] branch = "master" diff --git a/executor.go b/executor.go index 5cca1377..8e0f4441 100644 --- a/executor.go +++ b/executor.go @@ -3,7 +3,6 @@ package main import ( "context" "os" - "time" "github.com/devopsfaith/krakend-cobra" "github.com/devopsfaith/krakend-gologging" @@ -35,7 +34,7 @@ func NewExecutor(ctx context.Context) cmd.Executor { RegisterSubscriberFactories(ctx, cfg, logger) // create the metrics collector - metricCollector := metrics.New(ctx, time.Minute, logger) + metricCollector := metrics.New(ctx, cfg.ExtraConfig, logger) if err := influxdb.New(ctx, cfg.ExtraConfig, metricCollector, logger); err != nil { logger.Error(err.Error()) diff --git a/krakend.json b/krakend.json index 544c5a44..f7f70914 100644 --- a/krakend.json +++ b/krakend.json @@ -10,6 +10,12 @@ "prefix": "[KRAKEND]", "syslog": false, "stdout": true + }, + "github_com/devopsfaith/krakend-metrics": { + "collection_time": "60s", + "proxy_disabled": false, + "router_disabled": false, + "backend_disabled": false } }, "endpoints": [ @@ -179,4 +185,4 @@ } } ] -} \ No newline at end of file +} From 7cfef44d2a2f3a24cac14ae39920b195e6d82766 Mon Sep 17 00:00:00 2001 From: taik0 Date: Sun, 3 Jun 2018 18:21:58 +0200 Subject: [PATCH 09/15] Remove the stats endpoint from the engine since it's already provided by the krakend-metrics middleware in a separate port. Update configuration example for the krakend-metrics middleware. --- executor.go | 2 +- krakend.json | 4 +++- router_engine.go | 7 ++----- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/executor.go b/executor.go index 8e0f4441..14fb9640 100644 --- a/executor.go +++ b/executor.go @@ -46,7 +46,7 @@ func NewExecutor(ctx context.Context) cmd.Executor { // setup the krakend router routerFactory := router.NewFactory(router.Config{ - Engine: NewEngine(cfg, logger, metricCollector), + Engine: NewEngine(cfg, logger), ProxyFactory: NewProxyFactory(logger, NewBackendFactory(logger, metricCollector), metricCollector), Middlewares: []gin.HandlerFunc{}, Logger: logger, diff --git a/krakend.json b/krakend.json index f7f70914..9eb3cb7f 100644 --- a/krakend.json +++ b/krakend.json @@ -15,7 +15,9 @@ "collection_time": "60s", "proxy_disabled": false, "router_disabled": false, - "backend_disabled": false + "backend_disabled": false, + "endpoint_disabled": false, + "listen_address": ":8090" } }, "endpoints": [ diff --git a/router_engine.go b/router_engine.go index 434edd96..1cc9548a 100644 --- a/router_engine.go +++ b/router_engine.go @@ -2,14 +2,13 @@ package main import ( httpsecure "github.com/devopsfaith/krakend-httpsecure/gin" - metricsgin "github.com/devopsfaith/krakend-metrics/gin" "github.com/devopsfaith/krakend/config" "github.com/devopsfaith/krakend/logging" "github.com/gin-gonic/gin" ) -// NewEngine creates a new gin engine with some default values, a secure middleware and an stats endpoint -func NewEngine(cfg config.ServiceConfig, logger logging.Logger, metricCollector *metricsgin.Metrics) *gin.Engine { +// NewEngine creates a new gin engine with some default values and a secure middleware +func NewEngine(cfg config.ServiceConfig, logger logging.Logger) *gin.Engine { engine := gin.Default() engine.RedirectTrailingSlash = true @@ -20,7 +19,5 @@ func NewEngine(cfg config.ServiceConfig, logger logging.Logger, metricCollector logger.Error(err) } - engine.GET("/__stats/", metricCollector.NewExpHandler()) - return engine } From 71134e06979855438125aca342e1d623efee2a3a Mon Sep 17 00:00:00 2001 From: taik0 Date: Sun, 3 Jun 2018 18:25:57 +0200 Subject: [PATCH 10/15] Expose the right port for krakend and expose the stats port too. --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 4458d321..c5fb23ea 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,4 +10,4 @@ VOLUME [ "/etc/krakend" ] ENTRYPOINT [ "/usr/bin/krakend" ] CMD [ "run", "-c", "/etc/krakend/krakend.json" ] -EXPOSE 8080 +EXPOSE 8000 8090 From 7ae3aec572543a79d512fc07485115bdfb09b83e Mon Sep 17 00:00:00 2001 From: taik0 Date: Sun, 3 Jun 2018 18:47:01 +0200 Subject: [PATCH 11/15] Update golang version to 1.10.2. --- Makefile | 2 +- README.md | 2 +- builder/alpine/Dockerfile | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 935f0674..1a77388f 100644 --- a/Makefile +++ b/Makefile @@ -68,7 +68,7 @@ build: docker_build: docker run --rm -it -e "GOPATH=/go" -v "${PWD}:/go/${GOBASEDIR}" -w /go/${GOBASEDIR} lushdigital/docker-golang-dep ensure -v - docker run --rm -it -e "GOPATH=/go" -p 8080:8080 -v "${PWD}:/go/${GOBASEDIR}" -w /go/${GOBASEDIR} golang:1.9.2 make build + docker run --rm -it -e "GOPATH=/go" -p 8080:8080 -v "${PWD}:/go/${GOBASEDIR}" -w /go/${GOBASEDIR} golang:1.10.2 make build docker_build_alpine: docker build -t krakend_alpine_compiler builder/alpine diff --git a/README.md b/README.md index 662b76e9..da8eff41 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,7 @@ http://www.krakend.io/docs/overview/introduction/ ## Build Requirements -- golang 1.9 +- golang 1.10 - `dep` ## Build diff --git a/builder/alpine/Dockerfile b/builder/alpine/Dockerfile index 8f3df2c6..034c46b4 100644 --- a/builder/alpine/Dockerfile +++ b/builder/alpine/Dockerfile @@ -1,3 +1,3 @@ -FROM golang:1.9.2-alpine3.7 +FROM golang:1.10.2-alpine3.7 RUN apk add --no-cache make curl git build-base From 879e0902cc44b3af45c7ddcb18561501fae11cb3 Mon Sep 17 00:00:00 2001 From: taik0 Date: Sun, 3 Jun 2018 18:53:04 +0200 Subject: [PATCH 12/15] Update krakend-metrics dependency. --- Gopkg.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gopkg.lock b/Gopkg.lock index ff6c749a..5235fc26 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -130,7 +130,7 @@ "gin", "mux" ] - revision = "208fe67a6129789936e58eda7c4bc6d205943f4f" + revision = "96c245e74ec40ba0f3bcef9d386e042c793c44fc" [[projects]] branch = "master" From 94049b67d7ea7ac4ed6817fb5abe7b7255ba265e Mon Sep 17 00:00:00 2001 From: taik0 Date: Sun, 3 Jun 2018 19:02:47 +0200 Subject: [PATCH 13/15] Update golang version on travis too. --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index f5af9a83..e2cdd05c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,10 @@ language: go go: - - 1.9 + - "1.10.x" before_install: - make prepare script: - - make \ No newline at end of file + - make From 917604c4c22629428c30967a9ad3415215b9a4a7 Mon Sep 17 00:00:00 2001 From: taik0 Date: Mon, 4 Jun 2018 20:15:23 +0200 Subject: [PATCH 14/15] Update dependencies to use KrakenD framework 0.5 --- Gopkg.lock | 14 +++++++------- Gopkg.toml | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Gopkg.lock b/Gopkg.lock index 5235fc26..a5f06937 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -50,7 +50,6 @@ version = "v0.2.0" [[projects]] - branch = "0.5-dev" name = "github.com/devopsfaith/krakend" packages = [ "config", @@ -66,7 +65,8 @@ "sd", "sd/dnssrv" ] - revision = "ed0d73dcd173a5e34b9adb41db81217b32ea8bfd" + revision = "a9119126330c3d376857bdd6ec05c57c2dea670b" + version = "0.5" [[projects]] branch = "master" @@ -123,14 +123,14 @@ revision = "2757b21be9ac45e04bebee8feb7481f695d62b79" [[projects]] - branch = "0.5-dev" name = "github.com/devopsfaith/krakend-metrics" packages = [ ".", "gin", "mux" ] - revision = "96c245e74ec40ba0f3bcef9d386e042c793c44fc" + revision = "f563c518da3c3fa8ad05e74179824397c996cb7e" + version = "0.5.0" [[projects]] branch = "master" @@ -139,7 +139,6 @@ revision = "401bac10b674c03508691b701fd6719e3e71ca4a" [[projects]] - branch = "master" name = "github.com/devopsfaith/krakend-opencensus" packages = [ ".", @@ -149,7 +148,8 @@ "exporter/zipkin", "router/gin" ] - revision = "e8bd6c9fc4af12f58bd9b520184526b2ea152c94" + revision = "7c9e0428d4f70aacc1c3f55619e666d74387eb99" + version = "0.5.0" [[projects]] branch = "master" @@ -569,6 +569,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "41fa7cb652a49cd55fe6c1fb1a645fa8d5f629c9eac7f3a9b6a00b10fca5ea94" + inputs-digest = "4c82f9d5932ddbbf7142c9e2be68b351295557388ba7c9391bab37f2d3022911" solver-name = "gps-cdcl" solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml index c8e876f3..f5cf78b1 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -32,7 +32,7 @@ name = "github.com/letgoapp/krakend-influx" [[constraint]] - branch = "0.5-dev" + version = "0.5" name = "github.com/devopsfaith/krakend" [[constraint]] @@ -64,7 +64,7 @@ name = "github.com/devopsfaith/krakend-martian" [[constraint]] - branch = "0.5-dev" + version = "0.5.0" name = "github.com/devopsfaith/krakend-metrics" [[constraint]] @@ -80,5 +80,5 @@ name = "github.com/devopsfaith/krakend-viper" [[constraint]] - branch = "master" + version = "0.5.0" name = "github.com/devopsfaith/krakend-opencensus" From 337ee9e040c239a36d2ba73cc8963431c1a1cd67 Mon Sep 17 00:00:00 2001 From: taik0 Date: Mon, 4 Jun 2018 20:44:42 +0200 Subject: [PATCH 15/15] Set package version to 0.5.0 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 1a77388f..854b9102 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ BIN_NAME :=krakend DEP_VERSION=0.4.1 OS := $(shell uname | tr '[:upper:]' '[:lower:]') -VERSION :=0.4.2 +VERSION :=0.5.0 PKGNAME := krakend LICENSE := Apache 2.0 VENDOR=