Skip to content

Commit bb7fed8

Browse files
authored
Merge branch 'dev' into ha/update-notice-error
2 parents f49637c + 06824b7 commit bb7fed8

File tree

16 files changed

+216
-82
lines changed

16 files changed

+216
-82
lines changed

.github/workflows/test-agent.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,31 @@ on:
1919
pull_request:
2020

2121
jobs:
22+
gofmt-check:
23+
runs-on: ubuntu-latest
24+
continue-on-error: true
25+
steps:
26+
- name: Checkout newrelic-php-agent code
27+
uses: actions/checkout@v4
28+
with:
29+
path: php-agent
30+
- name: Setup go
31+
uses: actions/setup-go@v5
32+
with:
33+
go-version-file: ./php-agent/daemon/go.mod
34+
cache: false
35+
- name: Display go version
36+
run: |
37+
go version
38+
- name: Run gofmt
39+
run: |
40+
GOFMT_REPORTED_FILES="$(gofmt -l -e ./php-agent/daemon)"
41+
if [ ! -z "$GOFMT_REPORTED_FILES" ]; then
42+
gofmt -d -e ./php-agent/daemon
43+
echo "### gofmt violations found in $(echo "$GOFMT_REPORTED_FILES" | wc -l) files" >> $GITHUB_STEP_SUMMARY
44+
echo "$GOFMT_REPORTED_FILES" >> $GITHUB_STEP_SUMMARY
45+
exit 1
46+
fi
2247
daemon-unit-tests:
2348
runs-on: ubuntu-latest
2449
env:

.github/workflows/trigger-test-suite.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ on:
88
pull_request:
99

1010
jobs:
11-
trigger-multiverse-tests:
11+
trigger-test-suite:
1212
runs-on: ubuntu-latest
1313
env:
1414
GH_TOKEN: ${{ secrets.TEST_SUITE_REPO_GH_TOKEN }}
1515
steps:
16-
- name: Trigger Multiverse Test Suite
16+
- name: Trigger Test Suite
1717
run: |
1818
gh workflow run -R ${{ secrets.TEST_SUITE_REPO }} ${{ secrets.TEST_SUITE_WORKFLOW }} -f agent_git_ref=${{ github.head_ref }} -f pr-number=${{ github.event.number }}

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
10.22.0
1+
10.23.0

