@forklaunch/core 0.7.1 → 0.7.2

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.
@@ -241,6 +241,7 @@ import {
241
241
  ATTR_SERVICE_NAME as ATTR_SERVICE_NAME2
242
242
  } from "@opentelemetry/semantic-conventions";
243
243
  import dotenv from "dotenv";
244
+ import { v4 as v42 } from "uuid";
244
245
 
245
246
  // src/http/guards/isForklaunchRequest.ts
246
247
  function isForklaunchRequest(request) {
@@ -390,8 +391,12 @@ var OpenTelemetryCollector = class {
390
391
  break;
391
392
  }
392
393
  }
393
- this.log("info", "OpenTelemetry (Traces + Logs + Metrics) started");
394
+ this.log(
395
+ "info",
396
+ "OpenTelemetry Collector (Traces + Logs + Metrics) started"
397
+ );
394
398
  }
399
+ uuid = v42();
395
400
  logger;
396
401
  metrics;
397
402
  log(level, ...args) {
@@ -2289,6 +2294,9 @@ import {
2289
2294
 
2290
2295
  // src/http/telemetry/recordMetric.ts
2291
2296
  function recordMetric(req, res) {
2297
+ if (res.metricRecorded) {
2298
+ return;
2299
+ }
2292
2300
  httpRequestsTotalCounter.add(1, {
2293
2301
  [ATTR_SERVICE_NAME3]: getEnvVar("OTEL_SERVICE_NAME"),
2294
2302
  [ATTR_API_NAME]: req.contractDetails?.name,
@@ -2297,6 +2305,7 @@ function recordMetric(req, res) {
2297
2305
  [ATTR_HTTP_ROUTE3]: req.originalPath,
2298
2306
  [ATTR_HTTP_RESPONSE_STATUS_CODE3]: res.statusCode || 0
2299
2307
  });
2308
+ res.metricRecorded = true;
2300
2309
  }
2301
2310
 
2302
2311
  // src/http/middleware/response/enrichExpressLikeSend.middleware.ts