github zeromicro/go-zero v1.9.1

latest release: tools/goctl/v1.9.1
23 hours ago

Highlights

  • Logging enhancements:
    • Customize log key names to fit your log schema and downstream tooling.
    • Prefer json.Marshaler over fmt.Stringer when emitting JSON logs, improving correctness and structure.
  • REST/SSE stability and operability:
    • Fix SSE handler blocking and reduce noisy logs by downgrading SetWriteDeadline errors to debug.
    • Add SetSSESlowThreshold to help detect slow clients and long writes.
  • Diagnostics and performance:
    • Improved mapreduce panic stacktraces for faster root-cause analysis.
    • Optimized machine performance data reading to reduce runtime overhead.

Detailed Changes

Logging

  • Support customizing log keys so you can align emitted fields (e.g., time, level, caller, message) to your organization’s conventions or ingestion pipeline requirements.
    PR: feat: support customize of log keys by @WqyJh (@5103)
  • Prefer json.Marshaler over fmt.Stringer when generating JSON logs, ensuring structured fields are serialized using their explicit JSON representations rather than ad-hoc strings.
    PR: feat: prefer json.Marshaler over fmt.Stringer for JSON log output by @WqyJh (@5117)

REST/SSE

  • Fix SSE handler blocking behavior that could stall responses under certain conditions.
    PR: fix: SSE handler blocking by @wuqinqiang (@5181)
  • Reduce log noise for transient I/O conditions by downgrading SetWriteDeadline errors to debug level in REST SSE.
    PR: fix(rest): change SSE SetWriteDeadline error log to debug level by @wuqinqiang (@5162)
  • Add sseSlowThreshold to surface slow SSE writes, enabling better observability about backpressure or slow clients.
    PR: feat(handler): add sseSlowThreshold by @wuqinqiang (@5196)

MapReduce

  • Improve panic stacktrace reporting in mapreduce, making error contexts clearer and debugging faster.
    PR: optimize: mapreduce panic stacktrace by @kevwan (@5168)

Performance and Runtime

  • Optimize machine performance data reading to lower collection overhead and reduce runtime impact.
    PR: opt: optimization of machine performance data reading by @wanwusangzhi (@5174)

Bug Fixes

  • Fix gRPC → HTTP mapping issue in gateway.
    PR: fix: issue-5110 by @guonaihong (@5113)

Migration and Usage Notes

  • Logging key customization:
    • If you rely on specific field names in log pipelines, consider setting the new custom key configuration to preserve schema consistency.
  • JSON log output:
    • If your types implement json.Marshaler, expect more accurate JSON in logs. If you previously depended on stringified representations, review downstream consumers to ensure compatibility.
  • SSE tuning:
    • Consider using SetSSESlowThreshold to flag slow clients or network conditions in environments sensitive to latency.
    • The SetWriteDeadline log level change reduces noise; adjust logger settings if you still want to surface these events.

Acknowledgements

Full Changelog

Don't miss a new go-zero release

NewReleases is sending notifications on new releases.