diff --git a/.github/workflows/publish-collector-agent.yml b/.github/workflows/publish-collector-agent.yml index 0a42deb8..4a85b234 100644 --- a/.github/workflows/publish-collector-agent.yml +++ b/.github/workflows/publish-collector-agent.yml @@ -1,7 +1,12 @@ name: publish-collector-agent on: - workflow_dispatch: + release: + types: [created] + +permissions: + contents: write + packages: write env: REGISTRY_IMAGE: ghcr.io/${{ github.repository }}/collector-agent @@ -110,3 +115,25 @@ jobs: - name: Inspect image run: | docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }} + + Release-Collector-agent: + runs-on: ubuntu-latest + strategy: + matrix: + # build and publish in parallel: linux/386, linux/amd64, linux/arm64, windows/386, windows/amd64, darwin/amd64, darwin/arm64 + goos: [linux, windows] + goarch: [amd64, arm64] + steps: + - name: Show environment + run: export + - uses: actions/checkout@v2 + - uses: wangyoucao577/go-release-action@v1 + id: release-ca + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + goversion: "https://dl.google.com/go/go1.18.10.linux-amd64.tar.gz" + goos: ${{ matrix.goos }} + goarch: ${{ matrix.goarch }} + project_path: "collector-agent" + binary_name: "collector-agent" + extra_files: LICENSE collector-agent/CHANGES.md \ No newline at end of file diff --git a/DOC/collector-agent/readme.md b/DOC/collector-agent/readme.md index 66c18da2..3e05ecbe 100644 --- a/DOC/collector-agent/readme.md +++ b/DOC/collector-agent/readme.md @@ -2,14 +2,11 @@ A bridger to pinpoint-collector. -![collector-agent](../images/pinpoint_v0.5.x.png) +![collector-agent](/images/pinpoint_v0.5.x.png) -## Install Collector Agent +## Collector Agent Guide `Collector-Agent` formats the span from PHP/Python/C/CPP-Agent and send to `Pinpoint-Collector`. -### 1. Build -- Install: `GOBIN=/usr/local/bin/ go install github.com/pinpoint-apm/pinpoint-c-agent/collector-agent@dev` - - ❗❗❗Note: collector-agent: located into `/usr/local/bin/` - Add environment variables: ``` export PP_COLLECTOR_AGENT_SPAN_IP=dev-pinpoint @@ -28,13 +25,21 @@ A bridger to pinpoint-collector. 3. `PP_LOG_DIR`: Set the path of collector-agent's log file. 4. `PP_Log_Level`: Set the log level. 5. `PP_ADDRESS`: Set the address of `collector-agent`, then `PHP/Python-Agent` will connect collector-agent through this address. -- Run `collector-agent` by executing command `./collector-agent` - + +### 1. Download from github.release + + https://github.com/pinpoint-apm/pinpoint-c-agent/releases/latest + ### 2. Use docker images +> Release page: https://github.com/pinpoint-apm/pinpoint-c-agent/pkgs/container/pinpoint-c-agent%2Fcollector-agent + +#### Example: + ```sh -docker run -itd -p 9999:9999 --env-file ./env.list ghcr.io/pinpoint-apm/pinpoint-c-agent/collector-agent:v0.6.4 +docker run -itd -p 9999:9999 --env-file ./env.list ghcr.io/pinpoint-apm/pinpoint-c-agent/collector-agent:latest ``` + ### 3. K8s side car server.yaml sample @@ -65,3 +70,11 @@ server.yaml sample - name: "PP_COLLECTOR_AGENT_ISDOCKER" value: "true" ``` + +### 4. Compiling from source [require `go.1.18`] + +- Install: `GOBIN=/usr/local/bin/ go install github.com/pinpoint-apm/pinpoint-c-agent/collector-agent@dev` + - ❗❗❗Note: collector-agent: located into `/usr/local/bin/` + +`./collector-agent` + \ No newline at end of file diff --git a/README.md b/README.md index 881cf850..6958034a 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ 1. Use `C/Cpp` common API 2. `C`ross-platform: windows/*nux/macOS -3. `C`ollector-agent: a bridge to pinpoint-collector +3. [`C`ollector-agent](DOC/collector-agent/readme.md): a bridge to pinpoint-collector Pinpoint C Agent helps your monitor your PHP/PYTHON applications into [pinpoint-apm](https://github.com/pinpoint-apm/pinpoint).\ Our advantage: diff --git a/collector-agent/makefile b/collector-agent/makefile index e5c20438..34fe96a5 100644 --- a/collector-agent/makefile +++ b/collector-agent/makefile @@ -1,5 +1,5 @@ -TAG ?=v0.5.2 +TAG ?=v0.6.4 .PHONY: default default: server ; diff --git a/collector-agent/server.go b/collector-agent/server.go index b33555e4..b3a3f01a 100644 --- a/collector-agent/server.go +++ b/collector-agent/server.go @@ -1,9 +1,7 @@ package main import ( - "net/http" - _ "net/http/pprof" - "runtime" + // _ "net/http/pprof" "flag" @@ -30,10 +28,10 @@ func main() { server.InitServerConfig() spanServer := server.SpanServer{} // disable performance profile - go func() { - log.Println(http.ListenAndServe("0.0.0.0:8081", nil)) - runtime.SetBlockProfileRate(1) - }() + // go func() { + // log.Println(http.ListenAndServe("0.0.0.0:8081", nil)) + // runtime.SetBlockProfileRate(1) + // }() if _, err := spanServer.Run(); err != nil { log.Warn("SpanServer is exit ....") diff --git a/collector-agent/server/SpanServer.go b/collector-agent/server/SpanServer.go index f2c23a14..9cdc7645 100644 --- a/collector-agent/server/SpanServer.go +++ b/collector-agent/server/SpanServer.go @@ -20,7 +20,7 @@ import ( log "github.com/sirupsen/logrus" ) -var Version = "v0.5.3" +var Version = "v0.6.4" type SpanServer struct { listener net.Listener