milvus/pkg/log/fields.go
yihao.dai 5b97cb70a0
enhance: Support delaying scanner startup (#46369)
Introduce a ScannerStartupDelay configuration to enable WAL write-only
recovery, allowing fence messages to be persisted during
primary–secondary switchover when the StreamingNode is trapped in crash
loops.

issue: https://github.com/milvus-io/milvus/issues/46368

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Added a configurable WAL scanner pause/resume and a consumer request
flag to optionally ignore pause signals.

* **Metrics**
* Added a scanner pause gauge and pause-duration tracking for WAL
scanning.

* **Tests**
* Added coverage for pause-consumption behavior and cleanup in stream
client tests.

* **Chores**
* Consolidated flush-all logging into a single field and added a helper
for bulk message conversion.

<sub>✏️ Tip: You can customize this high-level summary in your review
settings.</sub>
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: bigsheeper <yihao.dai@zilliz.com>
2025-12-24 11:53:19 +08:00

32 lines
789 B
Go

package log
import (
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
)
const (
FieldNameModule = "module"
FieldNameComponent = "component"
)
// FieldModule returns a zap field with the module name.
func FieldModule(module string) zap.Field {
return zap.String(FieldNameModule, module)
}
// FieldComponent returns a zap field with the component name.
func FieldComponent(component string) zap.Field {
return zap.String(FieldNameComponent, component)
}
// FieldMessage returns a zap field with the message object.
func FieldMessage(msg zapcore.ObjectMarshaler) zap.Field {
return zap.Object("message", msg)
}
// FieldMessages returns a zap array field with the messages.
func FieldMessages[T zapcore.ObjectMarshaler](msgs []T) zap.Field {
return zap.Objects("messages", msgs)
}