Skip to content

Commit

Permalink
Merge pull request #581 from nr-swilloughby/master
Browse files Browse the repository at this point in the history
Release v3.19.2
  • Loading branch information
nr-swilloughby committed Sep 21, 2022
2 parents 6b4e605 + 09c4fca commit c611087
Show file tree
Hide file tree
Showing 19 changed files with 218 additions and 83 deletions.
40 changes: 35 additions & 5 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,41 @@ jobs:
dirs: _integrations/nrb3
- go-version: 1.13.x
dirs: _integrations/nrmongo
steps:
- name: Install Go
uses: actions/setup-go@v1
with:
go-version: ${{ matrix.go-version }}

# v3 agent
- name: Checkout Code
uses: actions/checkout@v1
with:
# Required when using older versions of Go that do not support gomod.
# Note the required presence of the /go-agent/ directory at the
# beginning of this path. It is required in order to match the
# ${{ github.workspace }} used by the GOPATH env var. pwd when cloning
# the repo is <something>/go-agent/ whereas ${{ github.workspace }}
# returns <something/go-agent/go-agent/.
path: ./go-agent/src/github.com/newrelic/go-agent

- name: Run Tests
run: bash build-script.sh
env:
DIRS: ${{ matrix.dirs }}
EXTRATESTING: ${{ matrix.extratesting }}
PIN: ${{ matrix.pin }}

go-agent-v3:
runs-on: ubuntu-18.04
env:
# Required when using older versions of Go that do not support gomod.
GOPATH: ${{ github.workspace }}

strategy:
# if one test fails, do not abort the rest
fail-fast: false
matrix:
include:
- go-version: 1.17.x
dirs: v3/newrelic,v3/internal,v3/examples
- go-version: 1.18.x
Expand Down Expand Up @@ -183,16 +216,13 @@ jobs:
extratesting: go get -u github.com/nats-io/nats.go/@master
- go-version: 1.17.x
dirs: v3/integrations/nrnats/test
extratesting: go get -u github.com/nats-io/nats.go/@master
- go-version: 1.17.x
dirs: v3/integrations/nrstan
extratesting: go get -u github.com/nats-io/stan.go/@master
- go-version: 1.17.x
dirs: v3/integrations/nrstan/test
extratesting: go get -u github.com/nats-io/stan.go/@master
- go-version: 1.17.x
dirs: v3/integrations/nrstan/examples
extratesting: go get -u github.com/nats-io/stan.go/@master
- go-version: 1.17.x
dirs: v3/integrations/logcontext
extratesting: go get -u github.com/sirupsen/logrus@master
Expand Down Expand Up @@ -233,7 +263,7 @@ jobs:
path: ./go-agent/src/github.com/newrelic/go-agent

- name: Run Tests
run: bash build-script.sh
run: bash v3/build-script.sh
env:
DIRS: ${{ matrix.dirs }}
EXTRATESTING: ${{ matrix.extratesting }}
Expand Down
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
## 3.19.2

### Changed
* Updated nrgin integration to more accurately report code locations when code level metrics are enabled.
* The Go Agent and all integrations now require Go version 1.17 or later.
* Updated minimum versions for third-party modules.
* nrawssdk-v2, nrecho-v4, nrgrpc, nrmongo, nrmysql, nrnats, and nrstan now require Go Agent 3.18.2 or later
* the Go Agent now requires protobuf 1.5.2 and grpc 1.49.0
* Internal dev process and unit test improvements.

### Support Statement
New Relic recommends that you upgrade the agent regularly to ensure that you’re getting the latest features and performance benefits. Additionally, older releases will no longer be supported when they reach end-of-life.

We also recommend using the latest version of the Go language. At minimum, you should at least be using no version of Go older than what is supported by the Go team themselves.

