@appsignal/nodejs
Advanced tools
Comparing version
@@ -0,3 +1,7 @@ | ||
import { HashMap } from "@appsignal/types"; | ||
export declare class Diagnose { | ||
run(): Promise<void>; | ||
printAgentDiagnose(report: HashMap<any>): void; | ||
printAgentTest(definition: HashMap<any>, test: HashMap<any>): void; | ||
agentDiagnosticTestDefinition(): HashMap<any>; | ||
send_report(data: object): void; | ||
@@ -4,0 +8,0 @@ print_newline(): void; |
@@ -73,2 +73,4 @@ "use strict"; | ||
this.print_newline(); | ||
this.printAgentDiagnose(data["agent"]); | ||
this.print_newline(); | ||
console.log(`Configuration`); | ||
@@ -133,2 +135,103 @@ console.log(` Environment: ${format_value(data["config"]["options"]["env"])}`); | ||
} | ||
printAgentDiagnose(report) { | ||
if (report["error"]) { | ||
console.log(" Error while parsing agent diagnostics report:"); | ||
console.log(` Error: ${report["error"]}`); | ||
console.log(` Output: ${report["output"]}`); | ||
} | ||
else { | ||
console.log("Agent diagnostics"); | ||
const reportDefinition = this.agentDiagnosticTestDefinition(); | ||
for (const component in reportDefinition) { | ||
const componentDefinition = reportDefinition[component]; | ||
const componentTests = componentDefinition["tests"]; | ||
console.log(` ${componentDefinition.label}`); | ||
for (const category in componentTests) { | ||
const tests = componentTests[category]; | ||
for (const testName in tests) { | ||
const testDefinition = tests[testName]; | ||
const componentReport = report[component] || {}; | ||
const categoryReport = componentReport[category] || {}; | ||
const testReport = categoryReport[testName] || {}; | ||
this.printAgentTest(testDefinition, testReport); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
printAgentTest(definition, test) { | ||
const value = test["result"]; | ||
const error = test["error"]; | ||
const output = test["output"]; | ||
let formattedValue; | ||
if (value !== undefined) { | ||
const stringValue = value.toString(); | ||
formattedValue = definition.values | ||
? definition.values[stringValue] | ||
: stringValue; | ||
} | ||
if (!formattedValue) { | ||
formattedValue = "-"; | ||
} | ||
console.log(` ${definition["label"]}: ${formattedValue}`); | ||
if (error) { | ||
console.log(` Error: ${error}`); | ||
} | ||
if (output) { | ||
console.log(` Output: ${output}`); | ||
} | ||
} | ||
agentDiagnosticTestDefinition() { | ||
return { | ||
extension: { | ||
label: "Extension tests", | ||
tests: { | ||
config: { | ||
valid: { | ||
label: "Configuration", | ||
values: { true: "valid", false: "invalid" } | ||
} | ||
} | ||
} | ||
}, | ||
agent: { | ||
label: "Agent tests", | ||
tests: { | ||
boot: { | ||
started: { | ||
label: "Started", | ||
values: { true: "started", false: "not started" } | ||
} | ||
}, | ||
host: { | ||
uid: { label: "Process user id" }, | ||
gid: { label: "Process user group id" } | ||
}, | ||
config: { | ||
valid: { | ||
label: "Configuration", | ||
values: { true: "valid", false: "invalid" } | ||
} | ||
}, | ||
logger: { | ||
started: { | ||
label: "Logger", | ||
values: { true: "started", false: "not started" } | ||
} | ||
}, | ||
working_directory_stat: { | ||
uid: { label: "Working directory user id" }, | ||
gid: { label: "Working directory user group id" }, | ||
mode: { label: "Working directory permissions" } | ||
}, | ||
lock_path: { | ||
created: { | ||
label: "Lock path", | ||
values: { true: "writable", false: "not writable" } | ||
} | ||
} | ||
} | ||
} | ||
}; | ||
} | ||
send_report(data) { | ||
@@ -135,0 +238,0 @@ const json = JSON.stringify(data); |
@@ -15,3 +15,3 @@ import { Client, Metrics, Plugin, Tracer, AppsignalOptions } from "./interfaces"; | ||
#private; | ||
readonly VERSION = "2.2.1"; | ||
readonly VERSION = "2.2.2"; | ||
config: Configuration; | ||
@@ -18,0 +18,0 @@ extension: Extension; |
@@ -29,2 +29,3 @@ "use strict"; | ||
APPSIGNAL_ENABLE_MINUTELY_PROBES: "enableMinutelyProbes", | ||
APPSIGNAL_ENABLE_STATSD: "enableStatsd", | ||
APPSIGNAL_SKIP_SESSION_DATA: "skipSessionData", | ||
@@ -53,2 +54,3 @@ APPSIGNAL_FILES_WORLD_ACCESSIBLE: "filesWorldAccessible", | ||
_APPSIGNAL_ENABLE_HOST_METRICS: "enableHostMetrics", | ||
_APPSIGNAL_ENABLE_STATSD: "enableStatsd", | ||
_APPSIGNAL_HOSTNAME: "hostname", | ||
@@ -77,2 +79,3 @@ _APPSIGNAL_CA_FILE_PATH: "caFilePath", | ||
enableHostMetrics: "enable_host_metrics", | ||
enableStatsd: "enable_statsd", | ||
hostname: "hostname", | ||
@@ -79,0 +82,0 @@ caFilePath: "ca_file_path", |
@@ -40,3 +40,3 @@ /// <reference types="node" /> | ||
app: {}; | ||
extension: object; | ||
agent: object; | ||
config: { | ||
@@ -43,0 +43,0 @@ options: { |
@@ -36,3 +36,3 @@ "use strict"; | ||
app: {}, | ||
extension: tslib_1.__classPrivateFieldGet(this, _extension).diagnose(), | ||
agent: tslib_1.__classPrivateFieldGet(this, _extension).diagnose(), | ||
config: { | ||
@@ -39,0 +39,0 @@ options: this.getConfigData(), |
@@ -47,3 +47,14 @@ "use strict"; | ||
if (this.isLoaded) { | ||
return JSON.parse(extension_wrapper_1.extension.diagnoseRaw()); | ||
process.env._APPSIGNAL_DIAGNOSE = "true"; | ||
const diagnostics_report_string = extension_wrapper_1.extension.diagnoseRaw(); | ||
delete process.env._APPSIGNAL_DIAGNOSE; | ||
try { | ||
return JSON.parse(diagnostics_report_string); | ||
} | ||
catch (error) { | ||
return { | ||
error: error, | ||
output: diagnostics_report_string.split("\n") | ||
}; | ||
} | ||
} | ||
@@ -50,0 +61,0 @@ else { |
@@ -25,2 +25,3 @@ export interface AppsignalOptions { | ||
enableMinutelyProbes: boolean; | ||
enableStatsd: boolean; | ||
skipSessionData: boolean; | ||
@@ -27,0 +28,0 @@ filesWorldAccessible: boolean; |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "2.2.1"; | ||
export declare const VERSION = "2.2.2"; | ||
export declare const AGENT_VERSION = "7376537"; |
@@ -5,3 +5,3 @@ "use strict"; | ||
// Do not touch this file, auto-generated by scripts/create-versionfile | ||
exports.VERSION = "2.2.1"; | ||
exports.VERSION = "2.2.2"; | ||
exports.AGENT_VERSION = "7376537"; |
{ | ||
"name": "@appsignal/nodejs", | ||
"version": "2.2.1", | ||
"version": "2.2.2", | ||
"main": "dist/index", | ||
@@ -5,0 +5,0 @@ "types": "dist/index", |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
358647
0.84%3645
1.33%92
-2.13%15
15.38%