Skip to content

Commit

Permalink
refactor: jupiter update v0.2.4
Browse files Browse the repository at this point in the history
  • Loading branch information
kl7sn committed Aug 27, 2020
1 parent 49626b1 commit 8554e0a
Show file tree
Hide file tree
Showing 8 changed files with 370 additions and 78 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ BASE_PATH:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
SCRIPT_PATH:=$(BASE_PATH)/script
APP_NAME:=$(shell basename $(BASE_PATH))
COMPILE_OUT:=$(BASE_PATH)/release
APP_VERSION:=0.3.0
APP_VERSION:=0.4.0


all:print fmt buildAgent
Expand Down Expand Up @@ -75,4 +75,4 @@ build_data:
@$(SCRIPT_PATH)/build/build_data.sh $(APP_NAME) $(APP_VERSION) $(BASE_PATH) $(COMPILE_OUT)/$(APP_VERSION)
@echo -e "\n"
tar:
@cd $(BASE_PATH)/release && tar zcvf $(APP_VERSION).tar.gz $(APP_VERSION)
@cd $(BASE_PATH)/release && tar zcvf juno-agent_$(APP_VERSION).tar.gz $(APP_VERSION)
6 changes: 3 additions & 3 deletions cmd/juno-agent/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ package main

import (
"fmt"
"log"
"os"

"github.com/douyu/juno-agent/pkg/core"
"github.com/douyu/juno-agent/util"
"github.com/douyu/jupiter/pkg/flag"
"log"
"os"
)

func init() {
Expand Down Expand Up @@ -74,7 +75,6 @@ func main() {
}
}
eng := core.NewEngine()
eng.SetGovernor("127.0.0.1:9099")

if err := eng.Run(); err != nil {
log.Fatal(err)
Expand Down
13 changes: 8 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,26 @@ require (
github.com/apache/rocketmq-client-go/v2 v2.0.0-rc2
github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e
github.com/cenkalti/backoff v2.2.1+incompatible
github.com/douyu/jupiter v0.0.0-20200612055936-9169b4ff4506
github.com/coreos/etcd v3.3.22+incompatible
github.com/douyu/jupiter v0.2.4
github.com/fsnotify/fsnotify v1.4.9
github.com/garyburd/redigo v1.6.0
github.com/go-resty/resty/v2 v2.2.0
github.com/google/btree v1.0.1-0.20191016161528-479b5e81b0a9 // indirect
github.com/jinzhu/gorm v1.9.12
github.com/json-iterator/go v1.1.9
github.com/json-iterator/go v1.1.10
github.com/labstack/echo/v4 v4.1.16
github.com/labstack/gommon v0.3.0
github.com/nats-io/nats-server/v2 v2.1.6 // indirect
github.com/nats-io/nats.go v1.9.2
github.com/spf13/pflag v1.0.5 // indirect
github.com/stretchr/testify v1.6.1
github.com/uber-go/atomic v1.4.0
github.com/yangchenxing/go-nginx-conf-parser v0.0.0-20190110023421-0d59f1b7a3f6
go.etcd.io/etcd v0.5.0-alpha.5.0.20200425165423-262c93980547
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e
go.etcd.io/bbolt v1.3.4 // indirect
golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208
google.golang.org/grpc v1.29.0
gopkg.in/ini.v1 v1.56.0
sigs.k8s.io/yaml v1.2.0 // indirect
)

replace google.golang.org/grpc => google.golang.org/grpc v1.26.0
407 changes: 348 additions & 59 deletions go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pkg/core/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package core
import (
"strconv"

pb "github.com/coreos/etcd/etcdserver/etcdserverpb"
"github.com/douyu/juno-agent/pkg/file"
"github.com/douyu/juno-agent/pkg/model"
"github.com/douyu/juno-agent/pkg/pmt"
Expand All @@ -25,7 +26,6 @@ import (
"github.com/douyu/jupiter/pkg/server/xecho"
"github.com/douyu/jupiter/pkg/server/xgrpc"
"github.com/labstack/echo/v4"
pb "go.etcd.io/etcd/etcdserver/etcdserverpb"
"google.golang.org/grpc/examples/helloworld/helloworld"
)

Expand Down
6 changes: 3 additions & 3 deletions pkg/proxy/confProxy/etcd/etcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import (
"strings"
"time"

"github.com/coreos/etcd/clientv3"
"github.com/coreos/etcd/mvcc/mvccpb"
"github.com/douyu/juno-agent/pkg/report"
"github.com/douyu/juno-agent/pkg/structs"
"github.com/douyu/juno-agent/util"
Expand All @@ -33,8 +35,6 @@ import (
jsoniter "github.com/json-iterator/go"
"github.com/labstack/echo/v4"
"github.com/labstack/gommon/log"
"go.etcd.io/etcd/clientv3"
"go.etcd.io/etcd/mvcc/mvccpb"
)

var (
Expand Down Expand Up @@ -173,7 +173,7 @@ func (d *DataSource) watch() {
// etcd的key用作配置数据读取
hostKey := strings.Join([]string{d.prefix, report.ReturnHostName()}, "/")
// init watch
watch, err := d.etcdClient.NewWatch(hostKey)
watch, err := d.etcdClient.WatchPrefix(context.Background(), hostKey)

if err != nil {
panic("watch err: " + err.Error())
Expand Down
6 changes: 3 additions & 3 deletions pkg/proxy/regProxy/etcd/prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ import (
"strings"
"time"

"github.com/coreos/etcd/clientv3"
"github.com/coreos/etcd/mvcc/mvccpb"
"github.com/douyu/juno-agent/util"
"github.com/douyu/jupiter/pkg/xlog"
"go.etcd.io/etcd/clientv3"
"go.etcd.io/etcd/mvcc/mvccpb"
)

func (d *DataSource) watchPrometheus(path string) {
// etcd的key用作配置数据读取
hostKey := strings.Join([]string{"/prometheus", "job"}, "/")
// init watch
watch, err := d.etcdClient.NewWatch(hostKey)
watch, err := d.etcdClient.WatchPrefix(context.Background(), hostKey)

if err != nil {
panic("watch err: " + err.Error())
Expand Down
4 changes: 2 additions & 2 deletions pkg/proxy/regProxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ import (
"strings"
"sync"

pb "github.com/coreos/etcd/etcdserver/etcdserverpb"
"github.com/coreos/etcd/proxy/grpcproxy"
"github.com/douyu/juno-agent/pkg/proxy/regProxy/etcd"
"github.com/douyu/juno-agent/pkg/structs"
"github.com/douyu/jupiter/pkg/client/etcdv3"
"github.com/douyu/jupiter/pkg/util/xdebug"
"github.com/douyu/jupiter/pkg/util/xstring"
"github.com/douyu/jupiter/pkg/xlog"
pb "go.etcd.io/etcd/etcdserver/etcdserverpb"
"go.etcd.io/etcd/proxy/grpcproxy"
"google.golang.org/grpc/examples/helloworld/helloworld"
)

Expand Down

0 comments on commit 8554e0a

Please sign in to comment.