agent/lib_mongodb.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,14 @@ void nr_mongodb_enable() {
356356
nr_php_wrap_user_function_extra(NR_PSTR("MongoDB\\Operation\\Count::execute"),
357357
nr_mongodb_operation, "count" TSRMLS_CC);
358358

359+
/*
360+
* `count` has been deprecated in later versions of mongodb and replaced by
361+
* `countDocuments`
362+
*/
363+
nr_php_wrap_user_function_extra(
364+
NR_PSTR("MongoDB\\Operation\\CountDocuments::execute"),
365+
nr_mongodb_operation, "countDocuments");
366+
359367
/*
360368
* This also catches MongoDB\Collection::createIndex
361369
*/

axiom/nr_version.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,9 @@
4545
* viburnum 18Mar2024 (10.19)
4646
* wallflower 06May2024 (10.20)
4747
* xerophyllum 20May2024 (10.21)
48+
* yarrow 26Jun2024 (10.22)
4849
*/
49-
#define NR_CODENAME "yarrow"
50+
#define NR_CODENAME "zinnia"
5051

5152
const char* nr_version(void) {
5253
return NR_STR2(NR_VERSION);

daemon/cmd/daemon/main.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ func main() {
371371
proxy = false
372372
} else {
373373
log.Debugf("ARGV[%d]: %s", i, os.Args[i])
374-
if ("--proxy" == os.Args[i]) {
374+
if "--proxy" == os.Args[i] {
375375
proxy = true
376376
}
377377
}
@@ -570,10 +570,9 @@ func (env *Environment) Set(key, value string) {
570570

571571
// initLog opens the daemon log based on the current configuration settings.
572572
// If no log has been specified, initLog will try the following standard
573-
// locations.
574-
//
575-
// /var/log/newrelic/newrelic-daemon.log
576-
// /var/log/newrelic-daemon.log
573+
// locations:
574+
// - /var/log/newrelic/newrelic-daemon.log
575+
// - /var/log/newrelic-daemon.log
577576
//
578577
// If no suitable location can be found, a generic error is returned.
579578
func initLog(cfg *Config) error {

daemon/cmd/stressor/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,8 @@ const DaemonSampleRate = 3 * time.Second
122122

123123
// Application Behavior Constants
124124
// In order to roughly mimic the PHP agent, these should settings match
125-
// NR_APP_UNKNOWN_QUERY_BACKOFF_LIMIT_SECONDS
126-
// NR_APP_REFRESH_QUERY_PERIOD_SECONDS
125+
// - NR_APP_UNKNOWN_QUERY_BACKOFF_LIMIT_SECONDS
126+
// - NR_APP_REFRESH_QUERY_PERIOD_SECONDS
127127
const (
128128
connectedAppInfoPeriod = 20 * time.Second
129129
unconnectedAppInfoPeriod = 5 * time.Second

daemon/internal/flatbuffersdata/data_test.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -150,15 +150,15 @@ func TestFlatbuffersTxnData(t *testing.T) {
150150
// compilation to handle this rather than the flakier runtime.Version()
151151
// string.
152152
expect := `[` +
153-
`{"name":"Supportability/TxnData/CustomEvents","forced":true,"data":[1,3,0,3,3,9]},` +
154-
`{"name":"Supportability/TxnData/Metrics","forced":true,"data":[1,2,0,2,2,4]},` +
155-
`{"name":"Supportability/TxnData/Size","forced":true,"data":[1,1408,0,1408,1408,1982464]},` +
156-
`{"name":"Supportability/TxnData/SlowSQL","forced":true,"data":[1,1,0,1,1,1]},` +
157-
`{"name":"Supportability/TxnData/TraceSize","forced":true,"data":[1,2,0,2,2,4]},` +
158-
`{"name":"forced","forced":true,"data":[6,5,4,3,2,1]},` +
159-
`{"name":"scoped","forced":false,"data":[1,2,3,4,5,6]},` +
160-
`{"name":"scoped","forced":false,"data":[1,2,3,4,5,6]}` +
161-
`]`
153+
`{"name":"Supportability/TxnData/CustomEvents","forced":true,"data":[1,3,0,3,3,9]},` +
154+
`{"name":"Supportability/TxnData/Metrics","forced":true,"data":[1,2,0,2,2,4]},` +
155+
`{"name":"Supportability/TxnData/Size","forced":true,"data":[1,1408,0,1408,1408,1982464]},` +
156+
`{"name":"Supportability/TxnData/SlowSQL","forced":true,"data":[1,1,0,1,1,1]},` +
157+
`{"name":"Supportability/TxnData/TraceSize","forced":true,"data":[1,2,0,2,2,4]},` +
158+
`{"name":"forced","forced":true,"data":[6,5,4,3,2,1]},` +
159+
`{"name":"scoped","forced":false,"data":[1,2,3,4,5,6]},` +
160+
`{"name":"scoped","forced":false,"data":[1,2,3,4,5,6]}` +
161+
`]`
162162

163163
if s != expect {
164164
t.Fatal(s, expect)

daemon/internal/newrelic/collector/client.go

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,15 @@ type RpmControls struct {
5858
// Agent Behavior Summary:
5959
//
6060
// on connect/preconnect:
61-
// 410 means shutdown
62-
// 200, 202 mean success (start run)
63-
// all other response codes and errors mean try after backoff
61+
// - 410 means shutdown
62+
// - 200, 202 mean success (start run)
63+
// - all other response codes and errors mean try after backoff
6464
//
6565
// on harvest:
66-
// 410 means shutdown
67-
// 401, 409 mean restart run
68-
// 408, 429, 500, 503 mean save data for next harvest
69-
// all other response codes and errors discard the data and continue the current harvest
66+
// - 410 means shutdown
67+
// - 401, 409 mean restart run
68+
// - 408, 429, 500, 503 mean save data for next harvest
69+
// - all other response codes and errors discard the data and continue the current harvest
7070
type RPMResponse struct {
7171
StatusCode int
7272
Body []byte
@@ -97,7 +97,6 @@ func removeURLFromError(err error) error {
9797
ue.URL = "**REDACTED-URL**"
9898
}
9999

100-
101100
return err
102101
}
103102

@@ -116,7 +115,7 @@ func (resp RPMResponse) IsDisconnect() bool {
116115

117116
// IsRestartException indicates that the agent should restart.
118117
// 401 (License Exception) is considered a restart exception according to the spec,
119-
// and is included here as such, however the PHP agent will not restart on a 401 and instead stop
118+
// and is included here as such, however the PHP agent will not restart on a 401 and instead stop
120119
func (resp RPMResponse) IsRestartException() bool {
121120
return resp.StatusCode == 401 || resp.StatusCode == 409
122121
}

daemon/internal/newrelic/config/config.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,13 @@ func NewDecoder(r io.Reader) *Decoder {
6565
//
6666
// Decode implements the following PEG.
6767
//
68-
// INI = ((KEYWORD WS* '=' WS* VALUE) / COMMENT / WS)*
69-
// KEYWORD = ALPHA (ALPHA / NUMERIC / '_' / '.')*
70-
// VALUE = QUOTED / DQUOTED / RAW
71-
// QUOTED = '\'' .* '\''
72-
// DQUOTED = '"' .* '"'
73-
// RAW = .* EOL
74-
// COMMENT = ('#' / ';') .* EOL
68+
// INI = ((KEYWORD WS* '=' WS* VALUE) / COMMENT / WS)*
69+
// KEYWORD = ALPHA (ALPHA / NUMERIC / '_' / '.')*
70+
// VALUE = QUOTED / DQUOTED / RAW
71+
// QUOTED = '\'' .* '\''
72+
// DQUOTED = '"' .* '"'
73+
// RAW = .* EOL
74+
// COMMENT = ('#' / ';') .* EOL
7575
func (d *Decoder) Decode(v interface{}) (err error) {
7676
val := reflect.ValueOf(v)
7777
if val.Kind() != reflect.Ptr {

0 commit comments

Comments
 (0)