SIGN IN SIGN UP
milvus-io / milvus UNCLAIMED

Milvus is a high-performance, cloud-native vector database built for scalable vector ANN search

0 0 164 Go

enhance: Refactor the log library of milvus, support scoped context logging (#47610)

issue: #35917
design doc: https://github.com/milvus-io/milvus-design-docs/pull/14

Summary

This PR implements the mlog package - a context-aware logging library
built on
https://github.com/uber-go/zap, designed specifically for Milvus
distributed systems.

Key Features

- Mandatory Context Passing - All logging operations require a context,
ensuring request traceability
- Zero-Overhead Abstraction - Uses type aliases to avoid wrapper
overhead, performance comparable to
direct zap usage
- Automatic Field Accumulation - Context fields automatically accumulate
through the call chain, child
contexts inherit parent fields
- Cross-Service Propagation - Supports propagating key fields via gRPC
metadata for distributed tracing
- Lazy Encoding - Uses WithLazy for deferred field encoding, avoiding
encoding overhead when log level
is disabled
- Component-Level Logger - Provides optimized Logger type that selects
the logger with more pre-encoded
fields to minimize runtime encoding

---------

Signed-off-by: chyezh <chyezh@outlook.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Z
Zhen Ye committed
bceb050835a0fbe4dcf4dfdbba91f39dc071bd71
Parent: d7f0751
Committed by GitHub <noreply@github.com> on 5/21/2026, 11:53:49 PM