From 2b95a6883c0da65f865b17be4e73856845d51d64 Mon Sep 17 00:00:00 2001 From: Tom de Bruijn Date: Wed, 5 Oct 2022 15:01:44 +0200 Subject: [PATCH] Remove the debug config options Remove `debug` and `transactionDebugMode` config options. They have both been replaced with the `logLevel` config option. Remove the `Config.debug()` function. It only worked with the deprecated config option, and isn't used anywhere. Part of #738 --- .changesets/remove--debug--config-option.md | 6 ++++++ src/__tests__/config.test.ts | 14 +------------- src/__tests__/diagnose.test.ts | 1 - src/config.ts | 11 +---------- src/config/configmap.ts | 6 ------ src/config/options.ts | 1 - test/integration/diagnose | 2 +- 7 files changed, 9 insertions(+), 32 deletions(-) create mode 100644 .changesets/remove--debug--config-option.md diff --git a/.changesets/remove--debug--config-option.md b/.changesets/remove--debug--config-option.md new file mode 100644 index 00000000..887aa406 --- /dev/null +++ b/.changesets/remove--debug--config-option.md @@ -0,0 +1,6 @@ +--- +bump: "major" +type: "remove" +--- + +Remove `debug` config option. This has been replaced with `logLevel` set to `debug`. diff --git a/src/__tests__/config.test.ts b/src/__tests__/config.test.ts index f0b301cc..8966c098 100644 --- a/src/__tests__/config.test.ts +++ b/src/__tests__/config.test.ts @@ -14,7 +14,6 @@ describe("Configuration", () => { const expectedDefaultConfig = { active: false, caFilePath: path.join(__dirname, "../../cert/cacert.pem"), - debug: false, disableDefaultInstrumentations: false, dnsServers: [], enableHostMetrics: true, @@ -41,8 +40,7 @@ describe("Configuration", () => { ], sendEnvironmentMetadata: true, sendParams: true, - sendSessionData: true, - transactionDebugMode: false + sendSessionData: true } function resetEnv() { @@ -102,7 +100,6 @@ describe("Configuration", () => { describe("with initial config options", () => { it("loads initial config options", () => { const initialOptions = { - debug: true, enableStatsd: true } const options = { @@ -124,10 +121,8 @@ describe("Configuration", () => { describe("with config in the environment", () => { it("loads configuration from the environment", () => { - process.env["APPSIGNAL_DEBUG"] = "true" process.env["APPSIGNAL_ENABLE_STATSD"] = "true" const envOptions = { - debug: true, enableStatsd: true } const expectedConfig = { @@ -244,7 +239,6 @@ describe("Configuration", () => { expect(env("_APPSIGNAL_ACTIVE")).toBeUndefined() expect(env("_APPSIGNAL_APP_NAME")).toBeUndefined() expect(env("_APPSIGNAL_CA_FILE_PATH")).toMatch(/cert\/cacert\.pem$/) - expect(env("_APPSIGNAL_DEBUG_LOGGING")).toBeUndefined() expect(env("_APPSIGNAL_DNS_SERVERS")).toBeUndefined() expect(env("_APPSIGNAL_ENABLE_HOST_METRICS")).toEqual("true") expect(env("_APPSIGNAL_ENABLE_STATSD")).toBeUndefined() @@ -264,7 +258,6 @@ describe("Configuration", () => { ) expect(env("_APPSIGNAL_PUSH_API_KEY")).toBeUndefined() expect(env("_APPSIGNAL_RUNNING_IN_CONTAINER")).toBeUndefined() - expect(env("_APPSIGNAL_TRANSACTION_DEBUG_MODE")).toBeUndefined() expect(env("_APPSIGNAL_WORKING_DIRECTORY_PATH")).toBeUndefined() expect(env("_APPSIGNAL_WORKING_DIR_PATH")).toBeUndefined() expect(env("_APP_REVISION")).toBeUndefined() @@ -287,7 +280,6 @@ describe("Configuration", () => { name, active: true, pushApiKey, - debug: true, dnsServers: ["8.8.8.8", "8.8.4.4"], enableHostMetrics: false, enableMinutelyProbes: false, @@ -311,7 +303,6 @@ describe("Configuration", () => { it("writes configuration values to the environment", () => { expect(env("_APPSIGNAL_ACTIVE")).toEqual("true") expect(env("_APPSIGNAL_APP_NAME")).toEqual(name) - expect(env("_APPSIGNAL_DEBUG_LOGGING")).toEqual("true") expect(env("_APPSIGNAL_DNS_SERVERS")).toEqual("8.8.8.8,8.8.4.4") expect(env("_APPSIGNAL_ENABLE_HOST_METRICS")).toEqual("true") expect(env("_APPSIGNAL_ENABLE_STATSD")).toEqual("true") @@ -340,9 +331,6 @@ describe("Configuration", () => { expect(env("_APPSIGNAL_PUSH_API_KEY")).toEqual(pushApiKey) expect(env("_APPSIGNAL_RUNNING_IN_CONTAINER")).toEqual("true") expect(env("_APPSIGNAL_SEND_ENVIRONMENT_METADATA")).toEqual("true") - // Only set because `debug` is set to true - // @TODO: https://github.com/appsignal/appsignal-nodejs/issues/379 - expect(env("_APPSIGNAL_TRANSACTION_DEBUG_MODE")).toEqual("true") expect(env("_APPSIGNAL_WORKING_DIRECTORY_PATH")).toEqual("/my/path") expect(env("_APPSIGNAL_WORKING_DIR_PATH")).toBeUndefined() expect(env("_APP_REVISION")).toEqual("my-revision") diff --git a/src/__tests__/diagnose.test.ts b/src/__tests__/diagnose.test.ts index 10fc6575..d8ea3289 100644 --- a/src/__tests__/diagnose.test.ts +++ b/src/__tests__/diagnose.test.ts @@ -20,7 +20,6 @@ describe("DiagnoseTool", () => { expect(output.host.architecture).toEqual(process.arch) expect(output.host.os).toEqual(process.platform) - expect(output.config.options).toHaveProperty("debug") expect(output.config.options).toHaveProperty("log") expect(output.config.options).toHaveProperty("caFilePath") expect(output.config.options).toHaveProperty("endpoint") diff --git a/src/config.ts b/src/config.ts index 363d136c..6dbad273 100644 --- a/src/config.ts +++ b/src/config.ts @@ -40,13 +40,6 @@ export class Configuration { this.writePrivateConfig(this.data) } - /** - * Returns `true` if the client is in debug mode - */ - public get debug(): boolean { - return this.data.debug || false - } - /** * Returns `true` if the current configuration is valid. */ @@ -113,7 +106,6 @@ export class Configuration { return { active: false, caFilePath: path.join(__dirname, "../cert/cacert.pem"), - debug: false, disableDefaultInstrumentations: false, dnsServers: [], enableHostMetrics: true, @@ -140,8 +132,7 @@ export class Configuration { ], sendEnvironmentMetadata: true, sendParams: true, - sendSessionData: true, - transactionDebugMode: false + sendSessionData: true } } diff --git a/src/config/configmap.ts b/src/config/configmap.ts index ebd70114..7a1a6217 100644 --- a/src/config/configmap.ts +++ b/src/config/configmap.ts @@ -3,7 +3,6 @@ export const ENV_TO_KEY_MAPPING: { [key: string]: string } = { APPSIGNAL_APP_ENV: "environment", APPSIGNAL_APP_NAME: "name", APPSIGNAL_CA_FILE_PATH: "caFilePath", - APPSIGNAL_DEBUG: "debug", APPSIGNAL_DISABLE_DEFAULT_INSTRUMENTATIONS: "disableDefaultInstrumentations", APPSIGNAL_DNS_SERVERS: "dnsServers", APPSIGNAL_ENABLE_HOST_METRICS: "enableHostMetrics", @@ -31,7 +30,6 @@ export const ENV_TO_KEY_MAPPING: { [key: string]: string } = { APPSIGNAL_SEND_ENVIRONMENT_METADATA: "sendEnvironmentMetadata", APPSIGNAL_SEND_PARAMS: "sendParams", APPSIGNAL_SEND_SESSION_DATA: "sendSessionData", - APPSIGNAL_TRANSACTION_DEBUG_MODE: "transactionDebugMode", APPSIGNAL_WORKING_DIRECTORY_PATH: "workingDirectoryPath", APPSIGNAL_WORKING_DIR_PATH: "workingDirPath", APP_REVISION: "revision" @@ -41,7 +39,6 @@ export const PRIVATE_ENV_MAPPING: { [key: string]: string } = { _APPSIGNAL_ACTIVE: "active", _APPSIGNAL_APP_NAME: "name", _APPSIGNAL_CA_FILE_PATH: "caFilePath", - _APPSIGNAL_DEBUG_LOGGING: "debug", _APPSIGNAL_DNS_SERVERS: "dnsServers", _APPSIGNAL_ENABLE_HOST_METRICS: "enableHostMetrics", _APPSIGNAL_ENABLE_STATSD: "enableStatsd", @@ -60,7 +57,6 @@ export const PRIVATE_ENV_MAPPING: { [key: string]: string } = { _APPSIGNAL_PUSH_API_KEY: "pushApiKey", _APPSIGNAL_RUNNING_IN_CONTAINER: "runningInContainer", _APPSIGNAL_SEND_ENVIRONMENT_METADATA: "sendEnvironmentMetadata", - _APPSIGNAL_TRANSACTION_DEBUG_MODE: "debug", _APPSIGNAL_WORKING_DIRECTORY_PATH: "workingDirectoryPath", _APPSIGNAL_WORKING_DIR_PATH: "workingDirPath", _APP_REVISION: "revision" @@ -70,7 +66,6 @@ export const JS_TO_RUBY_MAPPING: { [key: string]: string } = { active: "active", pushApiKey: "push_api_key", caFilePath: "ca_file_path", - debug: "debug", disableDefaultInstrumentations: "disable_default_instrumentations", dnsServers: "dns_servers", enableHostMetrics: "enable_host_metrics", @@ -95,7 +90,6 @@ export const JS_TO_RUBY_MAPPING: { [key: string]: string } = { sendEnvironmentMetadata: "send_environment_metadata", sendParams: "send_params", sendSessionData: "send_session_data", - transactionDebugMode: "transaction_debug_mode", workingDirPath: "working_dir_path", workingDirectoryPath: "working_directory_path" } diff --git a/src/config/options.ts b/src/config/options.ts index d0af801e..cf0a5b48 100644 --- a/src/config/options.ts +++ b/src/config/options.ts @@ -4,7 +4,6 @@ export type AppsignalOptions = { active: boolean apiKey: string caFilePath: string - debug: boolean disableDefaultInstrumentations: DefaultInstrumentationName[] | boolean dnsServers: string[] enableHostMetrics: boolean diff --git a/test/integration/diagnose b/test/integration/diagnose index beaae652..090b5888 160000 --- a/test/integration/diagnose +++ b/test/integration/diagnose @@ -1 +1 @@ -Subproject commit beaae6523ffad61155abefdf8d693be810d5fb73 +Subproject commit 090b5888b89a7709c855c83e673e26450902690e