@mhubcloud/tms_core 3.8.0-beta.3 → 3.8.0-beta.5

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.
Files changed (2) hide show
  1. package/dist/index.js +13 -16
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -31,10 +31,9 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
31
31
  var index_exports = {};
32
32
  __export(index_exports, {
33
33
  DefaultPublisher: () => defaultPublisher,
34
- appInsightsClient: () => appInsightsClient_exports,
35
34
  broker: () => broker_exports,
35
+ getRedisClient: () => getRedisClient,
36
36
  publisher: () => publisher,
37
- redisClient: () => redisClient_exports,
38
37
  testUtils: () => testUtils_exports,
39
38
  utils: () => utils_exports
40
39
  });
@@ -67,17 +66,15 @@ __export(utils_exports, {
67
66
  logEvent: () => logEvent,
68
67
  logException: () => logException,
69
68
  logMessage: () => logMessage,
69
+ logMetric: () => logMetric,
70
70
  logMilestone: () => logMilestone,
71
71
  prepareTestRequestHeaders: () => prepareTestRequestHeaders,
72
72
  removeUndefined: () => removeUndefined
73
73
  });
74
74
  var crypto = __toESM(require("crypto"));
75
+ var appInsights = __toESM(require("applicationinsights"));
75
76
 
76
77
  // src/utils/redisClient.ts
77
- var redisClient_exports = {};
78
- __export(redisClient_exports, {
79
- getRedisClient: () => getRedisClient
80
- });
81
78
  var import_redis = require("redis");
82
79
  var client;
83
80
  async function getRedisClient() {
@@ -92,19 +89,12 @@ async function getRedisClient() {
92
89
  return client;
93
90
  }
94
91
 
95
- // src/utils/appInsightsClient.ts
96
- var appInsightsClient_exports = {};
97
- __export(appInsightsClient_exports, {
98
- aiClient: () => aiClient
99
- });
100
- var appInsights = __toESM(require("applicationinsights"));
92
+ // src/utils/utils.ts
101
93
  var aiClient = null;
102
94
  if (process.env.APPLICATIONINSIGHTS_CONNECTION_STRING) {
103
95
  appInsights.setup().setAutoCollectDependencies(false).setAutoCollectConsole(true, false).setSendLiveMetrics(false).setAutoCollectRequests(false).setAutoCollectPerformance(false, false).setUseDiskRetryCaching(false).start();
104
96
  aiClient = appInsights.defaultClient;
105
97
  }
106
-
107
- // src/utils/utils.ts
108
98
  var EventPublisherBase = class {
109
99
  config;
110
100
  constructor(config) {
@@ -137,6 +127,14 @@ function logAggregatedMetric({ prefix, name, dimensions }) {
137
127
  const key = dimensions ? `${prefix}:${windowStart}:${dimensions}:${name}` : `${prefix}:${windowStart}:${name}`;
138
128
  logRedisEvent(key);
139
129
  }
130
+ function logMetric(name, value, properties) {
131
+ aiClient?.trackMetric({
132
+ name,
133
+ value,
134
+ count: value,
135
+ properties
136
+ });
137
+ }
140
138
  function logMessage(level, message, properties) {
141
139
  console.log(message);
142
140
  aiClient?.trackTrace({
@@ -1228,10 +1226,9 @@ var publisher = {
1228
1226
  // Annotate the CommonJS export names for ESM import in node:
1229
1227
  0 && (module.exports = {
1230
1228
  DefaultPublisher,
1231
- appInsightsClient,
1232
1229
  broker,
1230
+ getRedisClient,
1233
1231
  publisher,
1234
- redisClient,
1235
1232
  testUtils,
1236
1233
  utils
1237
1234
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mhubcloud/tms_core",
3
- "version": "3.8.0-beta.3",
3
+ "version": "3.8.0-beta.5",
4
4
  "description": "Core function for mHub Cloud TMS publishers",
5
5
  "homepage": "https://mhubcloud.com/",
6
6
  "license": "Apache 2.0",