Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions Bootstrap/Helpers.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
import { DiagnosticLog, DiagnosticMessageId } from "./DataModel";
import { DiagnosticLogger } from "./DiagnosticLogger";
import { isWindows, isLinux } from "../Library/PrefixHelper";

export function sdkAlreadyExists(_logger: DiagnosticLogger): boolean {
try {
// appInstance should either resolve to user SDK or crash. If it resolves to attach SDK, user probably modified their NODE_PATH
let appInstance: string;
try {
// Node 8.9+ Windows
if (isWindows()) {
appInstance = (require.resolve as any)("applicationinsights", { paths: [process.cwd()] });
}
// Node 8.9+ Linux
else if (isLinux()) {
appInstance = `${process.cwd()}${(require.resolve as any)("applicationinsights", { paths: [process.cwd()] })}`;
}
// Node 8.9+
appInstance = (require.resolve as any)("applicationinsights", { paths: [process.cwd()] });
} catch (e) {
// Node <8.9
appInstance = require.resolve(process.cwd() + "/node_modules/applicationinsights");
Expand Down
2 changes: 1 addition & 1 deletion 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 @@ -61,10 +61,10 @@
},
"dependencies": {
"@azure/core-auth": "^1.5.0",
"@azure/core-util": "1.2.0",
"@azure/core-rest-pipeline": "1.10.1",
"@azure/core-util": "1.2.0",
"@azure/opentelemetry-instrumentation-azure-sdk": "^1.0.0-beta.5",
"@microsoft/applicationinsights-web-snippet": "^1.0.1",
"@microsoft/applicationinsights-web-snippet": "1.0.1",
"@opentelemetry/api": "^1.7.0",
"@opentelemetry/core": "^1.19.0",
"@opentelemetry/sdk-trace-base": "^1.19.0",
Expand Down