You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by il...@apache.org on 2020/11/06 09:58:43 UTC
[dubbo-go-samples] branch makefile updated: make integration test
work with tracing/jsonrpc
This is an automated email from the ASF dual-hosted git repository.
iluo pushed a commit to branch makefile
in repository https://gitbox.apache.org/repos/asf/dubbo-go-samples.git
The following commit(s) were added to refs/heads/makefile by this push:
new d03576b make integration test work with tracing/jsonrpc
d03576b is described below
commit d03576babecc06081c9265aa98b234638889d759
Author: Ian Luo <ia...@gmail.com>
AuthorDate: Fri Nov 6 17:55:35 2020 +0800
make integration test work with tracing/jsonrpc
---
tracing/jsonrpc/go-client/app/client.go | 285 ---------------------
tracing/jsonrpc/go-client/app/version.go | 22 --
tracing/jsonrpc/go-client/assembly/bin/load.sh | 203 ---------------
.../go-client/assembly/common/app.properties | 23 --
tracing/jsonrpc/go-client/assembly/common/build.sh | 83 ------
tracing/jsonrpc/go-client/assembly/linux/dev.sh | 36 ---
.../jsonrpc/go-client/assembly/linux/release.sh | 35 ---
tracing/jsonrpc/go-client/assembly/linux/test.sh | 35 ---
tracing/jsonrpc/go-client/assembly/mac/dev.sh | 36 ---
tracing/jsonrpc/go-client/assembly/mac/release.sh | 34 ---
tracing/jsonrpc/go-client/assembly/mac/test.sh | 34 ---
tracing/jsonrpc/go-client/assembly/windows/dev.sh | 34 ---
.../jsonrpc/go-client/assembly/windows/release.sh | 34 ---
tracing/jsonrpc/go-client/assembly/windows/test.sh | 34 ---
.../app/server.go => go-client/cmd/client.go} | 63 ++---
tracing/jsonrpc/go-client/conf/client.yml | 58 +++++
.../go-client/{profiles/dev => conf}/log.yml | 55 ++--
tracing/jsonrpc/go-client/{app => pkg}/user.go | 46 +---
tracing/jsonrpc/go-client/profiles/dev/client.yml | 62 -----
.../jsonrpc/go-client/profiles/release/client.yml | 60 -----
tracing/jsonrpc/go-client/profiles/release/log.yml | 28 --
tracing/jsonrpc/go-client/profiles/test/client.yml | 60 -----
tracing/jsonrpc/go-client/profiles/test/log.yml | 28 --
tracing/jsonrpc/go-server/app/user_provider1.go | 87 -------
tracing/jsonrpc/go-server/app/user_provider2.go | 97 -------
tracing/jsonrpc/go-server/app/version.go | 22 --
tracing/jsonrpc/go-server/assembly/bin/load.sh | 151 -----------
.../go-server/assembly/common/app.properties | 23 --
tracing/jsonrpc/go-server/assembly/common/build.sh | 80 ------
tracing/jsonrpc/go-server/assembly/linux/dev.sh | 36 ---
.../jsonrpc/go-server/assembly/linux/release.sh | 36 ---
tracing/jsonrpc/go-server/assembly/linux/test.sh | 36 ---
tracing/jsonrpc/go-server/assembly/mac/dev.sh | 36 ---
tracing/jsonrpc/go-server/assembly/mac/release.sh | 36 ---
tracing/jsonrpc/go-server/assembly/mac/test.sh | 36 ---
tracing/jsonrpc/go-server/assembly/windows/dev.sh | 36 ---
.../jsonrpc/go-server/assembly/windows/release.sh | 36 ---
tracing/jsonrpc/go-server/assembly/windows/test.sh | 36 ---
tracing/jsonrpc/go-server/{app => cmd}/server.go | 64 +++--
tracing/jsonrpc/go-server/conf/client.yml | 59 +++++
.../go-server/{profiles/dev => conf}/log.yml | 55 ++--
tracing/jsonrpc/go-server/conf/server.yml | 58 +++++
.../jsonrpc/go-server/docker/docker-compose.yml | 40 +++
tracing/jsonrpc/go-server/{app => pkg}/user.go | 4 +-
.../go-server/{app => pkg}/user_provider.go | 42 ++-
tracing/jsonrpc/go-server/profiles/dev/server.yml | 76 ------
tracing/jsonrpc/go-server/profiles/release/log.yml | 28 --
.../jsonrpc/go-server/profiles/release/server.yml | 75 ------
tracing/jsonrpc/go-server/profiles/test/log.yml | 28 --
tracing/jsonrpc/go-server/profiles/test/server.yml | 75 ------
.../tests/integration/main_test.go} | 66 ++---
.../tests/integration/userprovider_test.go | 100 ++++++++
52 files changed, 475 insertions(+), 2467 deletions(-)
diff --git a/tracing/jsonrpc/go-client/app/client.go b/tracing/jsonrpc/go-client/app/client.go
deleted file mode 100644
index 4974ec5..0000000
--- a/tracing/jsonrpc/go-client/app/client.go
+++ /dev/null
@@ -1,285 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package main
-
-import (
- "context"
- "fmt"
- "os"
- "os/signal"
- "syscall"
- "time"
-)
-
-import (
- "github.com/dubbogo/gost/log"
- "github.com/opentracing/opentracing-go"
- zipkinot "github.com/openzipkin-contrib/zipkin-go-opentracing"
- "github.com/openzipkin/zipkin-go"
- zipkinhttp "github.com/openzipkin/zipkin-go/reporter/http"
-)
-
-import (
- "github.com/apache/dubbo-go/common/logger"
- _ "github.com/apache/dubbo-go/common/proxy/proxy_factory"
- "github.com/apache/dubbo-go/config"
- _ "github.com/apache/dubbo-go/protocol/jsonrpc"
- _ "github.com/apache/dubbo-go/registry/protocol"
-
- _ "github.com/apache/dubbo-go/filter/filter_impl"
-
- _ "github.com/apache/dubbo-go/cluster/cluster_impl"
- _ "github.com/apache/dubbo-go/cluster/loadbalance"
- _ "github.com/apache/dubbo-go/registry/zookeeper"
-)
-
-var (
- survivalTimeout int = 10e9
-)
-
-// they are necessary:
-// export CONF_CONSUMER_FILE_PATH="xxx"
-// export APP_LOG_CONF_FILE="xxx"
-func main() {
-
- config.Load()
- initZipkin()
-
- gxlog.CInfo("\n\n\nstart to test jsonrpc")
- user := &JsonRPCUser{}
- ctx := context.WithValue(context.Background(), "MyTracing", "Tracing123")
- span, spanCtx := opentracing.StartSpanFromContext(ctx, "User-Test-Service")
- err := userProvider.GetUser(spanCtx, []interface{}{"A003"}, user)
- span.Finish()
- if err != nil {
- panic(err)
- }
- gxlog.CInfo("response result: %v", user)
-
- initSignal()
-}
-
-func initZipkin() {
- // set up a span reporter
- reporter := zipkinhttp.NewReporter("http://localhost:9411/api/v2/spans")
-
- // create our local service endpoint
- endpoint, err := zipkin.NewEndpoint("client-service", "myservice.mydomain.com:80")
- if err != nil {
- logger.Errorf("unable to create local endpoint: %+v\n", err)
- }
-
- // initialize our tracer
- nativeTracer, err := zipkin.NewTracer(reporter, zipkin.WithLocalEndpoint(endpoint))
- if err != nil {
- logger.Errorf("unable to create tracer: %+v\n", err)
- }
-
- // use zipkin-go-opentracing to wrap our tracer
- tracer := zipkinot.Wrap(nativeTracer)
-
- // optionally set as Global OpenTracing tracer instance
- opentracing.SetGlobalTracer(tracer)
-}
-
-func initSignal() {
- signals := make(chan os.Signal, 1)
- // It is not possible to block SIGKILL or syscall.SIGSTOP
- signal.Notify(signals, os.Interrupt, os.Kill, syscall.SIGHUP,
- syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT)
- for {
- sig := <-signals
- logger.Infof("get signal %s", sig.String())
- switch sig {
- case syscall.SIGHUP:
- // reload()
- default:
- time.AfterFunc(time.Duration(survivalTimeout), func() {
- logger.Warnf("app exit now by force...")
- os.Exit(1)
- })
-
- // The program exits normally or timeout forcibly exits.
- fmt.Println("app exit now...")
- return
- }
- }
-}
-
-func test() {
- gxlog.CInfo("\n\n\necho")
- res, err := userProvider.Echo(context.TODO(), "OK")
- if err != nil {
- gxlog.CInfo("echo - error: %v", err)
- } else {
- gxlog.CInfo("res: %v", res)
- }
-
- time.Sleep(3e9)
-
- ctx := context.WithValue(context.Background(), "TracingID", "Tracing123")
- gxlog.CInfo("\n\n\nstart to test jsonrpc - GetUser0")
- ret, err := userProvider.GetUser0("A003", "Moorse")
- if err != nil {
- panic(err)
- }
- gxlog.CInfo("response result: %v", ret)
-
- gxlog.CInfo("\n\n\nstart to test jsonrpc - GetUsers")
- ret1, err := userProvider.GetUsers([]interface{}{[]interface{}{"A002", "A003"}})
- if err != nil {
- panic(err)
- }
- gxlog.CInfo("response result: %v", ret1)
-
- gxlog.CInfo("\n\n\nstart to test jsonrpc - getUser")
- user := &JsonRPCUser{}
- err = userProvider.GetUser2(ctx, []interface{}{1}, user)
- if err != nil {
- panic(err)
- }
- gxlog.CInfo("response result: %v", user)
-
- gxlog.CInfo("\n\n\nstart to test jsonrpc - GetUser3")
- err = userProvider.GetUser3()
- if err != nil {
- panic(err)
- }
- gxlog.CInfo("succ!")
-
- gxlog.CInfo("\n\n\nstart to test jsonrpc illegal method")
- err = userProvider.GetUser1(ctx, []interface{}{"A003"}, user)
- if err == nil {
- panic("err is nil")
- }
- gxlog.CInfo("error: %v", err)
-}
-
-func test1() {
- ctx := context.WithValue(context.Background(), "TracingID", "Tracing123")
- gxlog.CInfo("\n\n\necho")
- res, err := userProvider1.Echo(ctx, "OK")
- if err != nil {
- gxlog.CInfo("echo - error: %v", err)
- } else {
- gxlog.CInfo("res: %v", res)
- }
-
- time.Sleep(3e9)
-
- gxlog.CInfo("\n\n\nstart to test jsonrpc")
- user := &JsonRPCUser{}
- err = userProvider1.GetUser(ctx, []interface{}{"A003"}, user)
- if err != nil {
- panic(err)
- }
- gxlog.CInfo("response result: %v", user)
-
- gxlog.CInfo("\n\n\nstart to test jsonrpc - GetUser0")
- ret, err := userProvider1.GetUser0("A003", "Moorse")
- if err != nil {
- panic(err)
- }
- gxlog.CInfo("response result: %v", ret)
-
- gxlog.CInfo("\n\n\nstart to test jsonrpc - GetUsers")
- ret1, err := userProvider1.GetUsers([]interface{}{[]interface{}{"A002", "A003"}})
- if err != nil {
- panic(err)
- }
- gxlog.CInfo("response result: %v", ret1)
-
- gxlog.CInfo("\n\n\nstart to test jsonrpc - getUser")
- user = &JsonRPCUser{}
- err = userProvider1.GetUser2(ctx, []interface{}{1}, user)
- if err != nil {
- panic(err)
- }
- gxlog.CInfo("response result: %v", user)
-
- gxlog.CInfo("\n\n\nstart to test jsonrpc - GetUser3")
- err = userProvider1.GetUser3()
- if err != nil {
- panic(err)
- }
- gxlog.CInfo("succ!")
-
- gxlog.CInfo("\n\n\nstart to test jsonrpc illegal method")
- err = userProvider1.GetUser1(ctx, []interface{}{"A003"}, user)
- if err == nil {
- panic("err is nil")
- }
- gxlog.CInfo("error: %v", err)
-}
-
-func test2() {
- ctx := context.WithValue(context.Background(), "TracingID", "Tracing123")
- gxlog.CInfo("\n\n\necho")
- res, err := userProvider2.Echo(ctx, "OK")
- if err != nil {
- gxlog.CInfo("echo - error: %v", err)
- } else {
- gxlog.CInfo("res: %v", res)
- }
-
- time.Sleep(3e9)
-
- gxlog.CInfo("\n\n\nstart to test jsonrpc")
- user := &JsonRPCUser{}
- err = userProvider2.GetUser(ctx, []interface{}{"A003"}, user)
- if err != nil {
- panic(err)
- }
- gxlog.CInfo("response result: %v", user)
-
- gxlog.CInfo("\n\n\nstart to test jsonrpc - GetUser0")
- ret, err := userProvider2.GetUser0("A003", "Moorse")
- if err != nil {
- panic(err)
- }
- gxlog.CInfo("response result: %v", ret)
-
- gxlog.CInfo("\n\n\nstart to test jsonrpc - GetUsers")
- ret1, err := userProvider2.GetUsers([]interface{}{[]interface{}{"A002", "A003"}})
- if err != nil {
- panic(err)
- }
- gxlog.CInfo("response result: %v", ret1)
-
- gxlog.CInfo("\n\n\nstart to test jsonrpc - getUser")
- user = &JsonRPCUser{}
- err = userProvider2.GetUser2(ctx, []interface{}{1}, user)
- if err != nil {
- panic(err)
- }
- gxlog.CInfo("response result: %v", user)
-
- gxlog.CInfo("\n\n\nstart to test jsonrpc - GetUser3")
- err = userProvider2.GetUser3()
- if err != nil {
- panic(err)
- }
- gxlog.CInfo("succ!")
-
- gxlog.CInfo("\n\n\nstart to test jsonrpc illegal method")
- err = userProvider2.GetUser1(ctx, []interface{}{"A003"}, user)
- if err == nil {
- panic("err is nil")
- }
- gxlog.CInfo("error: %v", err)
-}
diff --git a/tracing/jsonrpc/go-client/app/version.go b/tracing/jsonrpc/go-client/app/version.go
deleted file mode 100644
index ae51f45..0000000
--- a/tracing/jsonrpc/go-client/app/version.go
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package main
-
-var (
- Version = "2.7.5"
-)
diff --git a/tracing/jsonrpc/go-client/assembly/bin/load.sh b/tracing/jsonrpc/go-client/assembly/bin/load.sh
deleted file mode 100644
index ffa240b..0000000
--- a/tracing/jsonrpc/go-client/assembly/bin/load.sh
+++ /dev/null
@@ -1,203 +0,0 @@
-#!/usr/bin/env bash
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-APP_NAME="APPLICATION_NAME"
-APP_ARGS=""
-SLEEP_INTERVAL=5
-MAX_LIFETIME=4000
-
-PROJECT_HOME=""
-OS_NAME=`uname`
-if [[ ${OS_NAME} != "Windows" ]]; then
- PROJECT_HOME=`pwd`
- PROJECT_HOME=${PROJECT_HOME}"/"
-else
- APP_NAME="APPLICATION_NAME.exe"
-fi
-
-export CONF_CONSUMER_FILE_PATH=${PROJECT_HOME}"TARGET_CONF_FILE"
-export APP_LOG_CONF_FILE=${PROJECT_HOME}"TARGET_LOG_CONF_FILE"
-# export GOTRACEBACK=system
-# export GODEBUG=gctrace=1
-
-usage() {
- echo "Usage: $0 start [conf suffix]"
- echo " $0 stop"
- echo " $0 term"
- echo " $0 restart"
- echo " $0 list"
- echo " $0 monitor"
- echo " $0 crontab"
- exit
-}
-
-start() {
- arg=$1
- if [ "$arg" = "" ];then
- echo "No registry type! Default client.yml!"
- else
- export CONF_CONSUMER_FILE_PATH=${CONF_CONSUMER_FILE_PATH//\.yml/\_$arg\.yml}
- fi
- if [ ! -f "${CONF_CONSUMER_FILE_PATH}" ];then
- echo $CONF_CONSUMER_FILE_PATH" is not existing!"
- return
- fi
- APP_LOG_PATH=${PROJECT_HOME}"logs/"
- mkdir -p ${APP_LOG_PATH}
- APP_BIN=${PROJECT_HOME}sbin/${APP_NAME}
- chmod u+x ${APP_BIN}
- # CMD="nohup ${APP_BIN} ${APP_ARGS} >>${APP_NAME}.nohup.out 2>&1 &"
- CMD="${APP_BIN}"
- eval ${CMD}
- PID=`ps aux | grep -w ${APP_NAME} | grep -v grep | awk '{print $2}'`
- if [[ ${OS_NAME} != "Linux" && ${OS_NAME} != "Darwin" ]]; then
- PID=`ps aux | grep -w ${APP_NAME} | grep -v grep | awk '{print $1}'`
- fi
- CUR=`date +%FT%T`
- if [ "${PID}" != "" ]; then
- for p in ${PID}
- do
- echo "start ${APP_NAME} ( pid =" ${p} ") at " ${CUR}
- done
- fi
-}
-
-stop() {
- PID=`ps aux | grep -w ${APP_NAME} | grep -v grep | awk '{print $2}'`
- if [[ ${OS_NAME} != "Linux" && ${OS_NAME} != "Darwin" ]]; then
- PID=`ps aux | grep -w ${APP_NAME} | grep -v grep | awk '{print $1}'`
- fi
- if [ "${PID}" != "" ];
- then
- for ps in ${PID}
- do
- echo "kill -SIGINT ${APP_NAME} ( pid =" ${ps} ")"
- kill -2 ${ps}
- done
- fi
-}
-
-
-term() {
- PID=`ps aux | grep -w ${APP_NAME} | grep -v grep | awk '{print $2}'`
- if [[ ${OS_NAME} != "Linux" && ${OS_NAME} != "Darwin" ]]; then
- PID=`ps aux | grep -w ${APP_NAME} | grep -v grep | awk '{print $1}'`
- fi
- if [ "${PID}" != "" ];
- then
- for ps in ${PID}
- do
- echo "kill -9 ${APP_NAME} ( pid =" ${ps} ")"
- kill -9 ${ps}
- done
- fi
-}
-
-list() {
- PID=`ps aux | grep -w ${APP_NAME} | grep -v grep | awk '{printf("%s,%s,%s,%s\n", $1, $2, $9, $10)}'`
- if [[ ${OS_NAME} != "Linux" && ${OS_NAME} != "Darwin" ]]; then
- PID=`ps aux | grep -w ${APP_NAME} | grep -v grep | awk '{printf("%s,%s,%s,%s,%s\n", $1, $4, $6, $7, $8)}'`
- fi
-
- if [ "${PID}" != "" ]; then
- echo "list ${APP_NAME}"
-
- if [[ ${OS_NAME} == "Linux" || ${OS_NAME} == "Darwin" ]]; then
- echo "index: user, pid, start, duration"
- else
- echo "index: PID, WINPID, UID, STIME, COMMAND"
- fi
- idx=0
- for ps in ${PID}
- do
- echo "${idx}: ${ps}"
- ((idx ++))
- done
- fi
-}
-
-monitor() {
- idx=0
- while true; do
- PID=`ps aux | grep -w ${APP_NAME} | grep -v grep | awk '{print $2}'`
- if [[ ${OS_NAME} != "Linux" && ${OS_NAME} != "Darwin" ]]; then
- PID=`ps aux | grep -w ${APP_NAME} | grep -v grep | awk '{print $1}'`
- fi
- if [[ "${PID}" == "" ]]; then
- start
- idx=0
- fi
-
- ((LIFE=idx*${SLEEP_INTERVAL}))
- echo "${APP_NAME} ( pid = " ${PID} ") has been working in normal state for " $LIFE " seconds."
- ((idx ++))
- sleep ${SLEEP_INTERVAL}
- done
-}
-
-crontab() {
- idx=0
- while true; do
- PID=`ps aux | grep -w ${APP_NAME} | grep -v grep | awk '{print $2}'`
- if [[ ${OS_NAME} != "Linux" && ${OS_NAME} != "Darwin" ]]; then
- PID=`ps aux | grep -w ${APP_NAME} | grep -v grep | awk '{print $1}'`
- fi
- if [[ "${PID}" == "" ]]; then
- start
- idx=0
- fi
-
- ((LIFE=idx*${SLEEP_INTERVAL}))
- echo "${APP_NAME} ( pid = " ${PID} ") has been working in normal state for " $LIFE " seconds."
- ((idx ++))
- sleep ${SLEEP_INTERVAL}
- if [[ ${LIFE} -gt ${MAX_LIFETIME} ]]; then
- kill -9 ${PID}
- fi
- done
-}
-
-opt=$1
-case C"$opt" in
- Cstart)
- start $2
- ;;
- Cstop)
- stop
- ;;
- Cterm)
- term
- ;;
- Crestart)
- term
- start $2
- ;;
- Clist)
- list
- ;;
- Cmonitor)
- monitor
- ;;
- Ccrontab)
- crontab
- ;;
- C*)
- usage
- ;;
-esac
-
diff --git a/tracing/jsonrpc/go-client/assembly/common/app.properties b/tracing/jsonrpc/go-client/assembly/common/app.properties
deleted file mode 100644
index e10868f..0000000
--- a/tracing/jsonrpc/go-client/assembly/common/app.properties
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-export TARGET_EXEC_NAME="user_info_client"
-# BUILD_PACKAGE="dubbogo-examples/user-info/client/app"
-export BUILD_PACKAGE="app"
-
-export TARGET_CONF_FILE="conf/client.yml"
-export TARGET_LOG_CONF_FILE="conf/log.yml"
diff --git a/tracing/jsonrpc/go-client/assembly/common/build.sh b/tracing/jsonrpc/go-client/assembly/common/build.sh
deleted file mode 100644
index d1f7136..0000000
--- a/tracing/jsonrpc/go-client/assembly/common/build.sh
+++ /dev/null
@@ -1,83 +0,0 @@
-#!/usr/bin/env bash
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-rm -rf target/
-
-PROJECT_HOME=`pwd`
-TARGET_FOLDER=${PROJECT_HOME}/target/${GOOS}
-
-TARGET_SBIN_NAME=${TARGET_EXEC_NAME}
-version=`cat app/version.go | grep Version | grep -v "Apache" | awk -F '=' '{print $2}' | awk -F '"' '{print $2}'`
-if [[ ${GOOS} == "windows" ]]; then
- TARGET_SBIN_NAME=${TARGET_SBIN_NAME}.exe
-fi
-TARGET_NAME=${TARGET_FOLDER}/${TARGET_SBIN_NAME}
-if [[ $PROFILE == "dev" || $PROFILE == "test" ]]; then
- # GFLAGS=-gcflags "-N -l" -race -x -v # -x会把go build的详细过程输出
- # GFLAGS=-gcflags "-N -l" -race -v
- # GFLAGS="-gcflags \"-N -l\" -v"
- cd ${BUILD_PACKAGE} && GOOS=$GOOS GOARCH=$GOARCH GO111MODULE=on go build -gcflags "-N -l" -x -v -i -o ${TARGET_NAME} && cd -
-else
- # -s去掉符号表(然后panic时候的stack trace就没有任何文件名/行号信息了,这个等价于普通C/C++程序被strip的效果),
- # -w去掉DWARF调试信息,得到的程序就不能用gdb调试了。-s和-w也可以分开使用,一般来说如果不打算用gdb调试,
- # -w基本没啥损失。-s的损失就有点大了。
- cd ${BUILD_PACKAGE} && GOOS=$GOOS GOARCH=$GOARCH GO111MODULE=on go build -ldflags "-w" -x -v -i -o ${TARGET_NAME} && cd -
-fi
-
-TAR_NAME=${TARGET_EXEC_NAME}-${version}-`date "+%Y%m%d-%H%M"`-${PROFILE}
-
-mkdir -p ${TARGET_FOLDER}/${TAR_NAME}
-
-SBIN_DIR=${TARGET_FOLDER}/${TAR_NAME}/sbin
-BIN_DIR=${TARGET_FOLDER}/${TAR_NAME}
-CONF_DIR=${TARGET_FOLDER}/${TAR_NAME}/conf
-
-mkdir -p ${SBIN_DIR}
-mkdir -p ${CONF_DIR}
-
-mv ${TARGET_NAME} ${SBIN_DIR}
-cp -r assembly/bin ${BIN_DIR}
-cd ${BIN_DIR}/bin/ && mv load.sh load_${TARGET_EXEC_NAME}.sh && cd -
-
-platform=$(uname)
-# modify APPLICATION_NAME
-if [ ${platform} == "Darwin" ]; then
- sed -i "" "s~APPLICATION_NAME~${TARGET_EXEC_NAME}~g" ${BIN_DIR}/bin/*
-else
- sed -i "s~APPLICATION_NAME~${TARGET_EXEC_NAME}~g" ${BIN_DIR}/bin/*
-fi
-
-# modify TARGET_CONF_FILE
-if [ ${platform} == "Darwin" ]; then
- sed -i "" "s~TARGET_CONF_FILE~${TARGET_CONF_FILE}~g" ${BIN_DIR}/bin/*
-else
- sed -i "s~TARGET_CONF_FILE~${TARGET_CONF_FILE}~g" ${BIN_DIR}/bin/*
-fi
-
-# modify TARGET_LOG_CONF_FILE
-if [ ${platform} == "Darwin" ]; then
- sed -i "" "s~TARGET_LOG_CONF_FILE~${TARGET_LOG_CONF_FILE}~g" ${BIN_DIR}/bin/*
-else
- sed -i "s~TARGET_LOG_CONF_FILE~${TARGET_LOG_CONF_FILE}~g" ${BIN_DIR}/bin/*
-fi
-
-cp -r profiles/${PROFILE}/* ${CONF_DIR}
-
-cd ${TARGET_FOLDER}
-
-tar czf ${TAR_NAME}.tar.gz ${TAR_NAME}/*
-
diff --git a/tracing/jsonrpc/go-client/assembly/linux/dev.sh b/tracing/jsonrpc/go-client/assembly/linux/dev.sh
deleted file mode 100644
index eada737..0000000
--- a/tracing/jsonrpc/go-client/assembly/linux/dev.sh
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/env bash
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-
-set -e
-
-export GOOS=linux
-export GOARCH=amd64
-
-export PROFILE="dev"
-
-PROJECT_HOME=`pwd`
-
-if [ -f "${PROJECT_HOME}/assembly/common/app.properties" ]; then
- . ${PROJECT_HOME}/assembly/common/app.properties
-fi
-
-
-if [ -f "${PROJECT_HOME}/assembly/common/build.sh" ]; then
- sh ${PROJECT_HOME}/assembly/common/build.sh
-fi
diff --git a/tracing/jsonrpc/go-client/assembly/linux/release.sh b/tracing/jsonrpc/go-client/assembly/linux/release.sh
deleted file mode 100644
index 10eb3d7..0000000
--- a/tracing/jsonrpc/go-client/assembly/linux/release.sh
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/usr/bin/env bash
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-
-set -e
-
-export GOOS=linux
-export GOARCH=amd64
-
-export PROFILE="release"
-export PROJECT_HOME=`pwd`
-
-if [ -f "${PROJECT_HOME}/assembly/common/app.properties" ]; then
- . ${PROJECT_HOME}/assembly/common/app.properties
-fi
-
-
-if [ -f "${PROJECT_HOME}/assembly/common/build.sh" ]; then
- sh ${PROJECT_HOME}/assembly/common/build.sh
-fi
diff --git a/tracing/jsonrpc/go-client/assembly/linux/test.sh b/tracing/jsonrpc/go-client/assembly/linux/test.sh
deleted file mode 100644
index 78b650c..0000000
--- a/tracing/jsonrpc/go-client/assembly/linux/test.sh
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/usr/bin/env bash
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-
-set -e
-
-export GOOS=linux
-export GOARCH=amd64
-
-export PROFILE="test"
-export PROJECT_HOME=`pwd`
-
-if [ -f "${PROJECT_HOME}/assembly/common/app.properties" ]; then
- . ${PROJECT_HOME}/assembly/common/app.properties
-fi
-
-
-if [ -f "${PROJECT_HOME}/assembly/common/build.sh" ]; then
- sh ${PROJECT_HOME}/assembly/common/build.sh
-fi
diff --git a/tracing/jsonrpc/go-client/assembly/mac/dev.sh b/tracing/jsonrpc/go-client/assembly/mac/dev.sh
deleted file mode 100644
index c828476..0000000
--- a/tracing/jsonrpc/go-client/assembly/mac/dev.sh
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/env bash
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-
-set -e
-
-export GOOS=darwin
-export GOARCH=amd64
-
-export PROFILE="dev"
-
-export PROJECT_HOME=`pwd`
-
-if [ -f "${PROJECT_HOME}/assembly/common/app.properties" ]; then
- . ${PROJECT_HOME}/assembly/common/app.properties
-fi
-
-
-if [ -f "${PROJECT_HOME}/assembly/common/build.sh" ]; then
- sh ${PROJECT_HOME}/assembly/common/build.sh
-fi
diff --git a/tracing/jsonrpc/go-client/assembly/mac/release.sh b/tracing/jsonrpc/go-client/assembly/mac/release.sh
deleted file mode 100644
index 91c2dfe..0000000
--- a/tracing/jsonrpc/go-client/assembly/mac/release.sh
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/usr/bin/env bash
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-
-set -e
-
-export GOOS=darwin
-export GOARCH=amd64
-
-export PROFILE="release"
-export PROJECT_HOME=`pwd`
-
-if [ -f "${PROJECT_HOME}/assembly/common/app.properties" ]; then
- . ${PROJECT_HOME}/assembly/common/app.properties
-fi
-
-if [ -f "${PROJECT_HOME}/assembly/common/build.sh" ]; then
- sh ${PROJECT_HOME}/assembly/common/build.sh
-fi
diff --git a/tracing/jsonrpc/go-client/assembly/mac/test.sh b/tracing/jsonrpc/go-client/assembly/mac/test.sh
deleted file mode 100644
index a7853f5..0000000
--- a/tracing/jsonrpc/go-client/assembly/mac/test.sh
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/usr/bin/env bash
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-set -e
-
-export GOOS=darwin
-export GOARCH=amd64
-
-export PROFILE="test"
-export PROJECT_HOME=`pwd`
-
-if [ -f "${PROJECT_HOME}/assembly/common/app.properties" ]; then
- . ${PROJECT_HOME}/assembly/common/app.properties
-fi
-
-
-if [ -f "${PROJECT_HOME}/assembly/common/build.sh" ]; then
- sh ${PROJECT_HOME}/assembly/common/build.sh
-fi
diff --git a/tracing/jsonrpc/go-client/assembly/windows/dev.sh b/tracing/jsonrpc/go-client/assembly/windows/dev.sh
deleted file mode 100644
index 10a3866..0000000
--- a/tracing/jsonrpc/go-client/assembly/windows/dev.sh
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/usr/bin/env bash
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-
-set -e
-
-export GOOS=linux
-export GOARCH=amd64
-
-export PROFILE="dev"
-PROJECT_HOME=`pwd`
-
-if [ -f "${PROJECT_HOME}/assembly/common/app.properties" ]; then
- . ${PROJECT_HOME}/assembly/common/app.properties
-fi
-
-if [ -f "${PROJECT_HOME}/assembly/common/build.sh" ]; then
- sh ${PROJECT_HOME}/assembly/common/build.sh
-fi
diff --git a/tracing/jsonrpc/go-client/assembly/windows/release.sh b/tracing/jsonrpc/go-client/assembly/windows/release.sh
deleted file mode 100644
index 21af573..0000000
--- a/tracing/jsonrpc/go-client/assembly/windows/release.sh
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/usr/bin/env bash
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-
-set -e
-
-export GOOS=windows
-export GOARCH=amd64
-
-export PROFILE="release"
-export PROJECT_HOME=`pwd`
-
-if [ -f "${PROJECT_HOME}/assembly/common/app.properties" ]; then
- . ${PROJECT_HOME}/assembly/common/app.properties
-fi
-
-if [ -f "${PROJECT_HOME}/assembly/common/build.sh" ]; then
- sh ${PROJECT_HOME}/assembly/common/build.sh
-fi
diff --git a/tracing/jsonrpc/go-client/assembly/windows/test.sh b/tracing/jsonrpc/go-client/assembly/windows/test.sh
deleted file mode 100644
index 2104da8..0000000
--- a/tracing/jsonrpc/go-client/assembly/windows/test.sh
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/usr/bin/env bash
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-
-set -e
-
-export GOOS=windows
-export GOARCH=amd64
-
-export PROFILE="test"
-export PROJECT_HOME=`pwd`
-
-if [ -f "${PROJECT_HOME}/assembly/common/app.properties" ]; then
- . ${PROJECT_HOME}/assembly/common/app.properties
-fi
-
-if [ -f "${PROJECT_HOME}/assembly/common/build.sh" ]; then
- sh ${PROJECT_HOME}/assembly/common/build.sh
-fi
diff --git a/tracing/jsonrpc/go-server/app/server.go b/tracing/jsonrpc/go-client/cmd/client.go
similarity index 70%
copy from tracing/jsonrpc/go-server/app/server.go
copy to tracing/jsonrpc/go-client/cmd/client.go
index 90f6042..a124133 100644
--- a/tracing/jsonrpc/go-server/app/server.go
+++ b/tracing/jsonrpc/go-client/cmd/client.go
@@ -18,71 +18,50 @@
package main
import (
- "fmt"
- "os"
- "os/signal"
- "syscall"
+ "context"
"time"
)
import (
+ "github.com/apache/dubbo-samples/golang/tracing/jsonrpc/go-client/pkg"
+ gxlog "github.com/dubbogo/gost/log"
"github.com/opentracing/opentracing-go"
zipkinot "github.com/openzipkin-contrib/zipkin-go-opentracing"
"github.com/openzipkin/zipkin-go"
zipkinhttp "github.com/openzipkin/zipkin-go/reporter/http"
-)
-import (
+ _ "github.com/apache/dubbo-go/cluster/cluster_impl"
+ _ "github.com/apache/dubbo-go/cluster/loadbalance"
"github.com/apache/dubbo-go/common/logger"
_ "github.com/apache/dubbo-go/common/proxy/proxy_factory"
"github.com/apache/dubbo-go/config"
+ _ "github.com/apache/dubbo-go/filter/filter_impl"
_ "github.com/apache/dubbo-go/protocol/jsonrpc"
_ "github.com/apache/dubbo-go/registry/protocol"
-
- _ "github.com/apache/dubbo-go/filter/filter_impl"
-
- _ "github.com/apache/dubbo-go/cluster/cluster_impl"
- _ "github.com/apache/dubbo-go/cluster/loadbalance"
_ "github.com/apache/dubbo-go/registry/zookeeper"
)
-var (
- survivalTimeout = int(3e9)
-)
-
-// they are necessary:
-// export CONF_PROVIDER_FILE_PATH="xxx"
-// export APP_LOG_CONF_FILE="xxx"
+// need to setup environment variable "CONF_CONSUMER_FILE_PATH" to "conf/client.yml" before run
func main() {
-
+ userProvider := new(pkg.UserProvider)
+ config.SetConsumerService(userProvider)
config.Load()
-
initZipkin()
+ time.Sleep(3 * time.Second)
- initSignal()
-}
+ gxlog.CInfo("\n\n\nstart to test jsonrpc")
+ user := &pkg.JsonRPCUser{}
-func initSignal() {
- signals := make(chan os.Signal, 1)
- // It is not possible to block SIGKILL or syscall.SIGSTOP
- signal.Notify(signals, os.Interrupt, os.Kill, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT)
- for {
- sig := <-signals
- logger.Infof("get signal %s", sig.String())
- switch sig {
- case syscall.SIGHUP:
- // reload()
- default:
- time.AfterFunc(time.Duration(survivalTimeout), func() {
- logger.Warnf("app exit now by force...")
- os.Exit(1)
- })
+ // FIXME: client side doesn't work
+ ctx := context.WithValue(context.Background(), "MyTracing", "Tracing123")
+ span, spanCtx := opentracing.StartSpanFromContext(ctx, "User-Test-Service")
+ defer span.Finish()
- // The program exits normally or timeout forcibly exits.
- fmt.Println("provider app exit now...")
- return
- }
+ err := userProvider.GetUser(spanCtx, []interface{}{"A003"}, user)
+ if err != nil {
+ panic(err)
}
+ gxlog.CInfo("response result: %v", user)
}
func initZipkin() {
@@ -90,7 +69,7 @@ func initZipkin() {
reporter := zipkinhttp.NewReporter("http://localhost:9411/api/v2/spans")
// create our local service endpoint
- endpoint, err := zipkin.NewEndpoint("myService", "myservice.mydomain.com:80")
+ endpoint, err := zipkin.NewEndpoint("client-service", "myservice.mydomain.com:80")
if err != nil {
logger.Errorf("unable to create local endpoint: %+v\n", err)
}
diff --git a/tracing/jsonrpc/go-client/conf/client.yml b/tracing/jsonrpc/go-client/conf/client.yml
new file mode 100644
index 0000000..7dd8936
--- /dev/null
+++ b/tracing/jsonrpc/go-client/conf/client.yml
@@ -0,0 +1,58 @@
+# dubbo client yaml configure file
+
+check: true
+# client
+request_timeout: "3s"
+# connect timeout
+connect_timeout: "3s"
+
+# application config
+application:
+ organization: "dubbo.io"
+ name: "UserInfoConsumer"
+ module: "dubbo-go user-info client"
+ version: "0.0.1"
+ environment: "dev"
+
+# registry config
+registries:
+ "demoZk":
+ protocol: "zookeeper"
+ timeout: "3s"
+ address: "127.0.0.1:2181"
+ username: ""
+ password: ""
+
+# reference config
+references:
+ "UserProvider":
+ registry: "demoZk"
+ protocol: "jsonrpc"
+ interface: "org.apache.dubbo.UserProvider"
+ cluster: "failover"
+
+# protocol config
+protocol_conf:
+ jsonrpc:
+ reconnect_interval: 0
+ connection_number: 1
+ heartbeat_period: "5s"
+ session_timeout: "180s"
+ pool_size: 64
+ pool_ttl: 600
+ getty_session_param:
+ compress_encoding: false
+ tcp_no_delay: true
+ tcp_keep_alive: true
+ keep_alive_period: "120s"
+ tcp_r_buf_size: 262144
+ tcp_w_buf_size: 65536
+ pkg_rq_size: 1024
+ pkg_wq_size: 512
+ tcp_read_timeout: "1s"
+ tcp_write_timeout: "5s"
+ wait_timeout: "1s"
+ max_msg_len: 1024000
+ session_name: "client"
+
+filter: "tracing"
\ No newline at end of file
diff --git a/tracing/jsonrpc/go-client/profiles/dev/log.yml b/tracing/jsonrpc/go-client/conf/log.yml
similarity index 88%
rename from tracing/jsonrpc/go-client/profiles/dev/log.yml
rename to tracing/jsonrpc/go-client/conf/log.yml
index 59fa427..2b6e93a 100644
--- a/tracing/jsonrpc/go-client/profiles/dev/log.yml
+++ b/tracing/jsonrpc/go-client/conf/log.yml
@@ -1,28 +1,27 @@
-
-level: "debug"
-development: true
-disableCaller: false
-disableStacktrace: false
-sampling:
-encoding: "console"
-
-# encoder
-encoderConfig:
- messageKey: "message"
- levelKey: "level"
- timeKey: "time"
- nameKey: "logger"
- callerKey: "caller"
- stacktraceKey: "stacktrace"
- lineEnding: ""
- levelEncoder: "capitalColor"
- timeEncoder: "iso8601"
- durationEncoder: "seconds"
- callerEncoder: "short"
- nameEncoder: ""
-
-outputPaths:
- - "stderr"
-errorOutputPaths:
- - "stderr"
-initialFields:
+level: "debug"
+development: true
+disableCaller: false
+disableStacktrace: false
+sampling:
+encoding: "console"
+
+# encoder
+encoderConfig:
+ messageKey: "message"
+ levelKey: "level"
+ timeKey: "time"
+ nameKey: "logger"
+ callerKey: "caller"
+ stacktraceKey: "stacktrace"
+ lineEnding: ""
+ levelEncoder: "capital"
+ timeEncoder: "iso8601"
+ durationEncoder: "seconds"
+ callerEncoder: "short"
+ nameEncoder: ""
+
+outputPaths:
+ - "stderr"
+errorOutputPaths:
+ - "stderr"
+initialFields:
diff --git a/tracing/jsonrpc/go-client/app/user.go b/tracing/jsonrpc/go-client/pkg/user.go
similarity index 53%
copy from tracing/jsonrpc/go-client/app/user.go
copy to tracing/jsonrpc/go-client/pkg/user.go
index c6fdbe1..7a26658 100644
--- a/tracing/jsonrpc/go-client/app/user.go
+++ b/tracing/jsonrpc/go-client/pkg/user.go
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package main
+package pkg
import (
"context"
@@ -23,22 +23,6 @@ import (
"time"
)
-import (
- "github.com/apache/dubbo-go/config"
-)
-
-var (
- userProvider = new(UserProvider)
- userProvider1 = new(UserProvider1)
- userProvider2 = new(UserProvider2)
-)
-
-func init() {
- config.SetConsumerService(userProvider)
- config.SetConsumerService(userProvider1)
- config.SetConsumerService(userProvider2)
-}
-
type JsonRPCUser struct {
ID string `json:"id"`
Name string `json:"name"`
@@ -67,31 +51,3 @@ type UserProvider struct {
func (u *UserProvider) Reference() string {
return "UserProvider"
}
-
-type UserProvider1 struct {
- GetUsers func(req []interface{}) ([]JsonRPCUser, error)
- GetUser func(ctx context.Context, req []interface{}, rsp *JsonRPCUser) error
- GetUser0 func(id string, name string) (JsonRPCUser, error)
- GetUser1 func(ctx context.Context, req []interface{}, rsp *JsonRPCUser) error
- GetUser2 func(ctx context.Context, req []interface{}, rsp *JsonRPCUser) error `dubbo:"getUser"`
- GetUser3 func() error
- Echo func(ctx context.Context, req interface{}) (interface{}, error) // Echo represent EchoFilter will be used
-}
-
-func (u *UserProvider1) Reference() string {
- return "UserProvider1"
-}
-
-type UserProvider2 struct {
- GetUsers func(req []interface{}) ([]JsonRPCUser, error)
- GetUser func(ctx context.Context, req []interface{}, rsp *JsonRPCUser) error
- GetUser0 func(id string, name string) (JsonRPCUser, error)
- GetUser1 func(ctx context.Context, req []interface{}, rsp *JsonRPCUser) error
- GetUser2 func(ctx context.Context, req []interface{}, rsp *JsonRPCUser) error `dubbo:"getUser"`
- GetUser3 func() error
- Echo func(ctx context.Context, req interface{}) (interface{}, error) // Echo represent EchoFilter will be used
-}
-
-func (u *UserProvider2) Reference() string {
- return "UserProvider2"
-}
diff --git a/tracing/jsonrpc/go-client/profiles/dev/client.yml b/tracing/jsonrpc/go-client/profiles/dev/client.yml
deleted file mode 100644
index 3b00039..0000000
--- a/tracing/jsonrpc/go-client/profiles/dev/client.yml
+++ /dev/null
@@ -1,62 +0,0 @@
-# dubbo client yaml configure file
-
-check: true
-# client
-request_timeout : "3s"
-# connect timeout
-connect_timeout : "3s"
-
-# application config
-application:
- organization : "ikurento.com"
- name : "BDTService"
- module : "dubbogo user-info client"
- version : "0.0.1"
- owner : "ZX"
- environment : "dev"
-
-registries :
- "hangzhouzk":
- protocol: "zookeeper"
- timeout : "3s"
- address: "127.0.0.1:2181"
- username: ""
- password: ""
- "shanghaizk":
- protocol: "zookeeper"
- timeout : "3s"
- address: "127.0.0.1:2182"
- username: ""
- password: ""
-
-references:
- "UserProvider":
- # 可以指定多个registry,使用逗号隔开;不指定默认向所有注册中心注册
- registry: "hangzhouzk"
- protocol : "jsonrpc"
- interface : "com.ikurento.user.UserProvider"
- cluster: "failover"
- methods :
- - name: "GetUser"
- retries: 3
- "UserProvider1":
- registry: "hangzhouzk"
- protocol: "jsonrpc"
- version : "2.0"
- interface: "com.ikurento.user.UserProvider"
- cluster: "failover"
- methods:
- - name: "GetUser"
- retries: 3
- "UserProvider2":
- registry: "hangzhouzk"
- protocol: "jsonrpc"
- version : "2.0"
- group: "as"
- interface: "com.ikurento.user.UserProvider"
- cluster: "failover"
- methods:
- - name: "GetUser"
- retries: 3
-
-filter: "tracing"
diff --git a/tracing/jsonrpc/go-client/profiles/release/client.yml b/tracing/jsonrpc/go-client/profiles/release/client.yml
deleted file mode 100644
index 48b7ebe..0000000
--- a/tracing/jsonrpc/go-client/profiles/release/client.yml
+++ /dev/null
@@ -1,60 +0,0 @@
-# dubbo client yaml configure file
-
-check: true
-# client
-request_timeout : "3s"
-# connect timeout
-connect_timeout : "3s"
-
-# application config
-application:
- organization : "ikurento.com"
- name : "BDTService"
- module : "dubbogo user-info client"
- version : "0.0.1"
- owner : "ZX"
- environment : "release"
-
-registries :
- "hangzhouzk":
- protocol: "zookeeper"
- timeout : "3s"
- address: "127.0.0.1:2181"
- username: ""
- password: ""
- "shanghaizk":
- protocol: "zookeeper"
- timeout : "3s"
- address: "127.0.0.1:2182"
- username: ""
- password: ""
-
-references:
- "UserProvider":
- # 可以指定多个registry,使用逗号隔开;不指定默认向所有注册中心注册
- registry: "hangzhouzk"
- protocol : "jsonrpc"
- interface : "com.ikurento.user.UserProvider"
- cluster: "failover"
- methods :
- - name: "GetUser"
- retries: 3
- "UserProvider1":
- registry: "hangzhouzk"
- protocol: "jsonrpc"
- version : "2.0"
- interface: "com.ikurento.user.UserProvider"
- cluster: "failover"
- methods:
- - name: "GetUser"
- retries: 3
- "UserProvider2":
- registry: "hangzhouzk"
- protocol: "jsonrpc"
- version : "2.0"
- group: "as"
- interface: "com.ikurento.user.UserProvider"
- cluster: "failover"
- methods:
- - name: "GetUser"
- retries: 3
diff --git a/tracing/jsonrpc/go-client/profiles/release/log.yml b/tracing/jsonrpc/go-client/profiles/release/log.yml
deleted file mode 100644
index e0514be..0000000
--- a/tracing/jsonrpc/go-client/profiles/release/log.yml
+++ /dev/null
@@ -1,28 +0,0 @@
-
-level: "warn"
-development: true
-disableCaller: true
-disableStacktrace: true
-sampling:
-encoding: "console"
-
-# encoder
-encoderConfig:
- messageKey: "message"
- levelKey: "level"
- timeKey: "time"
- nameKey: "logger"
- callerKey: "caller"
- stacktraceKey: "stacktrace"
- lineEnding: ""
- levelEncoder: "capitalColor"
- timeEncoder: "iso8601"
- durationEncoder: "seconds"
- callerEncoder: "short"
- nameEncoder: ""
-
-outputPaths:
- - "stderr"
-errorOutputPaths:
- - "stderr"
-initialFields:
diff --git a/tracing/jsonrpc/go-client/profiles/test/client.yml b/tracing/jsonrpc/go-client/profiles/test/client.yml
deleted file mode 100644
index 78a21ad..0000000
--- a/tracing/jsonrpc/go-client/profiles/test/client.yml
+++ /dev/null
@@ -1,60 +0,0 @@
-# dubbo client yaml configure file
-
-check: true
-# client
-request_timeout : "3s"
-# connect timeout
-connect_timeout : "3s"
-
-# application config
-application:
- organization : "ikurento.com"
- name : "BDTService"
- module : "dubbogo user-info client"
- version : "0.0.1"
- owner : "ZX"
- environment : "test"
-
-registries :
- "hangzhouzk":
- protocol: "zookeeper"
- timeout : "3s"
- address: "127.0.0.1:2181"
- username: ""
- password: ""
- "shanghaizk":
- protocol: "zookeeper"
- timeout : "3s"
- address: "127.0.0.1:2182"
- username: ""
- password: ""
-
-references:
- "UserProvider":
- # 可以指定多个registry,使用逗号隔开;不指定默认向所有注册中心注册
- registry: "hangzhouzk"
- protocol : "jsonrpc"
- interface : "com.ikurento.user.UserProvider"
- cluster: "failover"
- methods :
- - name: "GetUser"
- retries: 3
- "UserProvider1":
- registry: "hangzhouzk"
- protocol: "jsonrpc"
- version : "2.0"
- interface: "com.ikurento.user.UserProvider"
- cluster: "failover"
- methods:
- - name: "GetUser"
- retries: 3
- "UserProvider2":
- registry: "hangzhouzk"
- protocol: "jsonrpc"
- version : "2.0"
- group: "as"
- interface: "com.ikurento.user.UserProvider"
- cluster: "failover"
- methods:
- - name: "GetUser"
- retries: 3
diff --git a/tracing/jsonrpc/go-client/profiles/test/log.yml b/tracing/jsonrpc/go-client/profiles/test/log.yml
deleted file mode 100644
index baee0b7..0000000
--- a/tracing/jsonrpc/go-client/profiles/test/log.yml
+++ /dev/null
@@ -1,28 +0,0 @@
-
-level: "info"
-development: false
-disableCaller: false
-disableStacktrace: true
-sampling:
-encoding: "console"
-
-# encoder
-encoderConfig:
- messageKey: "message"
- levelKey: "level"
- timeKey: "time"
- nameKey: "logger"
- callerKey: "caller"
- stacktraceKey: "stacktrace"
- lineEnding: ""
- levelEncoder: "capitalColor"
- timeEncoder: "iso8601"
- durationEncoder: "seconds"
- callerEncoder: "short"
- nameEncoder: ""
-
-outputPaths:
- - "stderr"
-errorOutputPaths:
- - "stderr"
-initialFields:
diff --git a/tracing/jsonrpc/go-server/app/user_provider1.go b/tracing/jsonrpc/go-server/app/user_provider1.go
deleted file mode 100644
index fa591a3..0000000
--- a/tracing/jsonrpc/go-server/app/user_provider1.go
+++ /dev/null
@@ -1,87 +0,0 @@
-package main
-
-import (
- "context"
- "fmt"
- "strconv"
-)
-
-import (
- "github.com/dubbogo/gost/log"
-)
-
-import (
- "github.com/apache/dubbo-go/config"
- perrors "github.com/pkg/errors"
-)
-
-func init() {
- config.SetProviderService(new(UserProvider1))
-}
-
-type UserProvider1 struct {
-}
-
-func (u *UserProvider1) getUser(userId string) (*User, error) {
- if user, ok := userMap[userId]; ok {
- return &user, nil
- }
-
- return nil, fmt.Errorf("invalid user id:%s", userId)
-}
-
-func (u *UserProvider1) GetUser(ctx context.Context, req []interface{}, rsp *User) error {
- var (
- err error
- user *User
- )
-
- gxlog.CInfo("req:%#v", req)
- user, err = u.getUser(req[0].(string))
- if err == nil {
- *rsp = *user
- gxlog.CInfo("rsp:%#v", rsp)
- }
- return err
-}
-
-func (u *UserProvider1) GetUser0(id string, name string) (User, error) {
- var err error
-
- gxlog.CInfo("id:%s, name:%s", id, name)
- user, err := u.getUser(id)
- if err != nil {
- return User{}, err
- }
- if user.Name != name {
- return User{}, perrors.New("name is not " + user.Name)
- }
- return *user, err
-}
-
-func (u *UserProvider1) GetUser2(ctx context.Context, req []interface{}, rsp *User) error {
- var err error
-
- gxlog.CInfo("req:%#v", req)
- rsp.Id = strconv.FormatFloat(req[0].(float64), 'f', 0, 64)
- rsp.Sex = Gender(MAN).String()
- return err
-}
-
-func (u *UserProvider1) GetUser3() error {
- return nil
-}
-
-func (u *UserProvider1) GetUsers(req []interface{}) ([]User, error) {
- return []User{}, nil
-}
-
-func (s *UserProvider1) MethodMapper() map[string]string {
- return map[string]string{
- "GetUser2": "getUser",
- }
-}
-
-func (u *UserProvider1) Reference() string {
- return "UserProvider1"
-}
diff --git a/tracing/jsonrpc/go-server/app/user_provider2.go b/tracing/jsonrpc/go-server/app/user_provider2.go
deleted file mode 100644
index 64e0855..0000000
--- a/tracing/jsonrpc/go-server/app/user_provider2.go
+++ /dev/null
@@ -1,97 +0,0 @@
-package main
-
-import (
- "context"
- "fmt"
- "strconv"
-)
-
-import (
- "github.com/dubbogo/gost/log"
- perrors "github.com/pkg/errors"
-)
-
-import (
- "github.com/apache/dubbo-go/config"
-)
-
-func init() {
- config.SetProviderService(new(UserProvider2))
-}
-
-type UserProvider2 struct {
-}
-
-func (u *UserProvider2) getUser(userId string) (*User, error) {
- if user, ok := userMap[userId]; ok {
- return &user, nil
- }
-
- return nil, fmt.Errorf("invalid user id:%s", userId)
-}
-
-func (u *UserProvider2) GetUser(ctx context.Context, req []interface{}, rsp *User) error {
- var (
- err error
- user *User
- )
-
- gxlog.CInfo("req:%#v", req)
- user, err = u.getUser(req[0].(string))
- if err == nil {
- *rsp = *user
- gxlog.CInfo("rsp:%#v", rsp)
- }
- return err
-}
-
-func (u *UserProvider2) GetUser0(id string, name string) (User, error) {
- var err error
-
- gxlog.CInfo("id:%s, name:%s", id, name)
- user, err := u.getUser(id)
- if err != nil {
- return User{}, err
- }
- if user.Name != name {
- return User{}, perrors.New("name is not " + user.Name)
- }
- return *user, err
-}
-
-func (u *UserProvider2) GetUser2(ctx context.Context, req []interface{}, rsp *User) error {
- var err error
-
- gxlog.CInfo("req:%#v", req)
- rsp.Id = strconv.FormatFloat(req[0].(float64), 'f', 0, 64)
- rsp.Sex = Gender(MAN).String()
- return err
-}
-
-func (u *UserProvider2) GetUser3() error {
- return nil
-}
-
-func (u *UserProvider2) GetUsers(req []interface{}) ([]User, error) {
- var err error
-
- gxlog.CInfo("req:%s", req)
- t := req[0].([]interface{})
- user, err := u.getUser(t[0].(string))
- if err != nil {
- return nil, err
- }
- gxlog.CInfo("user:%v", user)
-
- return []User{*user}, err
-}
-
-func (s *UserProvider2) MethodMapper() map[string]string {
- return map[string]string{
- "GetUser2": "getUser",
- }
-}
-
-func (u *UserProvider2) Reference() string {
- return "UserProvider2"
-}
diff --git a/tracing/jsonrpc/go-server/app/version.go b/tracing/jsonrpc/go-server/app/version.go
deleted file mode 100644
index ae51f45..0000000
--- a/tracing/jsonrpc/go-server/app/version.go
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package main
-
-var (
- Version = "2.7.5"
-)
diff --git a/tracing/jsonrpc/go-server/assembly/bin/load.sh b/tracing/jsonrpc/go-server/assembly/bin/load.sh
deleted file mode 100644
index 90077c2..0000000
--- a/tracing/jsonrpc/go-server/assembly/bin/load.sh
+++ /dev/null
@@ -1,151 +0,0 @@
-#!/usr/bin/env bash
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-APP_NAME="APPLICATION_NAME"
-APP_ARGS=""
-
-
-PROJECT_HOME=""
-OS_NAME=`uname`
-if [[ ${OS_NAME} != "Windows" ]]; then
- PROJECT_HOME=`pwd`
- PROJECT_HOME=${PROJECT_HOME}"/"
-fi
-
-export CONF_PROVIDER_FILE_PATH=${PROJECT_HOME}"TARGET_CONF_FILE"
-export APP_LOG_CONF_FILE=${PROJECT_HOME}"TARGET_LOG_CONF_FILE"
-
-usage() {
- echo "Usage: $0 start [conf suffix]"
- echo " $0 stop"
- echo " $0 term"
- echo " $0 restart"
- echo " $0 list"
- echo " $0 monitor"
- echo " $0 crontab"
- exit
-}
-
-start() {
- arg=$1
- if [ "$arg" = "" ];then
- echo "No registry type! Default server.yml!"
- else
- export CONF_PROVIDER_FILE_PATH=${CONF_PROVIDER_FILE_PATH//\.yml/\_$arg\.yml}
- fi
- if [ ! -f "${CONF_PROVIDER_FILE_PATH}" ];then
- echo $CONF_PROVIDER_FILE_PATH" is not existing!"
- return
- fi
- APP_LOG_PATH="${PROJECT_HOME}logs/"
- mkdir -p ${APP_LOG_PATH}
- APP_BIN=${PROJECT_HOME}sbin/${APP_NAME}
- chmod u+x ${APP_BIN}
- # CMD="nohup ${APP_BIN} ${APP_ARGS} >>${APP_NAME}.nohup.out 2>&1 &"
- CMD="${APP_BIN}"
- eval ${CMD}
- PID=`ps aux | grep -w ${APP_NAME} | grep -v grep | awk '{print $2}'`
- if [[ ${OS_NAME} != "Linux" && ${OS_NAME} != "Darwin" ]]; then
- PID=`ps aux | grep -w ${APP_NAME} | grep -v grep | awk '{print $1}'`
- fi
- CUR=`date +%FT%T`
- if [ "${PID}" != "" ]; then
- for p in ${PID}
- do
- echo "start ${APP_NAME} ( pid =" ${p} ") at " ${CUR}
- done
- fi
-}
-
-stop() {
- PID=`ps aux | grep -w ${APP_NAME} | grep -v grep | awk '{print $2}'`
- if [[ ${OS_NAME} != "Linux" && ${OS_NAME} != "Darwin" ]]; then
- PID=`ps aux | grep -w ${APP_NAME} | grep -v grep | awk '{print $1}'`
- fi
- if [ "${PID}" != "" ];
- then
- for ps in ${PID}
- do
- echo "kill -SIGINT ${APP_NAME} ( pid =" ${ps} ")"
- kill -2 ${ps}
- done
- fi
-}
-
-
-term() {
- PID=`ps aux | grep -w ${APP_NAME} | grep -v grep | awk '{print $2}'`
- if [[ ${OS_NAME} != "Linux" && ${OS_NAME} != "Darwin" ]]; then
- PID=`ps aux | grep -w ${APP_NAME} | grep -v grep | awk '{print $1}'`
- fi
- if [ "${PID}" != "" ];
- then
- for ps in ${PID}
- do
- echo "kill -9 ${APP_NAME} ( pid =" ${ps} ")"
- kill -9 ${ps}
- done
- fi
-}
-
-list() {
- PID=`ps aux | grep -w ${APP_NAME} | grep -v grep | awk '{printf("%s,%s,%s,%s\n", $1, $2, $9, $10)}'`
- if [[ ${OS_NAME} != "Linux" && ${OS_NAME} != "Darwin" ]]; then
- PID=`ps aux | grep -w ${APP_NAME} | grep -v grep | awk '{printf("%s,%s,%s,%s,%s\n", $1, $4, $6, $7, $8)}'`
- fi
-
- if [ "${PID}" != "" ]; then
- echo "list ${APP_NAME}"
-
- if [[ ${OS_NAME} == "Linux" || ${OS_NAME} == "Darwin" ]]; then
- echo "index: user, pid, start, duration"
- else
- echo "index: PID, WINPID, UID, STIME, COMMAND"
- fi
- idx=0
- for ps in ${PID}
- do
- echo "${idx}: ${ps}"
- ((idx ++))
- done
- fi
-}
-
-opt=$1
-case C"$opt" in
- Cstart)
- start $2
- ;;
- Cstop)
- stop
- ;;
- Cterm)
- term
- ;;
- Crestart)
- term
- start $2
- ;;
- Clist)
- list
- ;;
- C*)
- usage
- ;;
-esac
-
diff --git a/tracing/jsonrpc/go-server/assembly/common/app.properties b/tracing/jsonrpc/go-server/assembly/common/app.properties
deleted file mode 100644
index 1f0827e..0000000
--- a/tracing/jsonrpc/go-server/assembly/common/app.properties
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-TARGET_EXEC_NAME="user_info_server"
-# BUILD_PACKAGE="dubbogo-examples/user-info/server/app"
-BUILD_PACKAGE="app"
-
-TARGET_CONF_FILE="conf/server.yml"
-TARGET_LOG_CONF_FILE="conf/log.yml"
diff --git a/tracing/jsonrpc/go-server/assembly/common/build.sh b/tracing/jsonrpc/go-server/assembly/common/build.sh
deleted file mode 100644
index d90d026..0000000
--- a/tracing/jsonrpc/go-server/assembly/common/build.sh
+++ /dev/null
@@ -1,80 +0,0 @@
-#!/usr/bin/env bash
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-rm -rf target/
-
-PROJECT_HOME=`pwd`
-TARGET_FOLDER=${PROJECT_HOME}/target/${GOOS}
-
-TARGET_SBIN_NAME=${TARGET_EXEC_NAME}
-version=`cat app/version.go | grep Version | grep -v "Apache" | awk -F '=' '{print $2}' | awk -F '"' '{print $2}'`
-if [[ ${GOOS} == "windows" ]]; then
- TARGET_SBIN_NAME=${TARGET_SBIN_NAME}.exe
-fi
-TARGET_NAME=${TARGET_FOLDER}/${TARGET_SBIN_NAME}
-if [[ $PROFILE = "test" ]]; then
- # GFLAGS=-gcflags "-N -l" -race -x -v # -x会把go build的详细过程输出
- # GFLAGS=-gcflags "-N -l" -race -v
- # GFLAGS="-gcflags \"-N -l\" -v"
- cd ${BUILD_PACKAGE} && GO111MODULE=on go build -gcflags "-N -l" -x -v -i -o ${TARGET_NAME} && cd -
-else
- # -s去掉符号表(然后panic时候的stack trace就没有任何文件名/行号信息了,这个等价于普通C/C++程序被strip的效果),
- # -w去掉DWARF调试信息,得到的程序就不能用gdb调试了。-s和-w也可以分开使用,一般来说如果不打算用gdb调试,
- # -w基本没啥损失。-s的损失就有点大了。
- cd ${BUILD_PACKAGE} && GO111MODULE=on go build -ldflags "-w" -x -v -i -o ${TARGET_NAME} && cd -
-fi
-
-TAR_NAME=${TARGET_EXEC_NAME}-${version}-`date "+%Y%m%d-%H%M"`-${PROFILE}
-
-mkdir -p ${TARGET_FOLDER}/${TAR_NAME}
-
-SBIN_DIR=${TARGET_FOLDER}/${TAR_NAME}/sbin
-BIN_DIR=${TARGET_FOLDER}/${TAR_NAME}
-CONF_DIR=${TARGET_FOLDER}/${TAR_NAME}/conf
-
-mkdir -p ${SBIN_DIR}
-mkdir -p ${CONF_DIR}
-
-mv ${TARGET_NAME} ${SBIN_DIR}
-cp -r assembly/bin ${BIN_DIR}
-# modify APPLICATION_NAME
-# OS=`uname`
-# if [[ $OS=="Darwin" ]]; then
-if [ "$(uname)" == "Darwin" ]; then
- sed -i "" "s~APPLICATION_NAME~${TARGET_EXEC_NAME}~g" ${BIN_DIR}/bin/*
-else
- sed -i "s~APPLICATION_NAME~${TARGET_EXEC_NAME}~g" ${BIN_DIR}/bin/*
-fi
-# modify TARGET_CONF_FILE
-if [ "$(uname)" == "Darwin" ]; then
- sed -i "" "s~TARGET_CONF_FILE~${TARGET_CONF_FILE}~g" ${BIN_DIR}/bin/*
-else
- sed -i "s~TARGET_CONF_FILE~${TARGET_CONF_FILE}~g" ${BIN_DIR}/bin/*
-fi
-# modify TARGET_LOG_CONF_FILE
-if [ "$(uname)" == "Darwin" ]; then
- sed -i "" "s~TARGET_LOG_CONF_FILE~${TARGET_LOG_CONF_FILE}~g" ${BIN_DIR}/bin/*
-else
- sed -i "s~TARGET_LOG_CONF_FILE~${TARGET_LOG_CONF_FILE}~g" ${BIN_DIR}/bin/*
-fi
-
-cp -r profiles/${PROFILE}/* ${CONF_DIR}
-
-cd ${TARGET_FOLDER}
-
-tar czf ${TAR_NAME}.tar.gz ${TAR_NAME}/*
-
diff --git a/tracing/jsonrpc/go-server/assembly/linux/dev.sh b/tracing/jsonrpc/go-server/assembly/linux/dev.sh
deleted file mode 100644
index d830ac9..0000000
--- a/tracing/jsonrpc/go-server/assembly/linux/dev.sh
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/env bash
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-
-set -e
-
-export GOOS=linux
-export GOARCH=amd64
-
-PROFILE=dev
-
-PROJECT_HOME=`pwd`
-
-if [ -f "${PROJECT_HOME}/assembly/common/app.properties" ]; then
-. ${PROJECT_HOME}/assembly/common/app.properties
-fi
-
-
-if [ -f "${PROJECT_HOME}/assembly/common/build.sh" ]; then
-. ${PROJECT_HOME}/assembly/common/build.sh
-fi
diff --git a/tracing/jsonrpc/go-server/assembly/linux/release.sh b/tracing/jsonrpc/go-server/assembly/linux/release.sh
deleted file mode 100644
index 9930380..0000000
--- a/tracing/jsonrpc/go-server/assembly/linux/release.sh
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/env bash
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-
-set -e
-
-export GOOS=linux
-export GOARCH=amd64
-
-PROFILE=release
-
-PROJECT_HOME=`pwd`
-
-if [ -f "${PROJECT_HOME}/assembly/common/app.properties" ]; then
-. ${PROJECT_HOME}/assembly/common/app.properties
-fi
-
-
-if [ -f "${PROJECT_HOME}/assembly/common/build.sh" ]; then
-. ${PROJECT_HOME}/assembly/common/build.sh
-fi
diff --git a/tracing/jsonrpc/go-server/assembly/linux/test.sh b/tracing/jsonrpc/go-server/assembly/linux/test.sh
deleted file mode 100644
index 87144bb..0000000
--- a/tracing/jsonrpc/go-server/assembly/linux/test.sh
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/env bash
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-
-set -e
-
-export GOOS=linux
-export GOARCH=amd64
-
-PROFILE=test
-
-PROJECT_HOME=`pwd`
-
-if [ -f "${PROJECT_HOME}/assembly/common/app.properties" ]; then
-. ${PROJECT_HOME}/assembly/common/app.properties
-fi
-
-
-if [ -f "${PROJECT_HOME}/assembly/common/build.sh" ]; then
-. ${PROJECT_HOME}/assembly/common/build.sh
-fi
diff --git a/tracing/jsonrpc/go-server/assembly/mac/dev.sh b/tracing/jsonrpc/go-server/assembly/mac/dev.sh
deleted file mode 100644
index 3a7659b..0000000
--- a/tracing/jsonrpc/go-server/assembly/mac/dev.sh
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/env bash
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-
-set -e
-
-export GOOS=darwin
-export GOARCH=amd64
-
-PROFILE=dev
-
-PROJECT_HOME=`pwd`
-
-if [ -f "${PROJECT_HOME}/assembly/common/app.properties" ]; then
-. ${PROJECT_HOME}/assembly/common/app.properties
-fi
-
-
-if [ -f "${PROJECT_HOME}/assembly/common/build.sh" ]; then
-. ${PROJECT_HOME}/assembly/common/build.sh
-fi
diff --git a/tracing/jsonrpc/go-server/assembly/mac/release.sh b/tracing/jsonrpc/go-server/assembly/mac/release.sh
deleted file mode 100644
index 1c4bce4..0000000
--- a/tracing/jsonrpc/go-server/assembly/mac/release.sh
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/env bash
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-
-set -e
-
-export GOOS=darwin
-export GOARCH=amd64
-
-PROFILE=release
-
-PROJECT_HOME=`pwd`
-
-if [ -f "${PROJECT_HOME}/assembly/common/app.properties" ]; then
-. ${PROJECT_HOME}/assembly/common/app.properties
-fi
-
-
-if [ -f "${PROJECT_HOME}/assembly/common/build.sh" ]; then
-. ${PROJECT_HOME}/assembly/common/build.sh
-fi
diff --git a/tracing/jsonrpc/go-server/assembly/mac/test.sh b/tracing/jsonrpc/go-server/assembly/mac/test.sh
deleted file mode 100644
index 69206e3..0000000
--- a/tracing/jsonrpc/go-server/assembly/mac/test.sh
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/env bash
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-set -e
-
-export GOOS=darwin
-export GOARCH=amd64
-
-PROFILE=test
-
-PROJECT_HOME=`pwd`
-
-if [ -f "${PROJECT_HOME}/assembly/common/app.properties" ]; then
-. ${PROJECT_HOME}/assembly/common/app.properties
-fi
-
-
-if [ -f "${PROJECT_HOME}/assembly/common/build.sh" ]; then
-. ${PROJECT_HOME}/assembly/common/build.sh
-fi
-
diff --git a/tracing/jsonrpc/go-server/assembly/windows/dev.sh b/tracing/jsonrpc/go-server/assembly/windows/dev.sh
deleted file mode 100644
index 011fb41..0000000
--- a/tracing/jsonrpc/go-server/assembly/windows/dev.sh
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/env bash
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-
-set -e
-
-export GOOS=windows
-export GOARCH=amd64
-
-PROFILE=dev
-
-PROJECT_HOME=`pwd`
-
-if [ -f "${PROJECT_HOME}/assembly/common/app.properties" ]; then
-. ${PROJECT_HOME}/assembly/common/app.properties
-fi
-
-
-if [ -f "${PROJECT_HOME}/assembly/common/build.sh" ]; then
-. ${PROJECT_HOME}/assembly/common/build.sh
-fi
diff --git a/tracing/jsonrpc/go-server/assembly/windows/release.sh b/tracing/jsonrpc/go-server/assembly/windows/release.sh
deleted file mode 100644
index 679a26a..0000000
--- a/tracing/jsonrpc/go-server/assembly/windows/release.sh
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/env bash
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-
-set -e
-
-export GOOS=windows
-export GOARCH=amd64
-
-PROFILE=release
-
-PROJECT_HOME=`pwd`
-
-if [ -f "${PROJECT_HOME}/assembly/common/app.properties" ]; then
-. ${PROJECT_HOME}/assembly/common/app.properties
-fi
-
-
-if [ -f "${PROJECT_HOME}/assembly/common/build.sh" ]; then
-. ${PROJECT_HOME}/assembly/common/build.sh
-fi
diff --git a/tracing/jsonrpc/go-server/assembly/windows/test.sh b/tracing/jsonrpc/go-server/assembly/windows/test.sh
deleted file mode 100644
index 4a36de0..0000000
--- a/tracing/jsonrpc/go-server/assembly/windows/test.sh
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/env bash
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-
-set -e
-
-export GOOS=windows
-export GOARCH=amd64
-
-PROFILE=test
-
-PROJECT_HOME=`pwd`
-
-if [ -f "${PROJECT_HOME}/assembly/common/app.properties" ]; then
-. ${PROJECT_HOME}/assembly/common/app.properties
-fi
-
-
-if [ -f "${PROJECT_HOME}/assembly/common/build.sh" ]; then
-. ${PROJECT_HOME}/assembly/common/build.sh
-fi
diff --git a/tracing/jsonrpc/go-server/app/server.go b/tracing/jsonrpc/go-server/cmd/server.go
similarity index 92%
rename from tracing/jsonrpc/go-server/app/server.go
rename to tracing/jsonrpc/go-server/cmd/server.go
index 90f6042..8786ddd 100644
--- a/tracing/jsonrpc/go-server/app/server.go
+++ b/tracing/jsonrpc/go-server/cmd/server.go
@@ -26,23 +26,20 @@ import (
)
import (
+ "github.com/apache/dubbo-samples/golang/tracing/jsonrpc/go-server/pkg"
"github.com/opentracing/opentracing-go"
zipkinot "github.com/openzipkin-contrib/zipkin-go-opentracing"
"github.com/openzipkin/zipkin-go"
zipkinhttp "github.com/openzipkin/zipkin-go/reporter/http"
-)
-import (
+ _ "github.com/apache/dubbo-go/cluster/cluster_impl"
+ _ "github.com/apache/dubbo-go/cluster/loadbalance"
"github.com/apache/dubbo-go/common/logger"
_ "github.com/apache/dubbo-go/common/proxy/proxy_factory"
"github.com/apache/dubbo-go/config"
+ _ "github.com/apache/dubbo-go/filter/filter_impl"
_ "github.com/apache/dubbo-go/protocol/jsonrpc"
_ "github.com/apache/dubbo-go/registry/protocol"
-
- _ "github.com/apache/dubbo-go/filter/filter_impl"
-
- _ "github.com/apache/dubbo-go/cluster/cluster_impl"
- _ "github.com/apache/dubbo-go/cluster/loadbalance"
_ "github.com/apache/dubbo-go/registry/zookeeper"
)
@@ -50,41 +47,15 @@ var (
survivalTimeout = int(3e9)
)
-// they are necessary:
-// export CONF_PROVIDER_FILE_PATH="xxx"
-// export APP_LOG_CONF_FILE="xxx"
+// need to setup environment variable "CONF_PROVIDER_FILE_PATH" to "conf/server.yml" before run
func main() {
-
+ config.SetProviderService(new(pkg.UserProvider))
config.Load()
initZipkin()
-
initSignal()
}
-func initSignal() {
- signals := make(chan os.Signal, 1)
- // It is not possible to block SIGKILL or syscall.SIGSTOP
- signal.Notify(signals, os.Interrupt, os.Kill, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT)
- for {
- sig := <-signals
- logger.Infof("get signal %s", sig.String())
- switch sig {
- case syscall.SIGHUP:
- // reload()
- default:
- time.AfterFunc(time.Duration(survivalTimeout), func() {
- logger.Warnf("app exit now by force...")
- os.Exit(1)
- })
-
- // The program exits normally or timeout forcibly exits.
- fmt.Println("provider app exit now...")
- return
- }
- }
-}
-
func initZipkin() {
// set up a span reporter
reporter := zipkinhttp.NewReporter("http://localhost:9411/api/v2/spans")
@@ -107,3 +78,26 @@ func initZipkin() {
// optionally set as Global OpenTracing tracer instance
opentracing.SetGlobalTracer(tracer)
}
+
+func initSignal() {
+ signals := make(chan os.Signal, 1)
+ // It is not possible to block SIGKILL or syscall.SIGSTOP
+ signal.Notify(signals, os.Interrupt, os.Kill, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT)
+ for {
+ sig := <-signals
+ logger.Infof("get signal %s", sig.String())
+ switch sig {
+ case syscall.SIGHUP:
+ // reload()
+ default:
+ time.AfterFunc(time.Duration(survivalTimeout), func() {
+ logger.Warnf("app exit now by force...")
+ os.Exit(1)
+ })
+
+ // The program exits normally or timeout forcibly exits.
+ fmt.Println("provider app exit now...")
+ return
+ }
+ }
+}
\ No newline at end of file
diff --git a/tracing/jsonrpc/go-server/conf/client.yml b/tracing/jsonrpc/go-server/conf/client.yml
new file mode 100644
index 0000000..4088a9a
--- /dev/null
+++ b/tracing/jsonrpc/go-server/conf/client.yml
@@ -0,0 +1,59 @@
+# dubbo client yaml configure file
+
+check: true
+# client
+request_timeout: "3s"
+# connect timeout
+connect_timeout: "3s"
+
+# application config
+application:
+ organization: "dubbo.io"
+ name: "UserInfoTest"
+ module: "dubbo-go user-info client"
+ version: "0.0.1"
+ environment: "dev"
+
+# registry config
+registries:
+ "demoZk":
+ protocol: "zookeeper"
+ timeout: "3s"
+ address: "127.0.0.1:2181"
+ username: ""
+ password: ""
+
+# reference config
+references:
+ "UserProvider":
+ registry: "demoZk"
+ protocol: "jsonrpc"
+ interface: "org.apache.dubbo.UserProvider"
+ cluster: "failover"
+ methods:
+ - name: "GetUser"
+ retries: 3
+
+# protocol config
+protocol_conf:
+ jsonrpc:
+ reconnect_interval: 0
+ connection_number: 1
+ heartbeat_period: "5s"
+ session_timeout: "180s"
+ pool_size: 64
+ pool_ttl: 600
+ getty_session_param:
+ compress_encoding: false
+ tcp_no_delay: true
+ tcp_keep_alive: true
+ keep_alive_period: "120s"
+ tcp_r_buf_size: 262144
+ tcp_w_buf_size: 65536
+ pkg_rq_size: 1024
+ pkg_wq_size: 512
+ tcp_read_timeout: "1s"
+ tcp_write_timeout: "5s"
+ wait_timeout: "1s"
+ max_msg_len: 1024000
+ session_name: "client"
diff --git a/tracing/jsonrpc/go-server/profiles/dev/log.yml b/tracing/jsonrpc/go-server/conf/log.yml
similarity index 88%
rename from tracing/jsonrpc/go-server/profiles/dev/log.yml
rename to tracing/jsonrpc/go-server/conf/log.yml
index 59fa427..2b6e93a 100644
--- a/tracing/jsonrpc/go-server/profiles/dev/log.yml
+++ b/tracing/jsonrpc/go-server/conf/log.yml
@@ -1,28 +1,27 @@
-
-level: "debug"
-development: true
-disableCaller: false
-disableStacktrace: false
-sampling:
-encoding: "console"
-
-# encoder
-encoderConfig:
- messageKey: "message"
- levelKey: "level"
- timeKey: "time"
- nameKey: "logger"
- callerKey: "caller"
- stacktraceKey: "stacktrace"
- lineEnding: ""
- levelEncoder: "capitalColor"
- timeEncoder: "iso8601"
- durationEncoder: "seconds"
- callerEncoder: "short"
- nameEncoder: ""
-
-outputPaths:
- - "stderr"
-errorOutputPaths:
- - "stderr"
-initialFields:
+level: "debug"
+development: true
+disableCaller: false
+disableStacktrace: false
+sampling:
+encoding: "console"
+
+# encoder
+encoderConfig:
+ messageKey: "message"
+ levelKey: "level"
+ timeKey: "time"
+ nameKey: "logger"
+ callerKey: "caller"
+ stacktraceKey: "stacktrace"
+ lineEnding: ""
+ levelEncoder: "capital"
+ timeEncoder: "iso8601"
+ durationEncoder: "seconds"
+ callerEncoder: "short"
+ nameEncoder: ""
+
+outputPaths:
+ - "stderr"
+errorOutputPaths:
+ - "stderr"
+initialFields:
diff --git a/tracing/jsonrpc/go-server/conf/server.yml b/tracing/jsonrpc/go-server/conf/server.yml
new file mode 100644
index 0000000..5ea8e39
--- /dev/null
+++ b/tracing/jsonrpc/go-server/conf/server.yml
@@ -0,0 +1,58 @@
+# dubbo server yaml configure file
+
+# application config
+application:
+ organization: "dubbo.io"
+ name: "UserInfoServer"
+ module: "dubbo-go user-info server"
+ version: "0.0.1"
+ environment: "dev"
+
+# registry config
+registries:
+ "demoZk":
+ protocol: "zookeeper"
+ timeout: "3s"
+ address: "127.0.0.1:2181"
+
+# service config
+services:
+ "UserProvider":
+ registry: "demoZk"
+ protocol: "jsonrpc"
+ interface: "org.apache.dubbo.UserProvider"
+ loadbalance: "random"
+ warmup: "100"
+ cluster: "failover"
+ methods:
+ - name: "GetUser"
+ retries: 1
+ loadbalance: "random"
+
+# protocol config
+protocols:
+ "jsonrpc":
+ name: "jsonrpc"
+ ip: "127.0.0.1"
+ port: 20001
+
+protocol_conf:
+ jsonrpc:
+ session_number: 700
+ session_timeout: "180s"
+ getty_session_param:
+ compress_encoding: false
+ tcp_no_delay: true
+ tcp_keep_alive: true
+ keep_alive_period: "120s"
+ tcp_r_buf_size: 262144
+ tcp_w_buf_size: 65536
+ pkg_rq_size: 1024
+ pkg_wq_size: 512
+ tcp_read_timeout: "1s"
+ tcp_write_timeout: "5s"
+ wait_timeout: "1s"
+ max_msg_len: 1024000
+ session_name: "server"
+
+filter: "tracing"
\ No newline at end of file
diff --git a/tracing/jsonrpc/go-server/docker/docker-compose.yml b/tracing/jsonrpc/go-server/docker/docker-compose.yml
new file mode 100644
index 0000000..adbc43f
--- /dev/null
+++ b/tracing/jsonrpc/go-server/docker/docker-compose.yml
@@ -0,0 +1,40 @@
+version: '3'
+
+services:
+ # Zookeeper as dubbo registry server
+ zookeeper:
+ image: zookeeper
+ ports:
+ - 2181:2181
+ restart: on-failure
+
+ # Zipkin UI
+ zipkin-ui:
+ image: openzipkin/zipkin-ui
+ container_name: zipkin-ui
+ environment:
+ # Change this if connecting to a different zipkin server
+ - ZIPKIN_BASE_URL=http://zipkin:9411
+ ports:
+ - 80:80
+ depends_on:
+ - zipkin
+
+ # The zipkin process services the UI, and also exposes a POST endpoint that
+ # instrumentation can send trace data to. Scribe is enabled by default.
+ zipkin:
+ image: openzipkin/zipkin
+ container_name: zipkin
+ # Environment settings are defined here https://github.com/openzipkin/zipkin/blob/master/zipkin-server/README.md#environment-variables
+ environment:
+ - STORAGE_TYPE=mem
+ # Uncomment to disable scribe
+ # - SCRIBE_ENABLED=false
+ # Uncomment to enable self-tracing
+ # - SELF_TRACING_ENABLED=true
+ # Uncomment to enable debug logging
+ # - JAVA_OPTS=-Dlogging.level.zipkin=DEBUG
+ ports:
+ # Port used for the Zipkin UI and HTTP Api
+ - 9411:9411
+
diff --git a/tracing/jsonrpc/go-server/app/user.go b/tracing/jsonrpc/go-server/pkg/user.go
similarity index 98%
rename from tracing/jsonrpc/go-server/app/user.go
rename to tracing/jsonrpc/go-server/pkg/user.go
index e1df07a..30a2e43 100644
--- a/tracing/jsonrpc/go-server/app/user.go
+++ b/tracing/jsonrpc/go-server/pkg/user.go
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package main
+package pkg
import (
"time"
@@ -64,7 +64,7 @@ func init() {
userMap["A000"] = DefaultUser
userMap["A001"] = User{Id: "001", Name: "ZhangSheng", Age: 18, sex: MAN}
userMap["A002"] = User{Id: "002", Name: "Lily", Age: 20, sex: WOMAN}
- userMap["A003"] = User{Id: "113", Name: "Moorse", Age: 30, sex: MAN}
+ userMap["A003"] = User{Id: "113", Name: "Moorse", Age: 30, sex: WOMAN}
for k, v := range userMap {
v.Birth = int(time.Now().AddDate(-1*v.Age, 0, 0).Unix())
v.Sex = userMap[k].sex.String()
diff --git a/tracing/jsonrpc/go-server/app/user_provider.go b/tracing/jsonrpc/go-server/pkg/user_provider.go
similarity index 65%
rename from tracing/jsonrpc/go-server/app/user_provider.go
rename to tracing/jsonrpc/go-server/pkg/user_provider.go
index 95d3256..15bd8af 100644
--- a/tracing/jsonrpc/go-server/app/user_provider.go
+++ b/tracing/jsonrpc/go-server/pkg/user_provider.go
@@ -1,4 +1,21 @@
-package main
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package pkg
import (
"context"
@@ -10,17 +27,9 @@ import (
import (
"github.com/dubbogo/gost/log"
"github.com/opentracing/opentracing-go"
-)
-
-import (
- "github.com/apache/dubbo-go/config"
perrors "github.com/pkg/errors"
)
-func init() {
- config.SetProviderService(new(UserProvider))
-}
-
type UserProvider struct {
}
@@ -42,12 +51,12 @@ func (u *UserProvider) GetUser(ctx context.Context, req []interface{}, rsp *User
gxlog.CInfo("ctx is nil %v")
ctx = context.Background()
}
- span, _ := opentracing.StartSpanFromContext(ctx, "User-Provider-non")
+ span, _ := opentracing.StartSpanFromContext(ctx, "User-Provider-GetUser")
defer span.Finish()
+
gxlog.CInfo("req:%#v", req)
- if ctx != nil {
- gxlog.CInfo("tracing Id: %v", ctx.Value("TracingId"))
- }
+ gxlog.CInfo("tracing Id: %v", ctx.Value("TracingId"))
+
time.Sleep(10 * time.Millisecond)
user, err = u.getUser(req[0].(string))
if err == nil {
@@ -74,6 +83,13 @@ func (u *UserProvider) GetUser0(id string, name string) (User, error) {
func (u *UserProvider) GetUser2(ctx context.Context, req []interface{}, rsp *User) error {
var err error
+ if ctx == nil {
+ gxlog.CInfo("ctx is nil %v")
+ ctx = context.Background()
+ }
+ span, _ := opentracing.StartSpanFromContext(ctx, "User-Provider-GetUser2")
+ defer span.Finish()
+
gxlog.CInfo("req:%#v", req)
rsp.Id = strconv.FormatFloat(req[0].(float64), 'f', 0, 64)
rsp.Sex = Gender(MAN).String()
diff --git a/tracing/jsonrpc/go-server/profiles/dev/server.yml b/tracing/jsonrpc/go-server/profiles/dev/server.yml
deleted file mode 100644
index 1f1668d..0000000
--- a/tracing/jsonrpc/go-server/profiles/dev/server.yml
+++ /dev/null
@@ -1,76 +0,0 @@
-# dubbo server yaml configure file
-
-# application config
-application:
- organization : "ikurento.com"
- name : "BDTService"
- module : "dubbogo user-info server"
- version : "0.0.1"
- owner : "ZX"
- environment : "dev"
-
-registries :
- "hangzhouzk":
- protocol: "zookeeper"
- timeout : "3s"
- address: "127.0.0.1:2181"
- username: ""
- password: ""
- "shanghaizk":
- protocol: "zookeeper"
- timeout : "3s"
- address: "127.0.0.1:2182"
- username: ""
- password: ""
-
-
-services:
- "UserProvider":
- # 可以指定多个registry,使用逗号隔开;不指定默认向所有注册中心注册
- registry: "hangzhouzk"
- protocol : "jsonrpc"
- # 相当于dubbo.xml中的interface
- interface : "com.ikurento.user.UserProvider"
- loadbalance: "random"
- warmup: "100"
- cluster: "failover"
- methods:
- - name: "GetUser"
- retries: 1
- loadbalance: "random"
- "UserProvider1":
- registry: "hangzhouzk"
- protocol: "jsonrpc"
- interface: "com.ikurento.user.UserProvider"
- loadbalance: "random"
- version: "2.0"
- warmup: "100"
- cluster: "failover"
- methods:
- - name: "GetUser"
- retries: 1
- loadbalance: "random"
- "UserProvider2":
- registry: "hangzhouzk"
- protocol: "jsonrpc"
- interface: "com.ikurento.user.UserProvider"
- loadbalance: "random"
- version: "2.0"
- group: "as"
- warmup: "100"
- cluster: "failover"
- methods:
- - name: "GetUser"
- retries: 1
- loadbalance: "random"
-
-protocols:
- #- name: "dubbo"
- # ip : "127.0.0.1"
- # port : 20000
- "jsonrpc":
- name: "jsonrpc"
- ip: "127.0.0.1"
- port: 20001
-
-filter: "tracing"
diff --git a/tracing/jsonrpc/go-server/profiles/release/log.yml b/tracing/jsonrpc/go-server/profiles/release/log.yml
deleted file mode 100644
index e0514be..0000000
--- a/tracing/jsonrpc/go-server/profiles/release/log.yml
+++ /dev/null
@@ -1,28 +0,0 @@
-
-level: "warn"
-development: true
-disableCaller: true
-disableStacktrace: true
-sampling:
-encoding: "console"
-
-# encoder
-encoderConfig:
- messageKey: "message"
- levelKey: "level"
- timeKey: "time"
- nameKey: "logger"
- callerKey: "caller"
- stacktraceKey: "stacktrace"
- lineEnding: ""
- levelEncoder: "capitalColor"
- timeEncoder: "iso8601"
- durationEncoder: "seconds"
- callerEncoder: "short"
- nameEncoder: ""
-
-outputPaths:
- - "stderr"
-errorOutputPaths:
- - "stderr"
-initialFields:
diff --git a/tracing/jsonrpc/go-server/profiles/release/server.yml b/tracing/jsonrpc/go-server/profiles/release/server.yml
deleted file mode 100644
index f7e435b..0000000
--- a/tracing/jsonrpc/go-server/profiles/release/server.yml
+++ /dev/null
@@ -1,75 +0,0 @@
-# dubbo server yaml configure file
-
-# application config
-application:
- organization : "ikurento.com"
- name : "BDTService"
- module : "dubbogo user-info server"
- version : "0.0.1"
- owner : "ZX"
- environment : "release"
-
-registries :
- "hangzhouzk":
- protocol: "zookeeper"
- timeout : "3s"
- address: "127.0.0.1:2181"
- username: ""
- password: ""
- "shanghaizk":
- protocol: "zookeeper"
- timeout : "3s"
- address: "127.0.0.1:2182"
- username: ""
- password: ""
-
-
-services:
- "UserProvider":
- # 可以指定多个registry,使用逗号隔开;不指定默认向所有注册中心注册
- registry: "hangzhouzk"
- protocol : "jsonrpc"
- # 相当于dubbo.xml中的interface
- interface : "com.ikurento.user.UserProvider"
- loadbalance: "random"
- warmup: "100"
- cluster: "failover"
- methods:
- - name: "GetUser"
- retries: 1
- loadbalance: "random"
- "UserProvider1":
- registry: "hangzhouzk"
- protocol: "jsonrpc"
- interface: "com.ikurento.user.UserProvider"
- loadbalance: "random"
- version: "2.0"
- warmup: "100"
- cluster: "failover"
- methods:
- - name: "GetUser"
- retries: 1
- loadbalance: "random"
- "UserProvider2":
- registry: "hangzhouzk"
- protocol: "jsonrpc"
- interface: "com.ikurento.user.UserProvider"
- loadbalance: "random"
- version: "2.0"
- group: "as"
- warmup: "100"
- cluster: "failover"
- methods:
- - name: "GetUser"
- retries: 1
- loadbalance: "random"
-
-protocols:
- #- name: "dubbo"
- # ip : "127.0.0.1"
- # port : 20000
- "jsonrpc":
- name: "jsonrpc"
- ip: "127.0.0.1"
- port: 20001
-
diff --git a/tracing/jsonrpc/go-server/profiles/test/log.yml b/tracing/jsonrpc/go-server/profiles/test/log.yml
deleted file mode 100644
index baee0b7..0000000
--- a/tracing/jsonrpc/go-server/profiles/test/log.yml
+++ /dev/null
@@ -1,28 +0,0 @@
-
-level: "info"
-development: false
-disableCaller: false
-disableStacktrace: true
-sampling:
-encoding: "console"
-
-# encoder
-encoderConfig:
- messageKey: "message"
- levelKey: "level"
- timeKey: "time"
- nameKey: "logger"
- callerKey: "caller"
- stacktraceKey: "stacktrace"
- lineEnding: ""
- levelEncoder: "capitalColor"
- timeEncoder: "iso8601"
- durationEncoder: "seconds"
- callerEncoder: "short"
- nameEncoder: ""
-
-outputPaths:
- - "stderr"
-errorOutputPaths:
- - "stderr"
-initialFields:
diff --git a/tracing/jsonrpc/go-server/profiles/test/server.yml b/tracing/jsonrpc/go-server/profiles/test/server.yml
deleted file mode 100644
index 63bcbd2..0000000
--- a/tracing/jsonrpc/go-server/profiles/test/server.yml
+++ /dev/null
@@ -1,75 +0,0 @@
-# dubbo server yaml configure file
-
-# application config
-application:
- organization : "ikurento.com"
- name : "BDTService"
- module : "dubbogo user-info server"
- version : "0.0.1"
- owner : "ZX"
- environment : "test"
-
-registries :
- "hangzhouzk":
- protocol: "zookeeper"
- timeout : "3s"
- address: "127.0.0.1:2181"
- username: ""
- password: ""
- "shanghaizk":
- protocol: "zookeeper"
- timeout : "3s"
- address: "127.0.0.1:2182"
- username: ""
- password: ""
-
-
-services:
- "UserProvider":
- # 可以指定多个registry,使用逗号隔开;不指定默认向所有注册中心注册
- registry: "hangzhouzk"
- protocol : "jsonrpc"
- # 相当于dubbo.xml中的interface
- interface : "com.ikurento.user.UserProvider"
- loadbalance: "random"
- warmup: "100"
- cluster: "failover"
- methods:
- - name: "GetUser"
- retries: 1
- loadbalance: "random"
- "UserProvider1":
- registry: "hangzhouzk"
- protocol: "jsonrpc"
- interface: "com.ikurento.user.UserProvider"
- loadbalance: "random"
- version: "2.0"
- warmup: "100"
- cluster: "failover"
- methods:
- - name: "GetUser"
- retries: 1
- loadbalance: "random"
- "UserProvider2":
- registry: "hangzhouzk"
- protocol: "jsonrpc"
- interface: "com.ikurento.user.UserProvider"
- loadbalance: "random"
- version: "2.0"
- group: "as"
- warmup: "100"
- cluster: "failover"
- methods:
- - name: "GetUser"
- retries: 1
- loadbalance: "random"
-
-protocols:
- #- name: "dubbo"
- # ip : "127.0.0.1"
- # port : 20000
- "jsonrpc":
- name: "jsonrpc"
- ip: "127.0.0.1"
- port: 20001
-
diff --git a/tracing/jsonrpc/go-client/app/user.go b/tracing/jsonrpc/go-server/tests/integration/main_test.go
similarity index 56%
rename from tracing/jsonrpc/go-client/app/user.go
rename to tracing/jsonrpc/go-server/tests/integration/main_test.go
index c6fdbe1..ab76368 100644
--- a/tracing/jsonrpc/go-client/app/user.go
+++ b/tracing/jsonrpc/go-server/tests/integration/main_test.go
@@ -1,3 +1,5 @@
+// +build integration
+
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -15,28 +17,36 @@
* limitations under the License.
*/
-package main
+package integration
import (
- "context"
- "fmt"
- "time"
+ "github.com/apache/dubbo-go/config"
+
+ _ "github.com/apache/dubbo-go/cluster/cluster_impl"
+ _ "github.com/apache/dubbo-go/cluster/loadbalance"
+ _ "github.com/apache/dubbo-go/common/proxy/proxy_factory"
+ _ "github.com/apache/dubbo-go/filter/filter_impl"
+ _ "github.com/apache/dubbo-go/protocol/jsonrpc"
+ _ "github.com/apache/dubbo-go/registry/protocol"
+ _ "github.com/apache/dubbo-go/registry/zookeeper"
)
import (
- "github.com/apache/dubbo-go/config"
+ "context"
+ "fmt"
+ "os"
+ "testing"
+ "time"
)
-var (
- userProvider = new(UserProvider)
- userProvider1 = new(UserProvider1)
- userProvider2 = new(UserProvider2)
-)
+var userProvider = new(UserProvider)
-func init() {
+func TestMain(m *testing.M) {
config.SetConsumerService(userProvider)
- config.SetConsumerService(userProvider1)
- config.SetConsumerService(userProvider2)
+ config.Load()
+ time.Sleep(3 * time.Second)
+
+ os.Exit(m.Run())
}
type JsonRPCUser struct {
@@ -66,32 +76,4 @@ type UserProvider struct {
func (u *UserProvider) Reference() string {
return "UserProvider"
-}
-
-type UserProvider1 struct {
- GetUsers func(req []interface{}) ([]JsonRPCUser, error)
- GetUser func(ctx context.Context, req []interface{}, rsp *JsonRPCUser) error
- GetUser0 func(id string, name string) (JsonRPCUser, error)
- GetUser1 func(ctx context.Context, req []interface{}, rsp *JsonRPCUser) error
- GetUser2 func(ctx context.Context, req []interface{}, rsp *JsonRPCUser) error `dubbo:"getUser"`
- GetUser3 func() error
- Echo func(ctx context.Context, req interface{}) (interface{}, error) // Echo represent EchoFilter will be used
-}
-
-func (u *UserProvider1) Reference() string {
- return "UserProvider1"
-}
-
-type UserProvider2 struct {
- GetUsers func(req []interface{}) ([]JsonRPCUser, error)
- GetUser func(ctx context.Context, req []interface{}, rsp *JsonRPCUser) error
- GetUser0 func(id string, name string) (JsonRPCUser, error)
- GetUser1 func(ctx context.Context, req []interface{}, rsp *JsonRPCUser) error
- GetUser2 func(ctx context.Context, req []interface{}, rsp *JsonRPCUser) error `dubbo:"getUser"`
- GetUser3 func() error
- Echo func(ctx context.Context, req interface{}) (interface{}, error) // Echo represent EchoFilter will be used
-}
-
-func (u *UserProvider2) Reference() string {
- return "UserProvider2"
-}
+}
\ No newline at end of file
diff --git a/tracing/jsonrpc/go-server/tests/integration/userprovider_test.go b/tracing/jsonrpc/go-server/tests/integration/userprovider_test.go
new file mode 100644
index 0000000..82aa1c3
--- /dev/null
+++ b/tracing/jsonrpc/go-server/tests/integration/userprovider_test.go
@@ -0,0 +1,100 @@
+// +build integration
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package integration
+
+import (
+ "context"
+ "testing"
+)
+import (
+ "github.com/stretchr/testify/assert"
+)
+
+func TestGetUserA000(t *testing.T) {
+ user := &JsonRPCUser{}
+ err := userProvider.GetUser(context.TODO(), []interface{}{"A000"}, user)
+ assert.Nil(t, err)
+ assert.Equal(t, "0", user.ID)
+ assert.Equal(t, "Alex Stocks", user.Name)
+ assert.Equal(t, int64(31), user.Age)
+ assert.Equal(t, "MAN", user.Sex)
+ assert.NotNil(t, user.Time)
+}
+
+func TestGetUserA001(t *testing.T) {
+ user := &JsonRPCUser{}
+ err := userProvider.GetUser(context.TODO(), []interface{}{"A001"}, user)
+ assert.Nil(t, err)
+ assert.Equal(t, "001", user.ID)
+ assert.Equal(t, "ZhangSheng", user.Name)
+ assert.Equal(t, int64(18), user.Age)
+ assert.Equal(t, "MAN", user.Sex)
+ assert.NotNil(t, user.Time)
+}
+
+func TestGetUserA002(t *testing.T) {
+ user := &JsonRPCUser{}
+ err := userProvider.GetUser(context.TODO(), []interface{}{"A002"}, user)
+ assert.Nil(t, err)
+ assert.Equal(t, "002", user.ID)
+ assert.Equal(t, "Lily", user.Name)
+ assert.Equal(t, int64(20), user.Age)
+ assert.Equal(t, "WOMAN", user.Sex)
+ assert.NotNil(t, user.Time)
+}
+
+func TestGetUserA003(t *testing.T) {
+ user := &JsonRPCUser{}
+ err := userProvider.GetUser(context.TODO(), []interface{}{"A003"}, user)
+ assert.Nil(t, err)
+ assert.Equal(t, "113", user.ID)
+ assert.Equal(t, "Moorse", user.Name)
+ assert.Equal(t, int64(30), user.Age)
+ assert.Equal(t, "WOMAN", user.Sex)
+ assert.NotNil(t, user.Time)
+}
+
+func TestGetUser0(t *testing.T) {
+ user, err := userProvider.GetUser0("A003", "Moorse")
+ assert.Nil(t, err)
+ assert.NotNil(t, user)
+
+ user, err = userProvider.GetUser0("A003", "MOORSE")
+ assert.NotNil(t, err)
+}
+
+func TestGetUser2(t *testing.T) {
+ user := &JsonRPCUser{}
+ err := userProvider.GetUser2(context.TODO(), []interface{}{int32(64)}, user)
+ assert.Nil(t, err)
+ assert.Equal(t, "64", user.ID)
+}
+
+func TestGetUser3(t *testing.T) {
+ err := userProvider.GetUser3()
+ assert.Nil(t, err)
+}
+
+func TestGetUsers(t *testing.T) {
+ users, err := userProvider.GetUsers([]interface{}{[]interface{}{"A002", "A003"}})
+ assert.Nil(t, err)
+ assert.Equal(t, "Lily", users[0].Name)
+ assert.Equal(t, "Moorse", users[1].Name)
+}