diff --git a/.github/workflows/dev-ci.yaml b/.github/workflows/dev-ci.yaml new file mode 100644 index 00000000..3b2ffb10 --- /dev/null +++ b/.github/workflows/dev-ci.yaml @@ -0,0 +1,38 @@ +name: dev build image +on: + workflow_dispatch: + push: + branches: [ "main" ] + +jobs: + goreleaser: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@main + + - name: Create tag name + run: echo "tag=$(date +'%Y-%m-%dT%H-%M-%S')_$GITHUB_SHA" >> $GITHUB_ENV + + - name: Install AWS cli + uses: unfor19/install-aws-cli-action@master + + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: us-east-1 + + - name: Login to Amazon ECR + id: login-ecr + uses: aws-actions/amazon-ecr-login@v1 + + - name: Build and Push Agent Image + uses: docker/build-push-action@v3 + with: + context: . + file: 'Dockerfile' + push: true + tags: | + 280501305789.dkr.ecr.us-east-1.amazonaws.com/nudgebee-node-agent:${{ env.tag }} diff --git a/.github/workflows/prod-ci.yaml b/.github/workflows/prod-ci.yaml new file mode 100644 index 00000000..b83f59bc --- /dev/null +++ b/.github/workflows/prod-ci.yaml @@ -0,0 +1,38 @@ +name: dev build image +on: + workflow_dispatch: + push: + branches: [ "prod" ] + +jobs: + goreleaser: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@main + + - name: Create tag name + run: echo "tag=$(date +'%Y-%m-%dT%H-%M-%S')_$GITHUB_SHA" >> $GITHUB_ENV + + - name: Install AWS cli + uses: unfor19/install-aws-cli-action@master + + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.PROD_AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.PROD_AWS_SECRET_ACCESS_KEY }} + aws-region: us-east-1 + + - name: Login to Amazon ECR + id: login-ecr + uses: aws-actions/amazon-ecr-login@v1 + + - name: Build and Push Agent Image + uses: docker/build-push-action@v3 + with: + context: . + file: 'Dockerfile' + push: true + tags: | + 740395098545.dkr.ecr.us-east-1.amazonaws.com/nudgebee-node-agent:${{ env.tag }} diff --git a/containers/l7.go b/containers/l7.go index 2d1c7c50..6153616c 100644 --- a/containers/l7.go +++ b/containers/l7.go @@ -1,6 +1,7 @@ package containers import ( + "log" "time" "github.com/coroot/coroot-node-agent/common" @@ -69,7 +70,8 @@ func (s L7Stats) get(protocol l7.Protocol, destination, actualDestination netadd labels = append(labels, "method") case l7.ProtocolHTTP: method, path, payload := l7.ParseHttpAndRest(r.Payload) - if r.Status == l7.StatusFailed { + if r.Status.Http() == "400" || r.Status.Http() == "500" { + log.Printf("Captured failed request actual body %s, converted body %s, status %s", string(r.Payload), payload, r.Status.Http()) constLabels["payload"] = payload } constLabels["path"] = path