Skip to content

Commit

Permalink
Merge pull request #751 from newrelic/develop
Browse files Browse the repository at this point in the history
Release 3.23.1
  • Loading branch information
iamemilio committed Jun 28, 2023
2 parents 45ed3ee + 182f9e3 commit ab9e248
Show file tree
Hide file tree
Showing 17 changed files with 296 additions and 13 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ jobs:
dirs: v3/newrelic,v3/internal,v3/examples

# v3 integrations
- go-version: 1.19.x
dirs: v3/integrations/nrsarama
- go-version: 1.18.x
dirs: v3/integrations/logcontext/nrlogrusplugin
extratesting: go get -u github.com/sirupsen/logrus@master
Expand Down Expand Up @@ -70,7 +72,6 @@ jobs:
dirs: v3/integrations/nrgraphgophers
- go-version: 1.18.x
dirs: v3/integrations/nrlogrus
extratesting: go get -u github.com/sirupsen/logrus@master
- go-version: 1.18.x
dirs: v3/integrations/nrlogxi
extratesting: go get -u github.com/mgutz/logxi@master
Expand Down Expand Up @@ -179,7 +180,6 @@ jobs:
fail-fast: false
matrix:
include:
- go-version: 1.17.10
- go-version: 1.18.6
- go-version: 1.19.1
steps:
Expand Down
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
## 3.23.1

## Added
* Added newrelic.ConfigDatastoreRawQuery(true) configuration option to allow raw SQL queries to appear in new relic dashboards
* Added license file to nrsecurityagent integration
* Added enriched serverless debug logging for faster debugging

## Fixed
* Removed timeouts on two tests in trace_observer_test.go
* Bumped nrnats test to go1.19
* Bumped graphql-go to v1.3.0 in the nrgraphgophers integration

