Repository navigation
Conversation
…pacts retries and caps strings Adds mapAuditLevel, redactKeys, redactedValue, compactErrors and maxAttributeLength options, all on by default. Adds compactErrorSerializer and defaultOtelRedactKeys exports.
… otel createLogger throws when a removed option is passed. The level: 'audit' guard now applies only to the logger-level otel placement.
…l peer, release 3.0.0 The real-transport spec runs on 0.29 and the latest line under npm aliases. Lint forbids OpenTelemetry imports in library source. PR CI also runs for the v2.x branch.
otelAttributesFormat no longer redacts requestBodyValues, compacts retries
or caps strings by default: redactKeys, redactedValue, compactErrors,
defaultOtelRedactKeys and compactErrorSerializer are removed.
- createErrorSerializer({ omit, dedupe }) leaves properties out of every
error, or writes a shared object once. serializeError is its default.
- maxAttributeLength is off by default.
- The README shows the AI SDK setup as an example built from redactPaths,
createErrorSerializer and maxAttributeLength, and the transport spec
runs that example on 0.29 and the latest line.
cuzzlor
left a comment
There was a problem hiding this comment.
Dual review summary
Findings: 8 (blocker 0, major 1, minor 5, nit 2)
The change is coherent. One otel option replaces three, createErrorSerializer is a small extension of the existing walk, and the real-transport spec runs on both 0.29 and 0.34. The main risk is an audit-severity regression: the audit mapping now runs after loggerOptions.format but compares the mutable info.level, so a format such as format.colorize() stops audit records from being mapped. The upgrade docs also miss that otelAttributesFormat now maps audit by default. The reviewers disagreed on overall quality: Claude found no code defect, and GPT found the audit regression. On omit being called for plain error-shaped objects, they agreed on the diagnosis but disagreed on the fix.
Findings
- major: Audit mapping fails after a format that changes
info.level(gpt-only) - minor:
omitis called for plain objects that look like errors (disputed) - minor: Migration guide does not mention the new audit-mapping default (claude-only)
- minor: The claim that two
api-logscopies drop every line is wrong in most cases (claude-only) - minor: Surrogate-pair test does not exercise the surrogate guard (claude-only)
- minor: A
maxAttributeLengthbelow 11 is exceeded (gpt-only) - nit: Warning about
mapAuditLevel: falseapplies only whenlogSeverityis set (claude-only) - nit:
jsonStringifyValuesFormatJSDoc still recommends it for the OpenTelemetry transport (claude-only)
Findings not anchored to the diff
No line comment could be attached to these findings.
- nit:
jsonStringifyValuesFormatJSDoc still recommends it for the OpenTelemetry transport- Impact: The JSDoc at
src/json-stringify-values-format.ts:5-7still names "OTEL + Azure Log Analytics" as the use case, but 3.0 supports only transport 0.29 and later, where this format turns an error into oneexception.messagestring (src/otel-transport.spec.ts:193), and IDE users see this text rather than the updated README row atREADME.md:376. - Recommendation: Match the README: say the format is for sinks other than the OpenTelemetry transport, and that the transport needs
otelAttributesFormat.
- Impact: The JSDoc at
Generated by dual-review — Claude + litellm/azure/gpt-5.6-sol.
- Read the audit level from LEVEL, so a format such as colorize() before otel no longer stops audit records being mapped. Keep an existing logLevel so a second pass stays idempotent. - Cap a string to as much of [Truncated] as fits when maxAttributeLength is shorter than the marker, and cut nothing for a negative or NaN limit. - Make the surrogate-pair test cut inside a pair. - Document that omit also runs for plain objects with a string name, message and stack. - README: cover the audit-mapping default in Migrating from v2, state when two api-logs copies drop lines, and make the severityMapping warning unconditional. Point jsonStringifyValuesFormat users at otelAttributesFormat for the OpenTelemetry transport.
|
The unanchored nit from the review, the |
Closes #156.
v3 puts OpenTelemetry behind one
createLoggeroption,otel, and supports@opentelemetry/winston-transport0.29 and later only. Merging publishes 3.0.0 aslatest. Squash-merge: the intermediate commits do not each pass.Breaking changes
flatten,flattenReplacerandmapAuditLevelForOtelare removed. They are type errors, andcreateLoggerthrows if one is passed, so options built from config cannot fall back to nested output without a warning.@opentelemetry/winston-transportis an optional peer dependency at>=0.29. npm 7 and later refuse to install it beside an older transport.otel, the audit mapping runs last, so aloggerOptions.formatseesLEVEL: 'audit'.Dateunderotelis written unquoted.What changed
createLoggerotel?: boolean | OtelAttributesFormatOptionsappendsotelAttributesFormatas the last logger-level format.otelAttributesFormataudittoinfoseverity and writeslogLevel(mapAuditLevel, default on). Adds an opt-inmaxAttributeLengthcap that ends in[Truncated].createErrorSerializeromit(key, error)leaves properties out of every error.dedupewrites a shared object once.serializeErroris this factory with no options.otelplacement. On a transport's own format the transport filters by level before the format runs, solevel: 'audit'is safe there.@opentelemetry/*, so the optional peer cannot become a real dependency.severityMappingandlogSeverity, and pins the transport's SPLAT exception fallback.auditmeans", an AI SDK example built from generic options, and "Migrating from v2".The library has no knowledge of any consumer's libraries. The AI SDK setup (redact
requestBodyValues, dropresponseHeadersand a repeatedlastError, cap at the App Insights limit) is a README example built fromredactPaths,createErrorSerializerandmaxAttributeLength. The real-transport spec runs that example.Release
v2.xis cut from 2.3.0 for fixes only. Its publish workflow runs by hand and publishes under thelatest-2dist-tag, so a 2.x release never moveslatest. PR CI now also runs for PRs intov2.x.mapAuditLevelForOtel.flattenbecomesotel: true.createErrorSerializer({ omit }).Verification
npm run build: lint, types, rollup, attw and the CJS smoke test pass.npm test: 232 tests pass.npm run auditpasses.npm packofdistinstalled in a scratch project: refused beside transport 0.27, installs beside 0.34.