See the [Go Agent EOL Policy](https://docs.newrelic.com/docs/apm/agents/go-agent/get-started/go-agent-eol-policy/) for details about supported versions of the Go Agent and third-party components.


## 3.19.1 - Hotfix Release

### Changed
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Go is a compiled language, and doesn’t use a virtual machine. This means that

### Compatibility and Requirements

For the latest version of the agent, Go 1.7+ is required, due to the use of `context.Context`.
For the latest version of the agent, Go 1.17+ is required.

Linux, OS X, and Windows (Vista, Server 2008 and later) are supported.

Expand Down
62 changes: 62 additions & 0 deletions v3/build-script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Copyright 2020 New Relic Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

set -x
set -e

# inputs
# 1: repo pin; example: github.com/rewrelic/go-agent@v1.9.0
pin_go_dependency() {
if [[ ! -z "$1" ]]; then
echo "Pinning: $1"
repo=$(echo "$1" | cut -d '@' -f1)
pinTo=$(echo "$1" | cut -d '@' -f2)
set +e
go get -u "$repo" # this go get will fail to build
set -e
cd "$GOPATH"/src/"$repo"
git checkout "$pinTo"
cd -
fi
}

verify_go_fmt() {
needsFMT=$(gofmt -d .)
if [ ! -z "$needsFMT" ]; then
echo "$needsFMT"
echo "Please format your code with \"gofmt .\""
# exit 1
fi
}

pwd=$(pwd)
version=$(go version)
echo $version

tmp=$(echo $version | cut -d 'o' -f4)
shortVersion=${tmp%.*}

IFS=","
for dir in $DIRS; do
cd "$pwd/$dir"

# replace go-agent with local pull
go mod edit -replace github.com/newrelic/go-agent/v3="$pwd"/v3

# manage dependencies
go mod tidy -go=$shortVersion -compat=$shortVersion
pin_go_dependency "$PIN"

# run tests
go test -race -benchtime=1ms -bench=. ./...
go vet ./...
verify_go_fmt

# Test again against the latest version of the dependencies to ensure that
# our instrumentation is up to date. TODO: Perhaps it is possible to
# upgrade all go.mod dependencies to latest master with a go command.
if [ -n "$EXTRATESTING" ]; then
eval "$EXTRATESTING"
go test -race -benchtime=1ms -bench=. ./...
fi
done
6 changes: 3 additions & 3 deletions v3/go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module github.com/newrelic/go-agent/v3

go 1.7
go 1.17

require (
github.com/golang/protobuf v1.4.3
google.golang.org/grpc v1.39.0
github.com/golang/protobuf v1.5.2
google.golang.org/grpc v1.49.0
)
19 changes: 8 additions & 11 deletions v3/integrations/nrawssdk-v2/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,14 @@ module github.com/newrelic/go-agent/v3/integrations/nrawssdk-v2

// As of May 2021, the aws-sdk-go-v2 go.mod file uses 1.15:
// https://github.com/aws/aws-sdk-go-v2/blob/master/go.mod
go 1.15

replace github.com/newrelic/go-agent/v3 => ../../
go 1.17

require (
github.com/aws/aws-sdk-go-v2 v1.4.0
github.com/aws/aws-sdk-go-v2/config v1.1.7
github.com/aws/aws-sdk-go-v2/service/dynamodb v1.2.3
github.com/aws/aws-sdk-go-v2/service/lambda v1.2.3
github.com/aws/aws-sdk-go-v2/service/s3 v1.6.0
github.com/aws/smithy-go v1.4.0
github.com/newrelic/go-agent/v3 v3.0.0
golang.org/x/tools v0.1.0 // indirect
github.com/aws/aws-sdk-go-v2 v1.16.15
github.com/aws/aws-sdk-go-v2/config v1.17.6
github.com/aws/aws-sdk-go-v2/service/dynamodb v1.17.0
github.com/aws/aws-sdk-go-v2/service/lambda v1.24.5
github.com/aws/aws-sdk-go-v2/service/s3 v1.27.10
github.com/aws/smithy-go v1.13.3
github.com/newrelic/go-agent/v3 v3.18.2
)
19 changes: 1 addition & 18 deletions v3/integrations/nrecho-v4/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,7 @@ module github.com/newrelic/go-agent/v3/integrations/nrecho-v4
// https://github.com/labstack/echo/blob/master/go.mod
go 1.17


require (
github.com/labstack/echo/v4 v4.5.0
github.com/newrelic/go-agent/v3 v3.16.1
)

require (
github.com/golang/protobuf v1.4.3 // indirect
github.com/labstack/gommon v0.3.0 // indirect
github.com/mattn/go-colorable v0.1.8 // indirect
github.com/mattn/go-isatty v0.0.12 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasttemplate v1.2.1 // indirect
golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2 // indirect
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect
golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57 // indirect
golang.org/x/text v0.3.6 // indirect
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 // indirect
google.golang.org/grpc v1.39.0 // indirect
google.golang.org/protobuf v1.25.0 // indirect
github.com/newrelic/go-agent/v3 v3.18.2
)
1 change: 1 addition & 0 deletions v3/integrations/nrgin/example/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ func main() {
newrelic.ConfigAppName("Gin App"),
newrelic.ConfigLicense(os.Getenv("NEW_RELIC_LICENSE_KEY")),
newrelic.ConfigDebugLogger(os.Stdout),
newrelic.ConfigCodeLevelMetricsEnabled(true),
)
if nil != err {
fmt.Println(err)
Expand Down
2 changes: 1 addition & 1 deletion v3/integrations/nrgin/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ go 1.12

require (
github.com/gin-gonic/gin v1.8.0
github.com/newrelic/go-agent/v3 v3.17.0
github.com/newrelic/go-agent/v3 v3.18.2
)
2 changes: 1 addition & 1 deletion v3/integrations/nrgin/nrgin.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ func middleware(app *newrelic.Application, useNewNames bool) gin.HandlerFunc {
name := c.Request.Method + " " + getName(c, useNewNames)

w := &headerResponseWriter{w: c.Writer}
txn := app.StartTransaction(name)
txn := app.StartTransaction(name, newrelic.WithFunctionLocation(c.Handler()))
txn.SetWebRequestHTTP(c.Request)
defer txn.End()

Expand Down
16 changes: 12 additions & 4 deletions v3/integrations/nrgrpc/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,21 @@ module github.com/newrelic/go-agent/v3/integrations/nrgrpc

// As of Dec 2019, the grpc go.mod file uses 1.11:
// https://github.com/grpc/grpc-go/blob/master/go.mod
go 1.11
go 1.17

require (
// protobuf v1.3.0 is the earliest version using modules, we use v1.3.1
// because all dependencies were removed in this version.
github.com/golang/protobuf v1.3.3
github.com/newrelic/go-agent/v3 v3.12.0
github.com/golang/protobuf v1.5.2
github.com/newrelic/go-agent/v3 v3.18.2
// v1.15.0 is the earliest version of grpc using modules.
google.golang.org/grpc v1.39.0
google.golang.org/grpc v1.49.0
)

require (
golang.org/x/net v0.0.0-20201021035429-f5854403a974 // indirect
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4 // indirect
golang.org/x/text v0.3.3 // indirect
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 // indirect
google.golang.org/protobuf v1.27.1 // indirect
)
30 changes: 21 additions & 9 deletions v3/integrations/nrgrpc/nrgrpc_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package nrgrpc
import (
"context"
"encoding/json"
"fmt"
"io"
"testing"

Expand Down Expand Up @@ -364,39 +365,50 @@ func TestStreamStreamClientInterceptor(t *testing.T) {
if err != nil {
t.Fatal("client call to DoStreamStream failed", err)
}
waitc := make(chan struct{})
go func() {
defer close(waitc)

errC := make(chan error)
go func(errC chan error) {
var recved int
for {
msg, err := stream.Recv()
if err == io.EOF {
break
}
if err != nil {
t.Fatal("failure to Recv", err)
errC <- fmt.Errorf("failure to Recv: %v", err)
return
}
var hdrs map[string][]string
err = json.Unmarshal([]byte(msg.Text), &hdrs)
if err != nil {
t.Fatal("cannot unmarshall client response", err)
errC <- fmt.Errorf("cannot unmarshall client response: %v", err)
return
}
if hdr, ok := hdrs["newrelic"]; !ok || len(hdr) != 1 || hdr[0] == "" {
t.Error("distributed trace header not sent", hdrs)
errC <- fmt.Errorf("distributed trace header not sent: %v", hdrs)
return
}
recved++
}
if recved != 3 {
t.Fatal("received incorrect number of messages from server", recved)
errC <- fmt.Errorf("received incorrect number of messages from server: %v", recved)
return
}
}()
errC <- nil
}(errC)
for i := 0; i < 3; i++ {
if err := stream.Send(&testapp.Message{Text: "Hello DoStreamStream"}); err != nil {
t.Fatal("failure to Send", err)
}
}
stream.CloseSend()
<-waitc

err = <-errC
close(errC)
if err != nil {
t.Fatal(err)
}

txn.End()

app.ExpectMetrics(t, []internal.WantMetric{
Expand Down
Loading

0 comments on commit c611087

Please sign in to comment.