From d8800cf82b9034e5829e18a8a8fd3a5fc9341161 Mon Sep 17 00:00:00 2001 From: ZNeumann Date: Tue, 28 Mar 2023 10:12:52 -0600 Subject: [PATCH 1/4] chore: version bump to 10.9 lilac (#651) --- VERSION | 2 +- axiom/nr_version.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/VERSION b/VERSION index 2a3262d8a..fe6d2ac74 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -10.8.0 +10.9.0 diff --git a/axiom/nr_version.c b/axiom/nr_version.c index 70fc103e4..afe25c6b0 100644 --- a/axiom/nr_version.c +++ b/axiom/nr_version.c @@ -23,7 +23,6 @@ /* * Current version naming scheme is flowers * - * watermelon 25Jan2021 (9.16) * xigua 21Apr2021 (9.17) * yam 23Aug2021 (9.18) * zomp 02Mar2022 (9.19) @@ -37,8 +36,9 @@ * hydrangea 18Jan2023 (10.5) * impatiens 13Feb2023 (10.6) * jasmine 08Mar2023 (10.7) + * kalmia 27Mar2023 (10.8) */ -#define NR_CODENAME "kalmia" +#define NR_CODENAME "lilac" const char* nr_version(void) { return NR_STR2(NR_VERSION); From 97145d13344933dfded56866f6a3f99735694bdb Mon Sep 17 00:00:00 2001 From: Michael Fulbright <89205663+mfulb@users.noreply.github.com> Date: Tue, 28 Mar 2023 17:36:29 -0400 Subject: [PATCH 2/4] feat(integration_runner): Add 'warn' test result (#642) This commit adds a 'warn' test result which is intended to be used to represent tests which could not be run due to something not being correct in the environment. The intention is 'skip' is for tests which cannot be run because of the PHP version or some other expected condition which would make the test not run in all environments. However, currently 'skip' is used to also represent when a test which is expected to run could not run due to a misconfiguration of the environment. This can cover up potential test run deficiencies. The use of 'warn' means the test environment is mis-configured. A new integration_runner boolean option 'warnisfail' will cause any warnings to be treated as a failure and the integration_runner will exit with a non-zero exit code to signify the failure. The 'warn' result can be returned by doing something like: ```die("warn: could not load important thing so test not run")```. --- src/integration_runner/main.go | 19 +++++++++++++++++-- src/integration_runner/reports.go | 8 ++++++++ src/newrelic/integration/test.go | 15 +++++++++++++++ 3 files changed, 40 insertions(+), 2 deletions(-) diff --git a/src/integration_runner/main.go b/src/integration_runner/main.go index 54c41b9a1..9f2f6c2a1 100644 --- a/src/integration_runner/main.go +++ b/src/integration_runner/main.go @@ -49,6 +49,7 @@ var ( flagWorkers = flag.Int("threads", 1, "") flagTime = flag.Bool("time", false, "time each test") flagMaxCustomEvents = flag.Int("max_custom_events", 30000, "value for newrelic.custom_events.max_samples_stored") + flagWarnIsFail = flag.Bool("warnisfail", false, "warn result is treated as a fail") // externalPort is the port on which we start a server to handle // external calls. @@ -384,7 +385,7 @@ func main() { handler.Lock() for _, tc := range tests { - if !tc.Failed && !tc.Skipped { + if !tc.Failed && !tc.Skipped && !tc.Warned { if handler.harvests[tc.Name] == nil { testsToRetry <- tc } @@ -403,16 +404,20 @@ func main() { deleteSockfile("unix", *flagPort) var numFailed int + var numWarned int // Compare the output handler.Lock() for _, tc := range tests { - if !tc.Failed && !tc.Skipped { + if !tc.Failed && !tc.Skipped && !tc.Warned { tc.Compare(handler.harvests[tc.Name]) } if tc.Failed && tc.Xfail == "" { numFailed++ } + if tc.Warned { + numWarned++ + } } tapOutput(tests) @@ -420,11 +425,15 @@ func main() { if numFailed > 0 { os.Exit(1) } + if *flagWarnIsFail && numWarned > 0 { + os.Exit(2) + } } var ( skipRE = regexp.MustCompile(`^(?i)\s*skip`) xfailRE = regexp.MustCompile(`^(?i)\s*xfail`) + warnRE = regexp.MustCompile(`^(?i)\s*warn`) ) func runTests(testsToRun chan *integration.Test, numWorkers int) { @@ -548,6 +557,12 @@ func runTest(t *integration.Test) { return } + if warnRE.Match(body) { + reason := string(bytes.TrimSpace(head(body))) + t.Warn(reason) + return + } + if xfailRE.Match(body) { // Strip xfail message from body so it does not affect expectations. tmp := bytes.SplitN(body, []byte("\n"), 2) diff --git a/src/integration_runner/reports.go b/src/integration_runner/reports.go index ceae9542e..505dfc902 100644 --- a/src/integration_runner/reports.go +++ b/src/integration_runner/reports.go @@ -34,6 +34,7 @@ var ( type TestRunTotals struct { passed int skipped int + warned int failed int xfail int } @@ -51,6 +52,10 @@ func (totals *TestRunTotals) Accumulate(test *integration.Test) { totals.skipped++ return } + if test.Warned { + totals.warned++ + return + } if test.Failed { if "" != test.Xfail { totals.xfail++ @@ -71,6 +76,8 @@ func tapOutput(tests []*integration.Test) { switch { case test.Skipped: fmt.Println(Warn("skip -"), name, "#", Warn(test.Err)) + case test.Warned: + fmt.Println(Warn("warn -"), name, "#", Warn(test.Err)) case test.Failed: if "" != test.Xfail { fmt.Println("xfail -", name) @@ -100,6 +107,7 @@ func tapOutput(tests []*integration.Test) { } fmt.Println("#", totals.passed, "passed") fmt.Println("#", totals.skipped, "skipped") + fmt.Println("#", totals.warned, "warned") if totals.failed == 0 { fmt.Println("#", Good(totals.failed), Good("failed")) } else { diff --git a/src/newrelic/integration/test.go b/src/newrelic/integration/test.go index fd85a24f7..14d66bddc 100644 --- a/src/newrelic/integration/test.go +++ b/src/newrelic/integration/test.go @@ -63,6 +63,7 @@ type Test struct { // Remaining fields are populated after the test is run. Skipped bool + Warned bool // If the test was skipped or the test could not be run due to an // error, describes the reason. @@ -137,6 +138,19 @@ func (t *Test) Skipf(format string, args ...interface{}) { t.Err = fmt.Errorf(format, args...) } +// Warn marks the test as unable to be run and records the given reason. +func (t *Test) Warn(reason string) { + t.Warned = true + t.Err = errors.New(reason) +} + +// Warnf marks the test as unable to be run and formats its arguments +// according to the format, and records the text as the reason. +func (t *Test) Warnf(format string, args ...interface{}) { + t.Warned = true + t.Err = fmt.Errorf(format, args...) +} + // Fail records an unsatisified expectation for the test and marks // the test as failed. func (t *Test) Fail(err error) { @@ -460,6 +474,7 @@ func (t *Test) Compare(harvest *newrelic.Harvest) { func (t *Test) Reset() { t.Xfail = "" t.Skipped = false + t.Warned = false t.Err = nil t.Output = nil t.Failed = false From 995524d2ac8c384a29a9955cca9a9872b765b5fb Mon Sep 17 00:00:00 2001 From: ZNeumann Date: Thu, 30 Mar 2023 12:14:34 -0600 Subject: [PATCH 3/4] test: make tests more robust to timing slowdowns (#652) These tests depended upon certain function calls being below our significance threshold (2 ms). Sometimes, when running on a loaded CPU, even these tiny functions would surpass this threshold. This PR sets the threshold for those tests to 1s, which should never fail unless there is some serious other problem. --- agent/scripts/newrelic.ini.private.template | 2 +- .../test_transaction_nested_user_functions_clm.php | 9 +++++---- .../test_transaction_nested_user_functions_clm_off.php | 1 + 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/agent/scripts/newrelic.ini.private.template b/agent/scripts/newrelic.ini.private.template index 07c69e567..b366ff7db 100644 --- a/agent/scripts/newrelic.ini.private.template +++ b/agent/scripts/newrelic.ini.private.template @@ -97,7 +97,7 @@ ;newrelic.special.disable_instrumentation = "" ; Setting: newrelic.special.expensive_node_min -; Type : integer (time in msec) +; Type : integer (time in microseconds) ; Scope : system ; Default: 2 * NR_TIME_DIVISOR_MS ; Info : Sets the threshold for expensive transactions. diff --git a/tests/integration/attributes/test_transaction_nested_user_functions_clm.php b/tests/integration/attributes/test_transaction_nested_user_functions_clm.php index b6bf788f9..84418254a 100644 --- a/tests/integration/attributes/test_transaction_nested_user_functions_clm.php +++ b/tests/integration/attributes/test_transaction_nested_user_functions_clm.php @@ -20,6 +20,7 @@ /*INI newrelic.transaction_tracer.threshold = 0 newrelic.code_level_metrics.enabled = 1 +newrelic.special.expensive_node_min = 1000000 */ /*EXPECT_SPAN_EVENTS @@ -64,7 +65,7 @@ }, {}, { - "code.lineno": 214, + "code.lineno": 215, "code.filepath": "__FILE__", "code.function": "level_2" } @@ -85,7 +86,7 @@ }, {}, { - "code.lineno": 210, + "code.lineno": 211, "code.filepath": "__FILE__", "code.function": "level_1" } @@ -146,7 +147,7 @@ [ "?? start time", "?? end time", "`1", { - "code.lineno": 214, + "code.lineno": 215, "code.filepath": "__FILE__", "code.function": "level_2" }, @@ -154,7 +155,7 @@ [ "?? start time", "?? end time", "`2", { - "code.lineno": 210, + "code.lineno": 211, "code.filepath": "__FILE__", "code.function": "level_1" }, diff --git a/tests/integration/attributes/test_transaction_nested_user_functions_clm_off.php b/tests/integration/attributes/test_transaction_nested_user_functions_clm_off.php index 2780c4cf1..2cad444b2 100644 --- a/tests/integration/attributes/test_transaction_nested_user_functions_clm_off.php +++ b/tests/integration/attributes/test_transaction_nested_user_functions_clm_off.php @@ -18,6 +18,7 @@ /*INI newrelic.transaction_tracer.threshold = 0 newrelic.code_level_metrics.enabled = 0 +newrelic.special.expensive_node_min = 1000000 */ /*EXPECT_SPAN_EVENTS From 65bfbbaeb6381977ffba94512af1ddb4d104579d Mon Sep 17 00:00:00 2001 From: Michal Nowacki Date: Mon, 3 Apr 2023 17:47:41 -0400 Subject: [PATCH 4/4] ci: build daemon with release build workflow (#650) Update release-build workflow to build daemon using recent version of golang. --- .github/workflows/release-build.yml | 34 +++++++++++++++++++++++++++++ make/release.mk | 2 +- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release-build.yml b/.github/workflows/release-build.yml index fd751927c..77f26bd92 100644 --- a/.github/workflows/release-build.yml +++ b/.github/workflows/release-build.yml @@ -23,6 +23,40 @@ on: type: string jobs: + daemon_release: + env: + IMAGE_NAME: newrelic/nr-php-agent-builder + IMAGE_TAG: make-go + IMAGE_VERSION: v1 + runs-on: ubuntu-latest + strategy: + matrix: + platform: [gnu, musl] + arch: [amd64] + steps: + - name: Checkout newrelic-php-agent code + uses: actions/checkout@v3 + with: + ref: ${{ github.event.client_payload.ref }} + path: newrelic-php-agent + - name: Login to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Build daemon + run: > + docker run --rm --platform linux/${{matrix.arch}} + -v "${GITHUB_WORKSPACE}/newrelic-php-agent":"/usr/local/src/newrelic-php-agent" + -e USE_SYSTEM_CERTS=1 + -e BUILD_NUMBER=${{inputs.build-number}} + $IMAGE_NAME:$IMAGE_TAG-${{ matrix.platform }}-$IMAGE_VERSION release-daemon + - name: Save build artifacts + uses: actions/upload-artifact@v3 + with: + path: newrelic-php-agent/releases + name: release-from-gha + if-no-files-found: error agent_release: env: IMAGE_NAME: newrelic/nr-php-agent-builder diff --git a/make/release.mk b/make/release.mk index 60c628dde..e29c3fa7a 100644 --- a/make/release.mk +++ b/make/release.mk @@ -55,7 +55,7 @@ endif .PHONY: release -release: Makefile release-version release-daemon release-installer release-agent release-docs release-scripts | releases/$(RELEASE_OS)/ +release: Makefile release-version release-installer release-agent release-docs release-scripts | releases/$(RELEASE_OS)/ release-version: releases/$(RELEASE_OS)/ printf '%s\n' "$(AGENT_VERSION)" > releases/$(RELEASE_OS)/VERSION