@ms-cloudpack/telemetry 0.10.2 → 0.10.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -21,7 +21,7 @@ import {
21
21
  require_src2,
22
22
  require_src3,
23
23
  require_src4
24
- } from "./chunk-CAVDED25.js";
24
+ } from "./chunk-QWSFQHKI.js";
25
25
 
26
26
  // ../../node_modules/.store/@azure-core-rest-pipeline-npm-1.17.0-aa1ea9ace7/package/dist/commonjs/pipeline.js
27
27
  var require_pipeline = __commonJS({
@@ -6,8 +6,8 @@ const __filename = topLevelUrl.fileURLToPath(import.meta.url);
6
6
  const __dirname = topLevelPath.dirname(__filename);
7
7
  import {
8
8
  NoOpTelemetryClient
9
- } from "./chunk-ZRGXKAUG.js";
10
- import "./chunk-CAVDED25.js";
9
+ } from "./chunk-RJI3247B.js";
10
+ import "./chunk-QWSFQHKI.js";
11
11
  export {
12
12
  NoOpTelemetryClient
13
13
  };
@@ -12063,6 +12063,58 @@ var import_resources = __toESM(require_src4(), 1);
12063
12063
  init_esm2();
12064
12064
  import { createHash } from "crypto";
12065
12065
 
12066
+ // ../environment/src/getEnvBoolean.js
12067
+ function getEnvBoolean(name) {
12068
+ var _a;
12069
+ const value = (_a = process.env[name]) == null ? void 0 : _a.toLowerCase();
12070
+ return value ? value !== "0" && value !== "false" : void 0;
12071
+ }
12072
+ __name(getEnvBoolean, "getEnvBoolean");
12073
+
12074
+ // ../environment/src/environmentInfo.js
12075
+ var isADO = !!getEnvBoolean("TF_BUILD");
12076
+ var isWindows = process.platform === "win32";
12077
+ var environmentInfo = Object.freeze({
12078
+ /** True if running in PR/CI (github or ADO) */
12079
+ isCI: !!getEnvBoolean("CI") || isADO,
12080
+ /** True if running in a codespace */
12081
+ isCodespaces: !!getEnvBoolean("CODESPACES"),
12082
+ /** True if running within jest */
12083
+ isJest: !!process.env.JEST_WORKER_ID,
12084
+ /** True if running via lage */
12085
+ isLage: !!process.env.LAGE_PACKAGE_NAME,
12086
+ /**
12087
+ * True if debugging in VS Code.
12088
+ *
12089
+ * NOTE: This only works if running with a launch configuration that sets `VS_CODE_DEBUG`
12090
+ * (it's not automatically set by VS Code).
12091
+ */
12092
+ isVsCodeDebug: !!process.env.VS_CODE_DEBUG,
12093
+ /** True if running on Windows (shorthand for `process.platform === 'win32'`) */
12094
+ isWindows,
12095
+ /** Info only applicable if running in Azure DevOps */
12096
+ ado: isADO ? Object.freeze({
12097
+ buildId: process.env.BUILD_BUILDID,
12098
+ definitionId: process.env.SYSTEM_DEFINITIONID,
12099
+ buildReason: process.env.BUILD_REASON,
12100
+ pullRequestId: process.env.SYSTEM_PULLREQUEST_PULLREQUESTID
12101
+ }) : void 0,
12102
+ /** Info only applicable if running on Windows. Only set if running on Windows. */
12103
+ windows: isWindows ? Object.freeze({
12104
+ appData: process.env.APPDATA,
12105
+ computerName: process.env.COMPUTERNAME,
12106
+ programFiles: process.env.ProgramFiles
12107
+ }) : void 0,
12108
+ cloudpack: Object.freeze({
12109
+ /** Whether cloudpack sync is enabled (default true) */
12110
+ isSyncEnabled: getEnvBoolean("CLOUDPACK_SYNC") ?? true,
12111
+ /** Custom telemetry connection string */
12112
+ telemetryConnectionString: process.env.CLOUDPACK_TELEMETRY_CONNECTION_STRING,
12113
+ /** External correlation ID used to correlate telemetry across different services */
12114
+ telemetryExternalCorrelationId: process.env.CLOUDPACK_TELEMETRY_EXTERNAL_CORRELATION_ID
12115
+ })
12116
+ });
12117
+
12066
12118
  // src/getComputerName.ts
12067
12119
  import { execSync } from "child_process";
12068
12120
  import { hostname } from "os";
@@ -12070,7 +12122,10 @@ function getComputerName() {
12070
12122
  var _a;
12071
12123
  try {
12072
12124
  const computerNameGetters = {
12073
- win32: /* @__PURE__ */ __name(() => process.env.COMPUTERNAME, "win32"),
12125
+ win32: /* @__PURE__ */ __name(() => {
12126
+ var _a2;
12127
+ return (_a2 = environmentInfo.windows) == null ? void 0 : _a2.computerName;
12128
+ }, "win32"),
12074
12129
  darwin: /* @__PURE__ */ __name(() => execSync("scutil --get ComputerName").toString(), "darwin")
12075
12130
  };
12076
12131
  const computerName = ((_a = computerNameGetters[process.platform]) == null ? void 0 : _a.call(computerNameGetters)) || hostname();
@@ -12240,7 +12295,7 @@ function findPackageRoot(startFolder, excludeNodeModules) {
12240
12295
  }
12241
12296
  __name(findPackageRoot, "findPackageRoot");
12242
12297
 
12243
- // ../package-utilities/lib/isExternalPackage.js
12298
+ // ../path-utilities/lib/isExternalPackage.js
12244
12299
  function isExternalPackage(packagePath) {
12245
12300
  if (packagePath) {
12246
12301
  return /[\\/]node_modules[\\/]/.test(packagePath);
@@ -12249,9 +12304,13 @@ function isExternalPackage(packagePath) {
12249
12304
  }
12250
12305
  __name(isExternalPackage, "isExternalPackage");
12251
12306
 
12252
- // ../package-utilities/lib/getVersionInternal.js
12307
+ // ../package-utilities/lib/packageJson/getVersion.js
12253
12308
  import path2 from "path";
12254
12309
  import { fileURLToPath } from "url";
12310
+ function getVersion(importUrl) {
12311
+ return getVersionInternal(importUrl).version;
12312
+ }
12313
+ __name(getVersion, "getVersion");
12255
12314
  function getVersionInternal(importUrl) {
12256
12315
  const packagePath = findPackageRoot(path2.dirname(fileURLToPath(importUrl)));
12257
12316
  const result = { version: `0.0.0-local`, packagePath, isExternal: false };
@@ -12264,12 +12323,6 @@ function getVersionInternal(importUrl) {
12264
12323
  }
12265
12324
  __name(getVersionInternal, "getVersionInternal");
12266
12325
 
12267
- // ../package-utilities/lib/getVersion.js
12268
- function getVersion(importUrl) {
12269
- return getVersionInternal(importUrl).version;
12270
- }
12271
- __name(getVersion, "getVersion");
12272
-
12273
12326
  // src/ConsoleSpanExporter.ts
12274
12327
  var import_core = __toESM(require_src2(), 1);
12275
12328
  var _ConsoleSpanExporter = class _ConsoleSpanExporter {
@@ -7,7 +7,7 @@ const __dirname = topLevelPath.dirname(__filename);
7
7
  import {
8
8
  BaseTelemetryClient,
9
9
  __name
10
- } from "./chunk-CAVDED25.js";
10
+ } from "./chunk-QWSFQHKI.js";
11
11
 
12
12
  // src/NoOpTelemetryClient.ts
13
13
  var _NoOpTelemetryClient = class _NoOpTelemetryClient extends BaseTelemetryClient {
package/dist/index.js CHANGED
@@ -6,28 +6,28 @@ const __filename = topLevelUrl.fileURLToPath(import.meta.url);
6
6
  const __dirname = topLevelPath.dirname(__filename);
7
7
  import {
8
8
  NoOpTelemetryClient
9
- } from "./chunk-ZRGXKAUG.js";
9
+ } from "./chunk-RJI3247B.js";
10
10
  import {
11
11
  DiagConsoleLogger,
12
12
  DiagLogLevel,
13
13
  __name,
14
14
  diag,
15
15
  init_esm
16
- } from "./chunk-CAVDED25.js";
16
+ } from "./chunk-QWSFQHKI.js";
17
17
 
18
18
  // src/createTelemetryClient.ts
19
19
  init_esm();
20
20
  async function createTelemetryClient(options) {
21
21
  if (!options.connectionString) {
22
22
  console.debug("No connection string found. Telemetry will not be sent.");
23
- const { NoOpTelemetryClient: NoOpTelemetryClient2 } = await import("./NoOpTelemetryClient-MGEGOMRG.js");
23
+ const { NoOpTelemetryClient: NoOpTelemetryClient2 } = await import("./NoOpTelemetryClient-4TJ4SDRS.js");
24
24
  return new NoOpTelemetryClient2();
25
25
  }
26
26
  diag.setLogger(new DiagConsoleLogger(), {
27
27
  logLevel: (options.logLevel && DiagLogLevel[options.logLevel]) ?? DiagLogLevel.WARN,
28
28
  suppressOverrideMessage: true
29
29
  });
30
- const { AppInsightsTelemetryClient } = await import("./AppInsightsTelemetryClient-ZL4CRVTO.js");
30
+ const { AppInsightsTelemetryClient } = await import("./AppInsightsTelemetryClient-P56TUIAO.js");
31
31
  return new AppInsightsTelemetryClient(options);
32
32
  }
33
33
  __name(createTelemetryClient, "createTelemetryClient");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ms-cloudpack/telemetry",
3
- "version": "0.10.2",
3
+ "version": "0.10.3",
4
4
  "description": "Helpers for reporting telemetry in Cloudpack.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -15,8 +15,9 @@
15
15
  },
16
16
  "devDependencies": {
17
17
  "@azure/monitor-opentelemetry-exporter": "1.0.0-beta.26",
18
+ "@ms-cloudpack/environment": "^0.1.1",
18
19
  "@ms-cloudpack/eslint-plugin-internal": "^0.0.1",
19
- "@ms-cloudpack/package-utilities": "^10.4.2",
20
+ "@ms-cloudpack/package-utilities": "^11.0.0",
20
21
  "@ms-cloudpack/scripts": "^0.0.1",
21
22
  "@opentelemetry/api": "~1.9.0",
22
23
  "@opentelemetry/core": "~1.26.0",