@vtex/api 6.45.21 → 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,16 @@ 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
+
10
20
  ## [6.45.21] - 2023-09-19
11
21
  ### Changed
12
22
  - Fix tracingMiddleware shouldTrace decision
@@ -1789,11 +1799,12 @@ instead
1789
1799
  - `HttpClient` now adds `'Accept-Encoding': 'gzip'` header by default.
1790
1800
 
1791
1801
 
1792
- [Unreleased]: https://github.com/vtex/node-vtex-api/compare/v6.45.21...HEAD
1802
+ [Unreleased]: https://github.com/vtex/node-vtex-api/compare/v6.45.22...HEAD
1793
1803
  [6.45.15]: https://github.com/vtex/node-vtex-api/compare/v6.45.14...v6.45.15
1794
1804
  [6.45.14]: https://github.com/vtex/node-vtex-api/compare/v6.45.13...v6.45.14
1795
1805
  [6.45.13]: https://github.com/vtex/node-vtex-api/compare/v6.45.12...v6.45.13
1796
1806
 
1807
+ [6.45.22]: https://github.com/vtex/node-vtex-api/compare/v6.45.21...v6.45.22
1797
1808
  [6.45.21]: https://github.com/vtex/node-vtex-api/compare/v6.45.21-beta.2...v6.45.21
1798
1809
  [6.45.21-beta.2]: https://github.com/vtex/node-vtex-api/compare/v6.45.21-beta.1...v6.45.21-beta.2
1799
1810
  [6.45.21-beta.1]: https://github.com/vtex/node-vtex-api/compare/v6.45.21-beta.0...v6.45.21-beta.1
@@ -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
@@ -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({ event: 'error', ...indexedLogs, error: serializableError });
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();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vtex/api",
3
- "version": "6.45.21",
3
+ "version": "6.45.22",
4
4
  "description": "VTEX I/O API client",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",