Repository: newrelic/node-newrelic (js)

Issue:
Remove / fully 'release' serverless_mode feature flag
Looks like we've yet to cleanup the serverless_mode feature flag.

* Move to 'released' flags section.
* Remove any code using feature flag (it defaults to true)

This probably could avoid major bump as there's explicit configuration that could be set false, but we might as well follow semver for removal of configuration item.

Pull request:
removed serverless_mode as a configurable feature flag and moved into…
… the released section

<!--
Thank you for submitting a Pull Request.

This code is leveraged to monitor critical services. Please consider the following:
* Tests are required.
* Performance matters.
* Features that are specific to just your app are unlikely to make it in.

Please fill out the relevant sections as follows:
* Proposed Release Notes: Bulleted list of recommended release notes for the change(s).
* Links: Any relevant links for the change.
* Details: In-depth description of changes, other technical notes, etc.
-->

## Proposed Release Notes
 * Removed `serverless_mode` as a feature flag

## Links
Closes #667 


Patch:
diff --git a/lib/config/index.js b/lib/config/index.js
index a8f4f2f0e..ffcec6c4d 100644
--- a/lib/config/index.js
+++ b/lib/config/index.js
@@ -94,7 +94,7 @@ function fromObjectList(setting) {
 
 function _findConfigFile() {
   const configFileCandidates = getConfigFileLocations().reduce((files, configPath) => {
-    const configFiles = getConfigFileNames().map(filename => 
+    const configFiles = getConfigFileNames().map(filename =>
       path.join(path.resolve(configPath), filename)
     )
 
@@ -1326,9 +1326,6 @@ Config.prototype._canonicalize = function _canonicalize() {
     )
   }
 
-  this.serverless_mode.enabled = this.serverless_mode.enabled
-    && this.feature_flag.serverless_mode
-
   if (this.license_key) {
     this.license_key = this.license_key.trim()
   }
diff --git a/lib/feature_flags.js b/lib/feature_flags.js
index 68cf5e9d5..6a5ea1614 100644
--- a/lib/feature_flags.js
+++ b/lib/feature_flags.js
@@ -9,7 +9,6 @@
 exports.prerelease = {
   express5: false,
   await_support: true,
-  serverless_mode: true, // TODO: Move to released & remove code checks next Major.
   promise_segments: false,
   reverse_naming_rules: false,
   fastify_instrumentation: false,
@@ -28,6 +27,7 @@ exports.released = [
   'express_segments',
   'native_metrics',
   'protocol_17',
+  'serverless_mode',
   'send_request_uri_attribute',
   'synthetics',
   'dt_format_w3c'


Test patch:
diff --git a/test/unit/config/config.test.js b/test/unit/config/config.test.js
index 3c3eaaf8b..3d0a20331 100644
--- a/test/unit/config/config.test.js
+++ b/test/unit/config/config.test.js
@@ -600,15 +600,6 @@ describe('the agent configuration', function() {
     })
 
     describe('serverless mode', () => {
-      it('should should disable when feature flag false', () => {
-        idempotentEnv({
-          NEW_RELIC_FEATURE_FLAG_SERVERLESS_MODE: false,
-          NEW_RELIC_SERVERLESS_MODE_ENABLED: true,
-        }, (tc) => {
-          expect(tc.serverless_mode.enabled).to.be.false
-        })
-      })
-
       it('should pick up serverless_mode', () => {
         idempotentEnv({
           NEW_RELIC_SERVERLESS_MODE_ENABLED: true
@@ -716,19 +707,16 @@ describe('the agent configuration', function() {
 
   describe('when loading from a file', () => {
     describe('serverless mode', () => {
-      it('should be false when the feature flag is false', () => {
+      it('should be false when config false', () => {
         const conf = Config.initialize({
           serverless_mode: {
-            enabled: true
+            enabled: false
           },
-          feature_flag: {
-            serverless_mode: false
-          }
         })
         expect(conf.serverless_mode.enabled).to.be.false
       })
 
-      it('should be true when config true and feature flag defaulting true', () => {
+      it('should be true when config true', () => {
         const conf = Config.initialize({
           serverless_mode: {
             enabled: true
@@ -1350,7 +1338,7 @@ describe('the agent configuration', function() {
 
       processMainModuleStub.resetBehavior()
 
-      fs.rmdirSync(DESTDIR) 
+      fs.rmdirSync(DESTDIR)
       fs.rmdirSync(NOPLACEDIR)
       fs.rmdirSync(MAIN_MODULE_DIR)