Skip to content

Commit

Permalink
improve the logging for this error: warn so it isn't missed, details …
Browse files Browse the repository at this point in the history
…at trace level
  • Loading branch information
trentm committed Dec 10, 2024
1 parent d26a9b8 commit ebccbe3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ See the <<upgrade-to-v4>> guide.
[float]
===== Bug fixes
* Guard against a possible encoding error of tracing data in the APM client,
before it is sent. It is *possible* this could wedge the APM client,
resulting in the APM agent no longer sending tracing data.
({pull}4359[#4359])
[float]
===== Chores
Expand Down
11 changes: 10 additions & 1 deletion lib/apm-client/http-apm-client/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,16 @@ Client.prototype._encode = function (obj, enc) {
try {
out[outAttr] = truncFunc(thing, this._conf);
} catch (err) {
this._log.trace({ err, thing }, `error encoding "${outAttr}" object`);
this._log.warn(
{
err,
// Only log full problematic object at TRACE level to limit noise.
thing: this._log.isLevelEnabled('trace') ? thing : '[REDACTED]',
thing_id: thing?.id,
thing_name: thing?.name,
},
`could not encode "${outAttr}" object`,
);
return null;
}

Expand Down

0 comments on commit ebccbe3

Please sign in to comment.