diff --git a/build_wrap.sh b/build_wrap.sh index 94b3f0d..26569bb 100644 --- a/build_wrap.sh +++ b/build_wrap.sh @@ -1,19 +1,28 @@ #!/bin/bash -export TOOL_VERSION=v0.3.0 +export TOOL_VERSION=v0.4.0 go install github.com/qiansheng91/go-instrumentation-tool@${TOOL_VERSION} -wget -O /tmp/configuration.yaml "https://github.com/qiansheng91/go-instrumentation-tool/releases/download/${TOOL_VERSION}/configuration.yaml" + +if [[ ! -f /tmp/configuration.yaml ]]; then + wget -O /tmp/configuration.yaml "https://github.com/qiansheng91/go-instrumentation-tool/releases/download/${TOOL_VERSION}/configuration.yaml" +fi echo "back up go mod files" [[ -f go.mod.bak ]] && cp go.mod go.mod.bak [[ -f go.sum.bak ]] && cp go.sum go.sum.bak +[[ -f addition_deps.go]] && rm addition_deps.go export INSTRUMENT_CONFIG_FILE=/tmp/configuration.yaml ${GOPATH}/bin/go-instrumentation-tool rewrite-deps . go build -a -toolexec "${GOPATH}/bin/go-instrumentation-tool wrap" . - -echo "restore go mod files" -[[ -f go.mod.bak ]] && cp go.mod.bak go.mod && rm go.mod.bak -[[ -f go.sum.bak ]] && cp go.sum.bak go.sum && rm go.sum.bak +if [[ $? -ne 0 ]]; then + echo "failed to build package, Please check the error message above" + exit -1 +else + echo "build package successfully" + [[ -f go.mod.bak ]] && cp go.mod.bak go.mod && rm go.mod.bak + [[ -f go.sum.bak ]] && cp go.sum.bak go.sum && rm go.sum.bak + [[ -f addition_deps.go]] && rm addition_deps.go +fi diff --git a/configuration.yaml b/configuration.yaml index 4f0828f..ca178f5 100644 --- a/configuration.yaml +++ b/configuration.yaml @@ -1,5 +1,5 @@ plugins: - - package: 'github.com/qiansheng91/go-instrumentation-plugins/sls-tchannel-plugin' + - package: 'github.com/qiansheng91/go-instrumentation-plugins/sls-tchannel-trace-plugin' name: "sls-tchannel-plugin" target_packages: - packagePath: 'github.com/uber/tchannel-go' @@ -8,7 +8,7 @@ plugins: - before_advice: 'beforeNewMethod' after_advice: 'afterNewMethod' target_signature: "NewChannel" - - package: 'github.com/qiansheng91/go-instrumentation-plugins/sls-gin-plugin' + - package: 'github.com/qiansheng91/go-instrumentation-plugins/sls-gin-trace-plugin' name: "otel-gin-plugin" target_packages: - packagePath: 'github.com/gin-gonic/gin'