@nxtedition/lib 23.17.4 → 23.17.6

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/trace.js +5 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/lib",
3
- "version": "23.17.4",
3
+ "version": "23.17.6",
4
4
  "license": "MIT",
5
5
  "author": "Robert Nagy <robert.nagy@boffins.se>",
6
6
  "type": "module",
package/trace.js CHANGED
@@ -61,7 +61,7 @@ export function makeTrace({
61
61
  dispatcher: client,
62
62
  }).then(({ body }) => body.dump())
63
63
  } catch (err) {
64
- logger.error({ err, data }, 'trace failed')
64
+ logger.error({ err }, 'trace failed')
65
65
  } finally {
66
66
  pending -= data.length
67
67
  }
@@ -73,7 +73,7 @@ export function makeTrace({
73
73
  dropCount = 0
74
74
  })
75
75
 
76
- const prefix = `{"create":{"_index":"trace-${index}"}}\n{`
76
+ const header = `{"create":{"_index":"trace-${index}"}}\n`
77
77
  const postfix = `","serviceName":"${serviceName}","pid":${process.pid},"tid":${threadId}}\n`
78
78
 
79
79
  function trace(obj, op) {
@@ -81,8 +81,9 @@ export function makeTrace({
81
81
  dropCount++
82
82
  warnDrop()
83
83
  } else {
84
- const doc = (typeof obj === 'string' ? obj : stringify(obj)).slice(1, -1)
85
- traceData += `${prefix}${doc},"traceId":${genTraceId()},"@timestamp":${Date.now()},"op":"${op}${postfix}`
84
+ const doc = (typeof obj === 'string' ? obj : stringify(obj)).slice(0, -1)
85
+ traceData += header
86
+ traceData += `${doc},"traceId":${genTraceId()},"@timestamp":${Date.now()},"op":"${op}${postfix}`
86
87
  if (traceData.length > batch) {
87
88
  flushTraces()
88
89
  }