Skip to content

Commit

Permalink
Merge pull request #403 from newrelic/develop
Browse files Browse the repository at this point in the history
Release 3.15.1
  • Loading branch information
nr-swilloughby authored Oct 27, 2021
2 parents 779fa03 + c9234d3 commit 5be716d
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 9 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -231,3 +231,52 @@ jobs:
env:
DIRS: ${{ matrix.dirs }}
EXTRATESTING: ${{ matrix.extratesting }}

go-agent-arm64:
# Run all unit tests on aarch64 emulator to ensure compatibility with AWS
# Graviton instances
runs-on: ubuntu-18.04
strategy:
# if one test fails, do not abort the rest
fail-fast: false
matrix:
include:
- go-version: 1.17.1
- go-version: 1.16.8
steps:
- 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
- uses: uraimo/[email protected]
name: Run Tests
id: runcmd
with:
arch: aarch64
distro: ubuntu20.04
githubToken: ${{ github.token }}
install: |
DEBIAN_FRONTEND=noninteractive apt-get -qq update
DEBIAN_FRONTEND=noninteractive apt-get -qq install -y wget build-essential
wget -nv https://golang.org/dl/go${{ matrix.go-version }}.linux-arm64.tar.gz
rm -rf /usr/local/go
tar -C /usr/local -xzf go${{ matrix.go-version }}.linux-arm64.tar.gz
run: |
export PATH=$PATH:/usr/local/go/bin
go version
cd v3/newrelic
go mod download github.com/golang/protobuf
go get
echo ==== v3/newrelic tests ====
go test ./...
cd ../internal
echo ==== v3/internal tests ====
go test ./...
cd ../examples
echo ==== v3/examples tests ====
go test ./...
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,21 @@
# ChangeLog
## 3.15.1

### Fixed

* Updated support for SQL database instrumentation across the board for the Go Agent’s database integrations to more accurately extract the database table name from SQL queries. Fixes [Issue #397](https://github.com/newrelic/go-agent/issues/397).

* Updated the `go.mod` file in the `nrecho-v4` integration to require version 4.5.0 of the `github.com/labstack/echo` package. This addresses a security concern arising from downstream dependencies in older versions of the echo package, as described in the [release notes](https://github.com/labstack/echo/releases/tag/v4.5.0) for `echo` v4.5.0.

### ARM64 Compatibility Note

The New Relic Go Agent is implemented in platform-independent Go, and supports (among the other platforms which run Go) ARM64/Graviton2 using Go 1.17+.

### 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.



## 3.15.0

Expand Down
4 changes: 2 additions & 2 deletions v3/integrations/nrecho-v4/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ module github.com/newrelic/go-agent/v3/integrations/nrecho-v4
go 1.12

require (
github.com/labstack/echo/v4 v4.0.0
github.com/newrelic/go-agent/v3 v3.0.0
github.com/labstack/echo/v4 v4.5.0
github.com/newrelic/go-agent/v3 v3.15.0
)
6 changes: 3 additions & 3 deletions v3/newrelic/sqlparse/sqlparse.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ var (
extractTableRegex = regexp.MustCompile(`[\s` + "`" + `"'\(\)\{\}\[\]]*`)
updateRegex = regexp.MustCompile(`(?is)^update(?:\s+(?:low_priority|ignore|or|rollback|abort|replace|fail|only))*` + tablePattern)
sqlOperations = map[string]*regexp.Regexp{
"select": regexp.MustCompile(`(?is)^.*?\sfrom` + tablePattern),
"delete": regexp.MustCompile(`(?is)^.*?\sfrom` + tablePattern),
"insert": regexp.MustCompile(`(?is)^.*?\sinto?` + tablePattern),
"select": regexp.MustCompile(`(?is)^.*\sfrom` + tablePattern),
"delete": regexp.MustCompile(`(?is)^.*\sfrom` + tablePattern),
"insert": regexp.MustCompile(`(?is)^.*\sinto?` + tablePattern),
"update": updateRegex,
"call": nil,
"create": nil,
Expand Down
4 changes: 4 additions & 0 deletions v3/newrelic/sqlparse/sqlparse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ func TestParseSQLSubQuery(t *testing.T) {
{Input: "SELECT * FROM (SELECT * FROM foobar)", Operation: "select", Table: "foobar"},
{Input: "SELECT * FROM (SELECT * FROM foobar) WHERE x > y", Operation: "select", Table: "foobar"},
{Input: "SELECT * FROM(SELECT * FROM foobar) WHERE x > y", Operation: "select", Table: "foobar"},
{Input: "SELECT substring('spam' FROM 2 FOR 3) AS x FROM FROMAGE) FROM fromagier", Operation: "select", Table: "fromagier"},
} {
tc.test(t)
}
Expand All @@ -71,6 +72,9 @@ func TestParseSQLOther(t *testing.T) {
{Input: "SELECT * FROM[ `something`.'foo' ]", Operation: "select", Table: "foo"},
// Test that we handle the cheese.
{Input: "SELECT fromage FROM fromagier", Operation: "select", Table: "fromagier"},
{Input: "SELECT (x from fromage) FROM fromagier", Operation: "select", Table: "fromagier"},
{Input: "SELECT (x FROM FROMAGE) FROM fromagier", Operation: "select", Table: "fromagier"},
{Input: "SELECT substring('spam' FROM 2 FOR 3) AS x FROM FROMAGE) FROM fromagier", Operation: "select", Table: "fromagier"},
} {
tc.test(t)
}
Expand Down
14 changes: 11 additions & 3 deletions v3/newrelic/trace_observer_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
// Copyright 2020 New Relic Corporation. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

//go:build go1.9
// +build go1.9

// This build tag is necessary because Infinite Tracing is only supported for Go version 1.9 and up

package newrelic
Expand Down Expand Up @@ -258,6 +260,12 @@ func TestTraceObserverRestart(t *testing.T) {
waitForTrObs(t, to)
defer s.Close()

// Make sure the server has received the new data
to.consumeSpan(&spanEvent{})
if !s.DidSpansArrive(t, 1, 150*time.Millisecond) {
t.Error("Did not receive expected spans before timeout -- before restart")
}

s.ExpectMetadata(t, map[string]string{
"agent_run_token": runToken,
"license_key": testLicenseKey,
Expand All @@ -268,8 +276,8 @@ func TestTraceObserverRestart(t *testing.T) {

// Make sure the server has received the new data
to.consumeSpan(&spanEvent{})
if !s.DidSpansArrive(t, 1, 50*time.Millisecond) {
t.Error("Did not receive expected spans before timeout")
if !s.DidSpansArrive(t, 1, 150*time.Millisecond) {
t.Error("Did not receive expected spans before timeout -- after restart")
}

s.ExpectMetadata(t, map[string]string{
Expand Down Expand Up @@ -894,7 +902,7 @@ func TestTrObsOKSendBackoffNo(t *testing.T) {
}
// If the default backoff of 15 seconds is used, the second span will not
// be received in time.
if !s.DidSpansArrive(t, 2, time.Second) {
if !s.DidSpansArrive(t, 2, 4*time.Second) {
t.Error("server did not receive 2 spans")
}
}
Expand Down
2 changes: 1 addition & 1 deletion v3/newrelic/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

const (
// Version is the full string version of this Go Agent.
Version = "3.15.0"
Version = "3.15.1"
)

var (
Expand Down

0 comments on commit 5be716d

Please sign in to comment.