fix the opentelemetry setup

Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
Fredrik Adelöw
2024-02-28 13:30:52 +01:00
parent bb5b6ee309
commit c5d7b40b4b
15 changed files with 1687 additions and 88 deletions
+1
View File
@@ -280,6 +280,7 @@ Options:
--check
--inspect [host]
--inspect-brk [host]
--require <path>
-h, --help
```
+1
View File
@@ -120,6 +120,7 @@ export function registerScriptCommand(program: Command) {
'--inspect-brk [host]',
'Enable debugger in Node.js environments, breaking before code starts',
)
.option('--require <path>', 'Add a --require argument to the node process')
.action(lazy(() => import('./start').then(m => m.command)));
command
@@ -27,6 +27,7 @@ export async function command(opts: OptionValues): Promise<void> {
checksEnabled: Boolean(opts.check),
inspectEnabled: opts.inspect,
inspectBrkEnabled: opts.inspectBrk,
require: opts.require,
};
switch (role) {
@@ -23,6 +23,7 @@ interface StartBackendOptions {
checksEnabled: boolean;
inspectEnabled: boolean;
inspectBrkEnabled: boolean;
require?: string;
}
export async function startBackend(options: StartBackendOptions) {
@@ -32,6 +33,7 @@ export async function startBackend(options: StartBackendOptions) {
checksEnabled: false, // not supported
inspectEnabled: options.inspectEnabled,
inspectBrkEnabled: options.inspectBrkEnabled,
require: options.require,
});
await waitForExit();
@@ -41,6 +43,7 @@ export async function startBackend(options: StartBackendOptions) {
checksEnabled: options.checksEnabled,
inspectEnabled: options.inspectEnabled,
inspectBrkEnabled: options.inspectBrkEnabled,
require: options.require,
});
await waitForExit();
@@ -70,6 +73,7 @@ export async function startBackendPlugin(options: StartBackendOptions) {
checksEnabled: false, // not supported
inspectEnabled: options.inspectEnabled,
inspectBrkEnabled: options.inspectBrkEnabled,
require: options.require,
});
await waitForExit();
@@ -87,6 +91,7 @@ export async function startBackendPlugin(options: StartBackendOptions) {
checksEnabled: options.checksEnabled,
inspectEnabled: options.inspectEnabled,
inspectBrkEnabled: options.inspectBrkEnabled,
require: options.require,
});
await waitForExit();
@@ -98,6 +103,7 @@ async function cleanDistAndServeBackend(options: {
checksEnabled: boolean;
inspectEnabled: boolean;
inspectBrkEnabled: boolean;
require?: string;
}) {
// Cleaning dist/ before we start the dev process helps work around an issue
// where we end up with the entrypoint executing multiple times, causing
+3
View File
@@ -276,6 +276,9 @@ export async function createBackendConfig(
: '--inspect-brk';
runScriptNodeArgs.push(inspect);
}
if (options.require) {
runScriptNodeArgs.push(`--require=${options.require}`);
}
return {
mode: isDev ? 'development' : 'production',
+2
View File
@@ -54,10 +54,12 @@ export type BackendBundlingOptions = {
parallelism?: number;
inspectEnabled: boolean;
inspectBrkEnabled: boolean;
require?: string;
};
export type BackendServeOptions = BundlingPathsOptions & {
checksEnabled: boolean;
inspectEnabled: boolean;
inspectBrkEnabled: boolean;
require?: string;
};
@@ -96,6 +96,9 @@ export async function startBackendExperimental(options: BackendServeOptions) {
: '--inspect-brk';
optionArgs.push(inspect);
}
if (options.require) {
optionArgs.push(`--require=${options.require}`);
}
const userArgs = process.argv
.slice(['node', 'backstage-cli', 'package', 'start'].length)