mirror of
https://github.com/milvus-io/milvus.git
synced 2026-07-21 02:05:41 +00:00
issue: #47404 - message trace context: add trace context serialization and restore/inject helpers for WAL messages and msgstream conversion - WAL append trace: normalize WAL spans for autocommit, txn, broadcast, append, appendimpl, and broadcast callback paths - trace propagation: restore message trace context in producer, broadcast retry, replicate primary/secondary, recovery, flusher, and query/data flowgraph consumers --------- Signed-off-by: chyezh <chyezh@outlook.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
36 lines
1004 B
Go
36 lines
1004 B
Go
package producer
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/milvus-io/milvus/pkg/v3/proto/streamingpb"
|
|
"github.com/milvus-io/milvus/pkg/v3/streaming/util/message"
|
|
)
|
|
|
|
// produceGrpcClient is a wrapped producer server of log messages.
|
|
type produceGrpcClient struct {
|
|
streamingpb.StreamingNodeHandlerService_ProduceClient
|
|
}
|
|
|
|
// SendProduceMessage sends the produce message to server.
|
|
func (p *produceGrpcClient) SendProduceMessage(ctx context.Context, requestID int64, msg message.MutableMessage) error {
|
|
message.OverwriteTraceContext(ctx, msg)
|
|
return p.Send(&streamingpb.ProduceRequest{
|
|
Request: &streamingpb.ProduceRequest_Produce{
|
|
Produce: &streamingpb.ProduceMessageRequest{
|
|
RequestId: requestID,
|
|
Message: msg.IntoMessageProto(),
|
|
},
|
|
},
|
|
})
|
|
}
|
|
|
|
// SendClose sends the close request to server.
|
|
func (p *produceGrpcClient) SendClose() error {
|
|
return p.Send(&streamingpb.ProduceRequest{
|
|
Request: &streamingpb.ProduceRequest_Close{
|
|
Close: &streamingpb.CloseProducerRequest{},
|
|
},
|
|
})
|
|
}
|