plutin 1.8.6 → 1.8.7
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 +16 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.mjs +16 -19
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1671,10 +1671,7 @@ var MetricsManager = class {
|
|
|
1671
1671
|
static {
|
|
1672
1672
|
__name(this, "MetricsManager");
|
|
1673
1673
|
}
|
|
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
|
-
}
|
|
1674
|
+
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
1675
|
httpRequestsTotal = this.meter?.createCounter("http_requests_total", {
|
|
1679
1676
|
description: "Total de requisi\xE7\xF5es HTTP",
|
|
1680
1677
|
unit: "1"
|
|
@@ -1786,7 +1783,7 @@ var MetricsManager = class {
|
|
|
1786
1783
|
collectionInterval;
|
|
1787
1784
|
gcObserver;
|
|
1788
1785
|
recordHttpRequest(params) {
|
|
1789
|
-
if (
|
|
1786
|
+
if (!this.meter) {
|
|
1790
1787
|
return;
|
|
1791
1788
|
}
|
|
1792
1789
|
const { method, route, statusCode, durationSeconds, responseSizeBytes } = params;
|
|
@@ -1810,7 +1807,7 @@ var MetricsManager = class {
|
|
|
1810
1807
|
}
|
|
1811
1808
|
}
|
|
1812
1809
|
recordDbQueryError(params) {
|
|
1813
|
-
if (
|
|
1810
|
+
if (!this.meter) {
|
|
1814
1811
|
return;
|
|
1815
1812
|
}
|
|
1816
1813
|
if (!this.isValidDbQueryErrorParams(params)) {
|
|
@@ -1825,7 +1822,7 @@ var MetricsManager = class {
|
|
|
1825
1822
|
});
|
|
1826
1823
|
}
|
|
1827
1824
|
recordDbQuery(params) {
|
|
1828
|
-
if (
|
|
1825
|
+
if (!this.meter) {
|
|
1829
1826
|
return;
|
|
1830
1827
|
}
|
|
1831
1828
|
if (!this.isValidDbQueryParams(params)) {
|
|
@@ -1859,7 +1856,7 @@ var MetricsManager = class {
|
|
|
1859
1856
|
return true;
|
|
1860
1857
|
}
|
|
1861
1858
|
recordDbTransaction(params) {
|
|
1862
|
-
if (
|
|
1859
|
+
if (!this.meter) {
|
|
1863
1860
|
return;
|
|
1864
1861
|
}
|
|
1865
1862
|
const { operation, repository, durationSeconds } = params;
|
|
@@ -1875,7 +1872,7 @@ var MetricsManager = class {
|
|
|
1875
1872
|
});
|
|
1876
1873
|
}
|
|
1877
1874
|
recordDbDeadlock(params) {
|
|
1878
|
-
if (
|
|
1875
|
+
if (!this.meter) {
|
|
1879
1876
|
return;
|
|
1880
1877
|
}
|
|
1881
1878
|
const { operation, repository, errorMessage } = params;
|
|
@@ -1887,7 +1884,7 @@ var MetricsManager = class {
|
|
|
1887
1884
|
});
|
|
1888
1885
|
}
|
|
1889
1886
|
recordHttpRequestBytes(bytes, attributes) {
|
|
1890
|
-
if (
|
|
1887
|
+
if (!this.meter) {
|
|
1891
1888
|
return;
|
|
1892
1889
|
}
|
|
1893
1890
|
this.httpRequestBytesTotal?.add(bytes, {
|
|
@@ -1897,7 +1894,7 @@ var MetricsManager = class {
|
|
|
1897
1894
|
});
|
|
1898
1895
|
}
|
|
1899
1896
|
recordProcessingDuration(params) {
|
|
1900
|
-
if (
|
|
1897
|
+
if (!this.meter) {
|
|
1901
1898
|
return;
|
|
1902
1899
|
}
|
|
1903
1900
|
const { operation, durationSeconds } = params;
|
|
@@ -1907,7 +1904,7 @@ var MetricsManager = class {
|
|
|
1907
1904
|
});
|
|
1908
1905
|
}
|
|
1909
1906
|
recordProcessingError(params) {
|
|
1910
|
-
if (
|
|
1907
|
+
if (!this.meter) {
|
|
1911
1908
|
return;
|
|
1912
1909
|
}
|
|
1913
1910
|
const { operation, errorType } = params;
|
|
@@ -1918,7 +1915,7 @@ var MetricsManager = class {
|
|
|
1918
1915
|
});
|
|
1919
1916
|
}
|
|
1920
1917
|
recordHttpClientRequest(params) {
|
|
1921
|
-
if (
|
|
1918
|
+
if (!this.meter) {
|
|
1922
1919
|
return;
|
|
1923
1920
|
}
|
|
1924
1921
|
const { method, url, statusCode, durationSeconds, error, timeout } = params;
|
|
@@ -1942,7 +1939,7 @@ var MetricsManager = class {
|
|
|
1942
1939
|
}
|
|
1943
1940
|
}
|
|
1944
1941
|
recordValidationError(params) {
|
|
1945
|
-
if (
|
|
1942
|
+
if (!this.meter) {
|
|
1946
1943
|
return;
|
|
1947
1944
|
}
|
|
1948
1945
|
const { field, errorType } = params;
|
|
@@ -1953,7 +1950,7 @@ var MetricsManager = class {
|
|
|
1953
1950
|
});
|
|
1954
1951
|
}
|
|
1955
1952
|
startSystemMetricsCollection(intervalMs = 5e3) {
|
|
1956
|
-
if (
|
|
1953
|
+
if (!this.meter) {
|
|
1957
1954
|
return;
|
|
1958
1955
|
}
|
|
1959
1956
|
this.eventLoopMonitor.enable();
|
|
@@ -1975,7 +1972,7 @@ var MetricsManager = class {
|
|
|
1975
1972
|
this.collectPeriodicMetrics();
|
|
1976
1973
|
}
|
|
1977
1974
|
stopSystemMetricsCollection() {
|
|
1978
|
-
if (
|
|
1975
|
+
if (!this.meter) {
|
|
1979
1976
|
return;
|
|
1980
1977
|
}
|
|
1981
1978
|
if (this.collectionInterval) {
|
|
@@ -1989,7 +1986,7 @@ var MetricsManager = class {
|
|
|
1989
1986
|
}
|
|
1990
1987
|
}
|
|
1991
1988
|
collectSystemMetrics(observableResult) {
|
|
1992
|
-
if (
|
|
1989
|
+
if (!this.meter) {
|
|
1993
1990
|
return;
|
|
1994
1991
|
}
|
|
1995
1992
|
const attributes = {
|
|
@@ -2030,7 +2027,7 @@ var MetricsManager = class {
|
|
|
2030
2027
|
observableResult.observe(this.processUptimeSeconds, process.uptime(), attributes);
|
|
2031
2028
|
}
|
|
2032
2029
|
collectPeriodicMetrics() {
|
|
2033
|
-
if (
|
|
2030
|
+
if (!this.meter) {
|
|
2034
2031
|
return;
|
|
2035
2032
|
}
|
|
2036
2033
|
const attributes = {
|
|
@@ -2054,7 +2051,7 @@ var MetricsManager = class {
|
|
|
2054
2051
|
}
|
|
2055
2052
|
}
|
|
2056
2053
|
setupGCObserver() {
|
|
2057
|
-
if (
|
|
2054
|
+
if (!this.meter) {
|
|
2058
2055
|
return;
|
|
2059
2056
|
}
|
|
2060
2057
|
try {
|