Skip to content

Commit

Permalink
Add all user configurable config opts to diagnose
Browse files Browse the repository at this point in the history
With the default options in place, now we can iterate through the
configuration object data to print a more complete diagnose report.

The first option was to iterate through the constants defined in config
map, but that would give us empty values in the diagnose report.

I decided to iterate through the default values and ignore those that
the user cannot set as, that's what we do in the other integrations.
  • Loading branch information
luismiramirez committed Nov 3, 2021
1 parent bd4df16 commit ec93e49
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 25 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
bump: "patch"
---

All user-configurable options are now printed in the diagnose report.

Check the [list of available options](https://docs.appsignal.com/nodejs/configuration/options.html).
29 changes: 5 additions & 24 deletions packages/nodejs/src/cli/diagnose.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,30 +142,11 @@ export class Diagnose {
this.print_newline()

console.log(`Configuration`)
console.log(
` Environment: ${format_value(data["config"]["options"]["env"])}`
)

console.log(` debug: ${format_value(data["config"]["options"]["debug"])}`)

console.log(` log: ${format_value(data["config"]["options"]["log"])}`)

console.log(
` endpoint: ${format_value(data["config"]["options"]["endpoint"])}`
)
console.log(
` ca_file_path: ${format_value(
data["config"]["options"]["ca_file_path"]
)}`
)
console.log(
` active: ${format_value(data["config"]["options"]["active"])}`
)
console.log(
` push_api_key: ${format_value(
data["config"]["options"]["push_api_key"]
)}`
)
Object.keys(data["config"]["options"])
.sort()
.forEach(key => {
console.log(` ${key}: ${format_value(data["config"]["options"][key])}`)
})

this.print_newline()

Expand Down
6 changes: 6 additions & 0 deletions packages/nodejs/src/config/configmap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export const ENV_TO_KEY_MAPPING: { [key: string]: string } = {
APPSIGNAL_RUNNING_IN_CONTAINER: "runningInContainer",
APPSIGNAL_SEND_PARAMS: "sendParams",
APPSIGNAL_SKIP_SESSION_DATA: "skipSessionData",
APPSIGNAL_TRANSACTION_DEBUG_MODE: "transactionDebugMode",
APPSIGNAL_WORKING_DIRECTORY_PATH: "workingDirectoryPath",
APPSIGNAL_WORKING_DIR_PATH: "workingDirPath",
APP_REVISION: "revision"
Expand Down Expand Up @@ -64,20 +65,25 @@ export const JS_TO_RUBY_MAPPING: { [key: string]: string } = {
debug: "debug",
dnsServers: "dns_servers",
enableHostMetrics: "enable_host_metrics",
enableMinutelyProbes: "enable_minutely_probes",
enableStatsd: "enable_statsd",
endpoint: "endpoint",
environment: "env",
filesWorldAccessible: "files_world_accessible",
filterDataKeys: "filter_data_keys",
filterParameters: "filter_parameters",
filterSessionData: "filter_session_data",
hostname: "hostname",
ignoreActions: "ignore_actions",
ignoreErrors: "ignore_errors",
ignoreNamespaces: "ignore_namespaces",
log: "log",
logPath: "log_path",
logFilePath: "log_file_path",
name: "name",
revision: "revision",
runningInContainer: "running_in_container",
transactionDebugMode: "transaction_debug_mode",
workingDirPath: "working_dir_path",
workingDirectoryPath: "working_directory_path"
}
2 changes: 1 addition & 1 deletion test/integration/diagnose
Submodule diagnose updated 1 files
+33 −6 spec/diagnose_spec.rb

0 comments on commit ec93e49

Please sign in to comment.