Skip to content

Commit

Permalink
Adjust script
Browse files Browse the repository at this point in the history
  • Loading branch information
qiansheng91 committed Jul 5, 2023
1 parent 42f0fe0 commit 8e81649
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
21 changes: 15 additions & 6 deletions build_wrap.sh
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions configuration.yaml
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -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'
Expand Down

0 comments on commit 8e81649

Please sign in to comment.