@vtex/api 6.45.21-beta.2 → 6.45.22
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/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,21 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [6.45.22] - 2023-09-20
|
|
11
|
+
|
|
12
|
+
### Removed
|
|
13
|
+
|
|
14
|
+
- Remove reference of how to search for the app's errors on now-defunct Splunk.
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
|
|
18
|
+
- Error tracing spans not logging the details.
|
|
19
|
+
|
|
20
|
+
## [6.45.21] - 2023-09-19
|
|
21
|
+
### Changed
|
|
22
|
+
- Fix tracingMiddleware shouldTrace decision
|
|
23
|
+
- Fix HttpClient tracing based on sampling decision
|
|
24
|
+
|
|
10
25
|
## [6.45.21-beta.2] - 2023-09-19
|
|
11
26
|
|
|
12
27
|
## [6.45.21-beta.1] - 2023-09-07
|
|
@@ -1784,11 +1799,13 @@ instead
|
|
|
1784
1799
|
- `HttpClient` now adds `'Accept-Encoding': 'gzip'` header by default.
|
|
1785
1800
|
|
|
1786
1801
|
|
|
1787
|
-
[Unreleased]: https://github.com/vtex/node-vtex-api/compare/v6.45.
|
|
1802
|
+
[Unreleased]: https://github.com/vtex/node-vtex-api/compare/v6.45.22...HEAD
|
|
1788
1803
|
[6.45.15]: https://github.com/vtex/node-vtex-api/compare/v6.45.14...v6.45.15
|
|
1789
1804
|
[6.45.14]: https://github.com/vtex/node-vtex-api/compare/v6.45.13...v6.45.14
|
|
1790
1805
|
[6.45.13]: https://github.com/vtex/node-vtex-api/compare/v6.45.12...v6.45.13
|
|
1791
1806
|
|
|
1807
|
+
[6.45.22]: https://github.com/vtex/node-vtex-api/compare/v6.45.21...v6.45.22
|
|
1808
|
+
[6.45.21]: https://github.com/vtex/node-vtex-api/compare/v6.45.21-beta.2...v6.45.21
|
|
1792
1809
|
[6.45.21-beta.2]: https://github.com/vtex/node-vtex-api/compare/v6.45.21-beta.1...v6.45.21-beta.2
|
|
1793
1810
|
[6.45.21-beta.1]: https://github.com/vtex/node-vtex-api/compare/v6.45.21-beta.0...v6.45.21-beta.1
|
|
1794
1811
|
[6.45.21-beta.0]: https://github.com/vtex/node-vtex-api/compare/v6.45.21-beta...v6.45.21-beta.0
|
|
@@ -25,11 +25,5 @@ export declare class Logger {
|
|
|
25
25
|
warn: (warning: any) => void;
|
|
26
26
|
error: (error: any) => void;
|
|
27
27
|
log: (message: any, level: LogLevel) => void;
|
|
28
|
-
/**
|
|
29
|
-
* Logs splunk query so the developer can search for the errors in splunk.
|
|
30
|
-
* This function runs only once in the lifetime of the Logger class so we
|
|
31
|
-
* don't mess up with the developer's terminal
|
|
32
|
-
*/
|
|
33
|
-
private logSplunkQuery;
|
|
34
28
|
}
|
|
35
29
|
export {};
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const constants_1 = require("../../constants");
|
|
4
4
|
const error_1 = require("../../utils/error");
|
|
5
5
|
const log_1 = require("../../utils/log");
|
|
6
|
-
const console_1 = require("./console");
|
|
7
6
|
const linked = !!process.env.VTEX_APP_LINK;
|
|
8
7
|
const app = constants_1.APP.ID;
|
|
9
8
|
const EMPTY_MESSAGE = 'Logger.log was called with null or undefined message';
|
|
@@ -45,19 +44,6 @@ class Logger {
|
|
|
45
44
|
});
|
|
46
45
|
}
|
|
47
46
|
console.log(JSON.stringify(inflatedLog));
|
|
48
|
-
// Warn the developer how to retrieve the error in splunk
|
|
49
|
-
this.logSplunkQuery();
|
|
50
|
-
};
|
|
51
|
-
/**
|
|
52
|
-
* Logs splunk query so the developer can search for the errors in splunk.
|
|
53
|
-
* This function runs only once in the lifetime of the Logger class so we
|
|
54
|
-
* don't mess up with the developer's terminal
|
|
55
|
-
*/
|
|
56
|
-
this.logSplunkQuery = () => {
|
|
57
|
-
if (linked) {
|
|
58
|
-
const message = `Try this query at Splunk to retrieve error log: 'index=io_vtex_logs app="${app}" account=${this.account} workspace=${this.workspace} level=error OR level=warn'`;
|
|
59
|
-
console_1.logOnceToDevConsole(message, LogLevel.Info);
|
|
60
|
-
}
|
|
61
47
|
};
|
|
62
48
|
this.account = ctx.account;
|
|
63
49
|
this.workspace = ctx.workspace;
|
|
@@ -12,6 +12,11 @@ export declare const enum ErrorReportLogFields {
|
|
|
12
12
|
*/
|
|
13
13
|
ERROR_KIND = "error.kind",
|
|
14
14
|
ERROR_ID = "error.id",
|
|
15
|
+
ERROR_MESSAGE = "error.message",
|
|
16
|
+
ERROR_CODE = "error.code",
|
|
17
|
+
ERROR_STACK = "error.stack",
|
|
18
|
+
ERROR_METADATA_REPORT_COUNT = "error.metadata.reportCount",
|
|
19
|
+
ERROR_METADATA_METRICS_INSTANTIATION_TIME = "error.metadata.metrics.InstantiationTime",
|
|
15
20
|
/**
|
|
16
21
|
* VTEX's Infra errors adds error details to the response
|
|
17
22
|
* The following log fields are supposed to hold these fields
|
|
@@ -39,15 +39,14 @@ class UserLandTracer {
|
|
|
39
39
|
this.fallbackSpan = newSpan;
|
|
40
40
|
}
|
|
41
41
|
startSpan(name, options) {
|
|
42
|
-
var _a
|
|
42
|
+
var _a;
|
|
43
43
|
if (options && (options.childOf || ((_a = options.references) === null || _a === void 0 ? void 0 : _a.length))) {
|
|
44
|
-
return
|
|
44
|
+
return this.tracer.startSpan(name, options);
|
|
45
45
|
}
|
|
46
|
-
return
|
|
46
|
+
return this.tracer.startSpan(name, { ...options, childOf: this.fallbackSpan });
|
|
47
47
|
}
|
|
48
48
|
inject(spanContext, format, carrier) {
|
|
49
|
-
|
|
50
|
-
return (_a = this.tracer) === null || _a === void 0 ? void 0 : _a.inject(spanContext, format, carrier);
|
|
49
|
+
return this.tracer.inject(spanContext, format, carrier);
|
|
51
50
|
}
|
|
52
51
|
fallbackSpanContext() {
|
|
53
52
|
var _a;
|
|
@@ -34,7 +34,7 @@ class ErrorReport extends node_error_report_1.ErrorReportBase {
|
|
|
34
34
|
* span is part of a **sampled** trace, then the error will be logged.
|
|
35
35
|
*/
|
|
36
36
|
injectOnSpan(span, logger) {
|
|
37
|
-
var _a;
|
|
37
|
+
var _a, _b, _c, _d;
|
|
38
38
|
span === null || span === void 0 ? void 0 : span.setTag(__1.TracingTags.ERROR, 'true');
|
|
39
39
|
const indexedLogs = {
|
|
40
40
|
["error.kind" /* ERROR_KIND */]: this.kind,
|
|
@@ -47,7 +47,15 @@ class ErrorReport extends node_error_report_1.ErrorReportBase {
|
|
|
47
47
|
indexedLogs["error.server.request_id" /* ERROR_SERVER_REQUEST_ID */] = this.parsedInfo.response.data.requestId;
|
|
48
48
|
}
|
|
49
49
|
const serializableError = this.toObject();
|
|
50
|
-
span === null || span === void 0 ? void 0 : span.log({
|
|
50
|
+
span === null || span === void 0 ? void 0 : span.log({
|
|
51
|
+
event: 'error',
|
|
52
|
+
...indexedLogs,
|
|
53
|
+
["error.message" /* ERROR_MESSAGE */]: serializableError.message,
|
|
54
|
+
["error.metadata.metrics.InstantiationTime" /* ERROR_METADATA_METRICS_INSTANTIATION_TIME */]: (_b = serializableError.metadata) === null || _b === void 0 ? void 0 : _b.reportCount,
|
|
55
|
+
["error.metadata.reportCount" /* ERROR_METADATA_REPORT_COUNT */]: (_d = (_c = serializableError.metadata) === null || _c === void 0 ? void 0 : _c.metrics) === null || _d === void 0 ? void 0 : _d.instantiationTime,
|
|
56
|
+
["error.stack" /* ERROR_STACK */]: serializableError.stack,
|
|
57
|
+
["error.code" /* ERROR_CODE */]: serializableError.code,
|
|
58
|
+
});
|
|
51
59
|
if (logger && this.shouldLogToSplunk(span)) {
|
|
52
60
|
logger.error(serializableError);
|
|
53
61
|
this.markErrorAsReported();
|