Skip to content

Commit

Permalink
Remove the debug config options
Browse files Browse the repository at this point in the history
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
  • Loading branch information
tombruijn committed Oct 5, 2022
1 parent 94c98b8 commit 2b95a68
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 32 deletions.
6 changes: 6 additions & 0 deletions .changesets/remove--debug--config-option.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
bump: "major"
type: "remove"
---

Remove `debug` config option. This has been replaced with `logLevel` set to `debug`.
14 changes: 1 addition & 13 deletions src/__tests__/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ describe("Configuration", () => {
const expectedDefaultConfig = {
active: false,
caFilePath: path.join(__dirname, "../../cert/cacert.pem"),
debug: false,
disableDefaultInstrumentations: false,
dnsServers: [],
enableHostMetrics: true,
Expand All @@ -41,8 +40,7 @@ describe("Configuration", () => {
],
sendEnvironmentMetadata: true,
sendParams: true,
sendSessionData: true,
transactionDebugMode: false
sendSessionData: true
}

function resetEnv() {
Expand Down Expand Up @@ -102,7 +100,6 @@ describe("Configuration", () => {
describe("with initial config options", () => {
it("loads initial config options", () => {
const initialOptions = {
debug: true,
enableStatsd: true
}
const options = {
Expand All @@ -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 = {
Expand Down Expand Up @@ -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()
Expand All @@ -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()
Expand All @@ -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,
Expand All @@ -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")
Expand Down Expand Up @@ -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")
Expand Down
1 change: 0 additions & 1 deletion src/__tests__/diagnose.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
11 changes: 1 addition & 10 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down Expand Up @@ -113,7 +106,6 @@ export class Configuration {
return {
active: false,
caFilePath: path.join(__dirname, "../cert/cacert.pem"),
debug: false,
disableDefaultInstrumentations: false,
dnsServers: [],
enableHostMetrics: true,
Expand All @@ -140,8 +132,7 @@ export class Configuration {
],
sendEnvironmentMetadata: true,
sendParams: true,
sendSessionData: true,
transactionDebugMode: false
sendSessionData: true
}
}

Expand Down
6 changes: 0 additions & 6 deletions src/config/configmap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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"
Expand All @@ -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",
Expand All @@ -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"
Expand All @@ -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",
Expand All @@ -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"
}
1 change: 0 additions & 1 deletion src/config/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ export type AppsignalOptions = {
active: boolean
apiKey: string
caFilePath: string
debug: boolean
disableDefaultInstrumentations: DefaultInstrumentationName[] | boolean
dnsServers: string[]
enableHostMetrics: boolean
Expand Down
2 changes: 1 addition & 1 deletion test/integration/diagnose

0 comments on commit 2b95a68

Please sign in to comment.