@mhubcloud/tms_core 3.8.0-beta.7 → 3.8.0-beta.8
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.
- package/dist/index.js +7 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -150,7 +150,8 @@ function logAggregatedMetric({
|
|
|
150
150
|
dimensions
|
|
151
151
|
}) {
|
|
152
152
|
const windowStart = Math.floor(Date.now() / 6e4) * 6e4;
|
|
153
|
-
|
|
153
|
+
let key = "tms:";
|
|
154
|
+
key += dimensions ? `${prefix}:${windowStart}:${dimensions}:${name}` : `${prefix}:${windowStart}:${name}`;
|
|
154
155
|
void logRedisEvent(key).catch((error) => {
|
|
155
156
|
if (error instanceof Error) {
|
|
156
157
|
logException(new Error(`Metric log error: ${error.message}`));
|
|
@@ -174,15 +175,15 @@ function logMessage(level, message, properties) {
|
|
|
174
175
|
});
|
|
175
176
|
}
|
|
176
177
|
function logEvent(publisher2, event, region, status, payload, id) {
|
|
177
|
-
if (
|
|
178
|
-
const metricRegion = process.env.DisableMetricRegionLogging ? "default" : region;
|
|
178
|
+
if (process.env.DisableMetrics !== "true" && status >= 200 && status < 400) {
|
|
179
|
+
const metricRegion = process.env.DisableMetricRegionLogging === "true" ? "default" : region;
|
|
179
180
|
logAggregatedMetric({
|
|
180
181
|
prefix: "events",
|
|
181
182
|
dimensions: `${metricRegion}:${publisher2}:${event}`,
|
|
182
183
|
name: "Dispatch"
|
|
183
184
|
});
|
|
184
185
|
}
|
|
185
|
-
if (
|
|
186
|
+
if (process.env.DisableTraces !== "true") {
|
|
186
187
|
let properties = {
|
|
187
188
|
publisher: publisher2,
|
|
188
189
|
event,
|
|
@@ -197,14 +198,14 @@ function logEvent(publisher2, event, region, status, payload, id) {
|
|
|
197
198
|
}
|
|
198
199
|
}
|
|
199
200
|
function logException(exception, publisher2, errorType = "InternalError") {
|
|
200
|
-
if (
|
|
201
|
+
if (process.env.DisableMetrics !== "true") {
|
|
201
202
|
logAggregatedMetric({
|
|
202
203
|
prefix: "errors",
|
|
203
204
|
dimensions: publisher2 ?? "Other",
|
|
204
205
|
name: errorType
|
|
205
206
|
});
|
|
206
207
|
}
|
|
207
|
-
if (
|
|
208
|
+
if (process.env.DisableTraces !== "true") {
|
|
208
209
|
aiClient?.trackException({
|
|
209
210
|
exception,
|
|
210
211
|
properties: { publisher: publisher2, errorType }
|