Skip to content
This repository has been archived by the owner on Jul 10, 2023. It is now read-only.

Commit

Permalink
Online Debugging (#130)
Browse files Browse the repository at this point in the history
* Add DebugBridge

* Change signal type

* Update debug bridge deployment

* Add websocket

* Start broker socker after ide socket

* Update debugBridge.ts

* Add auth token and session name env variables

* Remove system-sleep dependency

* Send timeout messages to the broker

* Add session timeout header to broker socket hs

* Update tests

* Add run without apiKey support

* Check if should start debugger

* Make debug bridge file aname a constant

* Check handshake errors and close debugger

* Update broker host and port

* Delete debugClient.js

* Update debugBridge.ts

* Update ThundraWrapper.ts

* Update ThundraWrapper.ts

* Change instrumentationDisabled to monitoringDisabled

* Update no apiKey message

* Update package-lock.json
  • Loading branch information
hamitb committed Feb 25, 2020
1 parent 5b9ea0f commit 51e1e78
Show file tree
Hide file tree
Showing 11 changed files with 592 additions and 323 deletions.
68 changes: 20 additions & 48 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
"require-in-the-middle": "^3.1.0",
"semver": "^5.5.0",
"shimmer": "^1.2.0",
"system-sleep": "^1.3.6",
"uuid": "^3.2.1"
"uuid": "^3.2.1",
"ws": "^7.2.1"
}
}
22 changes: 22 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,28 @@ module.exports = [
})
]
},
{
input: './src/debugBridge.ts',
output: {
file: 'dist/debugBridge.js',
format: 'cjs',
},
plugins: [
typescript(),
terser({
warnings: 'verbose',
compress: {
warnings: 'verbose',
},
mangle: {
keep_fnames: true,
},
output: {
beautify: false,
},
}),
],
},
{
input: './src/handler.ts',
output: {
Expand Down
16 changes: 14 additions & 2 deletions src/Constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,12 @@ export const envVariableKeys = {

THUNDRA_AGENT_LAMBDA_DEBUGGER_ENABLE: 'thundra_agent_lambda_debugger_enable',
THUNDRA_AGENT_LAMBDA_DEBUGGER_PORT: 'thundra_agent_lambda_debugger_port',
THUNDRA_AGENT_LAMBDA_DEBUGGER_LOGS_ENABLE: 'thundra_agent_lambda_debugger_logs_enable',
THUNDRA_AGENT_LAMBDA_DEBUGGER_WAIT_MAX: 'thundra_agent_lambda_debugger_wait_max',
THUNDRA_AGENT_LAMBDA_DEBUGGER_BROKER_PORT: 'thundra_agent_lambda_debugger_broker_port',
THUNDRA_AGENT_LAMBDA_DEBUGGER_BROKER_HOST: 'thundra_agent_lambda_debugger_broker_host',

THUNDRA_AGENT_LAMBDA_DEBUGGER_SESSION_NAME: 'thundra_agent_lambda_debugger_session_name',
THUNDRA_AGENT_LAMBDA_DEBUGGER_AUTH_TOKEN: 'thundra_agent_lambda_debugger_auth_token',
};

export function getTimeoutMargin(region: string) {
Expand Down Expand Up @@ -719,4 +721,14 @@ export const StdErrorLogContext = 'STDERR';
export const DefaultMongoCommandSizeLimit = 128 * 1024;

export const DEFAULT_THUNDRA_AGENT_LAMBDA_DEBUGGER_PORT = 1111;
export const DEFAULT_THUNDRA_AGENT_LAMBDA_DEBUGGER_HOST = 'debug.thundra.io';
export const DEFAULT_THUNDRA_AGENT_LAMBDA_DEBUGGER_BROKER_HOST = 'debug.thundra.io';
export const DEFAULT_THUNDRA_AGENT_LAMBDA_DEBUGGER_BROKER_PORT = 444;
export const DEFAULT_THUNDRA_AGENT_LAMBDA_DEBUGGER_SESSION_NAME = 'default';
export const DEBUG_BRIDGE_FILE_NAME = 'debugBridge.js';
export const BROKER_WS_PROTOCOL = 'wss://';
export const BROKER_WS_HTTP_ERROR_PATTERN = /:\s*\D*(\d+)/;
export const BROKER_WS_HTTP_ERR_CODE_TO_MSG: {[key: number]: string} = {
429: `Reached the concurrent session limit, couldn't start Thundra debugger.`,
401: `Authentication is failed, check your Thundra debugger authentication token.`,
409: `Another session with the same session name exists, connection closed.`,
};
Loading

0 comments on commit 51e1e78

Please sign in to comment.