We recommend updating to the latest agent version as soon as it's available. If you can't upgrade to the latest version, update your agents to a version no more than 90 days old. Read more about keeping agents up to date. (https://docs.newrelic.com/docs/new-relic-solutions/new-relic-one/install-configure/update-new-relic-agent/)

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.23.0
### Added
* Adds the `nrsecurityagent` integration for performing Interactive Application Security Testing (IAST) of your application.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[![Community Plus header](https://github.com/newrelic/opensource-website/raw/main/src/images/categories/Community_Plus.png)](https://opensource.newrelic.com/oss-category/#community-plus)

# New Relic Go Agent [![GoDoc](https://godoc.org/github.com/newrelic/go-agent?status.svg)](https://godoc.org/github.com/newrelic/go-agent/v3/newrelic/) [![Go Report Card](https://goreportcard.com/badge/github.com/newrelic/go-agent)](https://goreportcard.com/report/github.com/newrelic/go-agent)
# New Relic Go Agent [![GoDoc](https://godoc.org/github.com/newrelic/go-agent?status.svg)](https://godoc.org/github.com/newrelic/go-agent/v3/newrelic/) [![Go Report Card](https://goreportcard.com/badge/github.com/newrelic/go-agent)](https://goreportcard.com/report/github.com/newrelic/go-agent) [![codecov](https://codecov.io/github/newrelic/go-agent/branch/master/graph/badge.svg?token=UEWy0clWYW)](https://codecov.io/github/newrelic/go-agent)

The New Relic Go Agent allows you to monitor your Go applications with New
Relic. It helps you track transactions, outbound requests, database calls, and
Expand Down
4 changes: 3 additions & 1 deletion v3/integrations/nrgraphgophers/go.mod
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
module github.com/newrelic/go-agent/v3/integrations/nrgraphgophers

// As of Jan 2020, the graphql-go go.mod file uses 1.13:
// https://github.com/graph-gophers/graphql-go/blob/master/go.mod
go 1.13

require (
// graphql-go has no tagged releases as of Jan 2020.
github.com/graph-gophers/graphql-go v0.0.0-20200207002730-8334863f2c8b
github.com/graph-gophers/graphql-go v1.3.0
github.com/newrelic/go-agent/v3 v3.17.0
)
24 changes: 21 additions & 3 deletions v3/integrations/nrnats/go.mod
Original file line number Diff line number Diff line change
@@ -1,9 +1,27 @@
module github.com/newrelic/go-agent/v3/integrations/nrnats
// As of Dec 2019, 1.11 is the earliest version of Go tested by nats:

// As of Jun 2023, 1.19 is the earliest version of Go tested by nats:
// https://github.com/nats-io/nats.go/blob/master/.travis.yml
go 1.18
go 1.19

require (
github.com/nats-io/nats-server v1.4.1
github.com/nats-io/nats.go v1.25.0
github.com/newrelic/go-agent/v3 v3.21.0
github.com/newrelic/go-agent/v3 v3.23.0
)

require (
github.com/golang/protobuf v1.5.3 // indirect
github.com/nats-io/gnatsd v1.4.1 // indirect
github.com/nats-io/go-nats v1.7.2 // indirect
github.com/nats-io/nats-server/v2 v2.9.17 // indirect
github.com/nats-io/nkeys v0.4.4 // indirect
github.com/nats-io/nuid v1.0.1 // indirect
golang.org/x/crypto v0.8.0 // indirect
golang.org/x/net v0.9.0 // indirect
golang.org/x/sys v0.7.0 // indirect
golang.org/x/text v0.9.0 // indirect
google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect
google.golang.org/grpc v1.54.0 // indirect
google.golang.org/protobuf v1.28.1 // indirect
)
1 change: 1 addition & 0 deletions v3/integrations/nrpq/example/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ func main() {
newrelic.ConfigAppName("PostgreSQL App"),
newrelic.ConfigLicense(os.Getenv("NEW_RELIC_LICENSE_KEY")),
newrelic.ConfigDebugLogger(os.Stdout),
newrelic.ConfigDatastoreRawQuery(true),
)
if nil != err {
panic(err)
Expand Down
206 changes: 206 additions & 0 deletions v3/integrations/nrsecurityagent/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,206 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/

TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

1. Definitions.

"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.

"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.

"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.

"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.

"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.

"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.

"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).

"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.

"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."

"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.

2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.

3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.

4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:

(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and

(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and

(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and

(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.

You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.

5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.

6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.

7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.

8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.

9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.

END OF TERMS AND CONDITIONS

APPENDIX: How to apply the Apache License to your work.

To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright [yyyy] [name of copyright owner]

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.


Versions 3.8.0 and above for this project are licensed under Apache 2.0. For
prior versions of this project, please see the LICENCE.txt file in the root
directory of that version for more information.
5 changes: 5 additions & 0 deletions v3/newrelic/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,10 @@ type Config struct {
QueryParameters struct {
Enabled bool
}
RawQuery struct {
Enabled bool
}

// SlowQuery controls the capture of slow query traces. Slow
// query traces show you instances of your slowest datastore
// segments.
Expand Down Expand Up @@ -653,6 +657,7 @@ func defaultConfig() Config {
c.DatastoreTracer.QueryParameters.Enabled = true
c.DatastoreTracer.SlowQuery.Enabled = true
c.DatastoreTracer.SlowQuery.Threshold = 10 * time.Millisecond
c.DatastoreTracer.RawQuery.Enabled = false

c.ServerlessMode.ApdexThreshold = 500 * time.Millisecond
c.ServerlessMode.Enabled = false
Expand Down
8 changes: 8 additions & 0 deletions v3/newrelic/config_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,14 @@ func ConfigCodeLevelMetricsEnabled(enabled bool) ConfigOption {
}
}

// ConfigDatastoreRawQuery replaces a parameterized query in datastores
// with the full raw query
func ConfigDatastoreRawQuery(enabled bool) ConfigOption {
return func(cfg *Config) {
cfg.DatastoreTracer.RawQuery.Enabled = enabled
}
}

// ConfigCodeLevelMetricsIgnoredPrefix alters the way the Code Level Metrics
// collection code searches for the right function to report for a given
// telemetry trace. It will find the innermost function whose name does NOT
Expand Down
2 changes: 2 additions & 0 deletions v3/newrelic/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ func TestCopyConfigReferenceFieldsPresent(t *testing.T) {
"DatabaseNameReporting":{"Enabled":true},
"InstanceReporting":{"Enabled":true},
"QueryParameters":{"Enabled":true},
"RawQuery":{"Enabled":false},
"SlowQuery":{
"Enabled":true,
"Threshold":10000000
Expand Down Expand Up @@ -358,6 +359,7 @@ func TestCopyConfigReferenceFieldsAbsent(t *testing.T) {
"DatabaseNameReporting":{"Enabled":true},
"InstanceReporting":{"Enabled":true},
"QueryParameters":{"Enabled":true},
"RawQuery":{"Enabled":false},
"SlowQuery":{
"Enabled":true,
"Threshold":10000000
Expand Down
3 changes: 3 additions & 0 deletions v3/newrelic/internal_txn.go
Original file line number Diff line number Diff line change
Expand Up @@ -919,6 +919,9 @@ func endDatastore(s *DatastoreSegment) error {
if !txn.Config.DatastoreTracer.QueryParameters.Enabled {
s.QueryParameters = nil
}
if txn.Config.DatastoreTracer.RawQuery.Enabled {
s.ParameterizedQuery = s.RawQuery
}
if txn.Reply.SecurityPolicies.RecordSQL.IsSet() {
s.QueryParameters = nil
if !txn.Reply.SecurityPolicies.RecordSQL.Enabled() {
Expand Down
4 changes: 3 additions & 1 deletion v3/newrelic/segments.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ type DatastoreSegment struct {
// ParameterizedQuery may be set to the query being performed. It must
// not contain any raw parameters, only placeholders.
ParameterizedQuery string
// RawQuery stores the original raw query
RawQuery string

// QueryParameters may be used to provide query parameters. Care should
// be taken to only provide parameters which are not sensitive.
// QueryParameters are ignored in high security mode. The keys must contain
Expand Down Expand Up @@ -310,7 +313,6 @@ func StartSegment(txn *Transaction, name string) *Segment {
//
// Using the same http.Client for all of your external requests? Check out
// NewRoundTripper: You may not need to use StartExternalSegment at all!
//
func StartExternalSegment(txn *Transaction, request *http.Request) *ExternalSegment {
if nil == txn {
txn = transactionFromRequestContext(request)
Expand Down
Loading

0 comments on commit ab9e248

Please sign in to comment.