plutin 1.8.6 → 1.8.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.cjs +22 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +22 -20
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -495,6 +495,10 @@ var DependencyContainer = class {
|
|
|
495
495
|
}
|
|
496
496
|
static registry = /* @__PURE__ */ new Map();
|
|
497
497
|
static singletons = /* @__PURE__ */ new Map();
|
|
498
|
+
static reset() {
|
|
499
|
+
this.registry.clear();
|
|
500
|
+
this.singletons.clear();
|
|
501
|
+
}
|
|
498
502
|
static register(token, myClass, options) {
|
|
499
503
|
this.registry.set(token, {
|
|
500
504
|
type: "class",
|
|
@@ -510,7 +514,8 @@ var DependencyContainer = class {
|
|
|
510
514
|
}
|
|
511
515
|
static resolve(target) {
|
|
512
516
|
const injectMetadata = Reflect.getOwnMetadata("inject:params", target) || {};
|
|
513
|
-
const
|
|
517
|
+
const designParamTypes = Reflect.getMetadata("design:paramtypes", target) || [];
|
|
518
|
+
const paramCount = Math.max(designParamTypes.length, Object.keys(injectMetadata).length);
|
|
514
519
|
const params = Array.from({
|
|
515
520
|
length: paramCount
|
|
516
521
|
}, (_, index) => {
|
|
@@ -1671,10 +1676,7 @@ var MetricsManager = class {
|
|
|
1671
1676
|
static {
|
|
1672
1677
|
__name(this, "MetricsManager");
|
|
1673
1678
|
}
|
|
1674
|
-
meter = null;
|
|
1675
|
-
constructor() {
|
|
1676
|
-
this.meter = process.env.OTEL_ENABLE === "true" ? import_api2.metrics.getMeter(process.env.OTEL_SERVICE_NAME || "plutin-boilerplate-common", process.env.OTEL_SERVICE_VERSION || "1.0.0") : null;
|
|
1677
|
-
}
|
|
1679
|
+
meter = process.env.OTEL_ENABLE === "true" ? import_api2.metrics.getMeter(process.env.OTEL_SERVICE_NAME || "plutin-boilerplate-common", process.env.OTEL_SERVICE_VERSION || "1.0.0") : null;
|
|
1678
1680
|
httpRequestsTotal = this.meter?.createCounter("http_requests_total", {
|
|
1679
1681
|
description: "Total de requisi\xE7\xF5es HTTP",
|
|
1680
1682
|
unit: "1"
|
|
@@ -1786,7 +1788,7 @@ var MetricsManager = class {
|
|
|
1786
1788
|
collectionInterval;
|
|
1787
1789
|
gcObserver;
|
|
1788
1790
|
recordHttpRequest(params) {
|
|
1789
|
-
if (
|
|
1791
|
+
if (!this.meter) {
|
|
1790
1792
|
return;
|
|
1791
1793
|
}
|
|
1792
1794
|
const { method, route, statusCode, durationSeconds, responseSizeBytes } = params;
|
|
@@ -1810,7 +1812,7 @@ var MetricsManager = class {
|
|
|
1810
1812
|
}
|
|
1811
1813
|
}
|
|
1812
1814
|
recordDbQueryError(params) {
|
|
1813
|
-
if (
|
|
1815
|
+
if (!this.meter) {
|
|
1814
1816
|
return;
|
|
1815
1817
|
}
|
|
1816
1818
|
if (!this.isValidDbQueryErrorParams(params)) {
|
|
@@ -1825,7 +1827,7 @@ var MetricsManager = class {
|
|
|
1825
1827
|
});
|
|
1826
1828
|
}
|
|
1827
1829
|
recordDbQuery(params) {
|
|
1828
|
-
if (
|
|
1830
|
+
if (!this.meter) {
|
|
1829
1831
|
return;
|
|
1830
1832
|
}
|
|
1831
1833
|
if (!this.isValidDbQueryParams(params)) {
|
|
@@ -1859,7 +1861,7 @@ var MetricsManager = class {
|
|
|
1859
1861
|
return true;
|
|
1860
1862
|
}
|
|
1861
1863
|
recordDbTransaction(params) {
|
|
1862
|
-
if (
|
|
1864
|
+
if (!this.meter) {
|
|
1863
1865
|
return;
|
|
1864
1866
|
}
|
|
1865
1867
|
const { operation, repository, durationSeconds } = params;
|
|
@@ -1875,7 +1877,7 @@ var MetricsManager = class {
|
|
|
1875
1877
|
});
|
|
1876
1878
|
}
|
|
1877
1879
|
recordDbDeadlock(params) {
|
|
1878
|
-
if (
|
|
1880
|
+
if (!this.meter) {
|
|
1879
1881
|
return;
|
|
1880
1882
|
}
|
|
1881
1883
|
const { operation, repository, errorMessage } = params;
|
|
@@ -1887,7 +1889,7 @@ var MetricsManager = class {
|
|
|
1887
1889
|
});
|
|
1888
1890
|
}
|
|
1889
1891
|
recordHttpRequestBytes(bytes, attributes) {
|
|
1890
|
-
if (
|
|
1892
|
+
if (!this.meter) {
|
|
1891
1893
|
return;
|
|
1892
1894
|
}
|
|
1893
1895
|
this.httpRequestBytesTotal?.add(bytes, {
|
|
@@ -1897,7 +1899,7 @@ var MetricsManager = class {
|
|
|
1897
1899
|
});
|
|
1898
1900
|
}
|
|
1899
1901
|
recordProcessingDuration(params) {
|
|
1900
|
-
if (
|
|
1902
|
+
if (!this.meter) {
|
|
1901
1903
|
return;
|
|
1902
1904
|
}
|
|
1903
1905
|
const { operation, durationSeconds } = params;
|
|
@@ -1907,7 +1909,7 @@ var MetricsManager = class {
|
|
|
1907
1909
|
});
|
|
1908
1910
|
}
|
|
1909
1911
|
recordProcessingError(params) {
|
|
1910
|
-
if (
|
|
1912
|
+
if (!this.meter) {
|
|
1911
1913
|
return;
|
|
1912
1914
|
}
|
|
1913
1915
|
const { operation, errorType } = params;
|
|
@@ -1918,7 +1920,7 @@ var MetricsManager = class {
|
|
|
1918
1920
|
});
|
|
1919
1921
|
}
|
|
1920
1922
|
recordHttpClientRequest(params) {
|
|
1921
|
-
if (
|
|
1923
|
+
if (!this.meter) {
|
|
1922
1924
|
return;
|
|
1923
1925
|
}
|
|
1924
1926
|
const { method, url, statusCode, durationSeconds, error, timeout } = params;
|
|
@@ -1942,7 +1944,7 @@ var MetricsManager = class {
|
|
|
1942
1944
|
}
|
|
1943
1945
|
}
|
|
1944
1946
|
recordValidationError(params) {
|
|
1945
|
-
if (
|
|
1947
|
+
if (!this.meter) {
|
|
1946
1948
|
return;
|
|
1947
1949
|
}
|
|
1948
1950
|
const { field, errorType } = params;
|
|
@@ -1953,7 +1955,7 @@ var MetricsManager = class {
|
|
|
1953
1955
|
});
|
|
1954
1956
|
}
|
|
1955
1957
|
startSystemMetricsCollection(intervalMs = 5e3) {
|
|
1956
|
-
if (
|
|
1958
|
+
if (!this.meter) {
|
|
1957
1959
|
return;
|
|
1958
1960
|
}
|
|
1959
1961
|
this.eventLoopMonitor.enable();
|
|
@@ -1975,7 +1977,7 @@ var MetricsManager = class {
|
|
|
1975
1977
|
this.collectPeriodicMetrics();
|
|
1976
1978
|
}
|
|
1977
1979
|
stopSystemMetricsCollection() {
|
|
1978
|
-
if (
|
|
1980
|
+
if (!this.meter) {
|
|
1979
1981
|
return;
|
|
1980
1982
|
}
|
|
1981
1983
|
if (this.collectionInterval) {
|
|
@@ -1989,7 +1991,7 @@ var MetricsManager = class {
|
|
|
1989
1991
|
}
|
|
1990
1992
|
}
|
|
1991
1993
|
collectSystemMetrics(observableResult) {
|
|
1992
|
-
if (
|
|
1994
|
+
if (!this.meter) {
|
|
1993
1995
|
return;
|
|
1994
1996
|
}
|
|
1995
1997
|
const attributes = {
|
|
@@ -2030,7 +2032,7 @@ var MetricsManager = class {
|
|
|
2030
2032
|
observableResult.observe(this.processUptimeSeconds, process.uptime(), attributes);
|
|
2031
2033
|
}
|
|
2032
2034
|
collectPeriodicMetrics() {
|
|
2033
|
-
if (
|
|
2035
|
+
if (!this.meter) {
|
|
2034
2036
|
return;
|
|
2035
2037
|
}
|
|
2036
2038
|
const attributes = {
|
|
@@ -2054,7 +2056,7 @@ var MetricsManager = class {
|
|
|
2054
2056
|
}
|
|
2055
2057
|
}
|
|
2056
2058
|
setupGCObserver() {
|
|
2057
|
-
if (
|
|
2059
|
+
if (!this.meter) {
|
|
2058
2060
|
return;
|
|
2059
2061
|
}
|
|
2060
2062
|
try {
|