networkservicemesh / cmd-template

Is a template for the network service mesh applications
Apache License 2.0
1 stars 11 forks source link

Add go profiling for CI NSM images #85

Open denis-tingaikin opened 2 years ago

denis-tingaikin commented 2 years ago

To improve our CI testing we can add a CPU/memory profile capturing for each NSM application via docker target stage. This will allow us to detect memory/cpu regressions or improvements.

Implementation details

  1. Add for each application a new target ci
    FROM go as ci
    WORKDIR /build
    COPY go.mod go.sum ./
    COPY ./internal/imports imports
    RUN go build ./imports
    COPY . .
    # TODO: Consider about adding a race flag
    RUN go build -tags=ci -o /bin/app .
    # TODO: correct this:
    ENTRYPOINT ["go", "tool pprof app profile.output"]
  2. Add build tags based main.go for the application that will include import _ "net/http/pprof"
  3. Build image for the /ci with --target ci
  4. Add storing profile.output into https://github.com/networkservicemesh/integration-tests/tree/main/extensions/logs on test cleanup as CI artifact.
denis-tingaikin commented 2 years ago

@edwarnicke Can we schedule this?