feat(logs): stateful gRPC log streaming with Rust pattern extraction#49342
Merged
DDuongNguyen merged 2 commits intologs-stateful-devfrom Apr 15, 2026
Merged
feat(logs): stateful gRPC log streaming with Rust pattern extraction#49342DDuongNguyen merged 2 commits intologs-stateful-devfrom
DDuongNguyen merged 2 commits intologs-stateful-devfrom
Conversation
691a8d4 to
57e962b
Compare
Implement a stateful gRPC transport for the logs agent that extracts reusable patterns from log messages, reducing wire size by 5-10x for high-volume pipelines. Core components: - gRPC stream worker with lifecycle management, backoff, and reconnection - Protobuf-based stateful encoding (PatternDefine, StructuredLog, DictEntryDefine) - Rust DFA tokenizer via FFI (FlatBuffers zero-copy deserialization) - Drain-inspired clustering with typed tokens and signature hashing - Dual-watermark eviction for patterns and tag dictionaries - Delta encoding for timestamps, pattern IDs, and tags - JSON preprocessing to extract structured fields - Batch tokenization pipeline with non-blocking drain strategy Performance optimizations: - Hot-pattern O(1) cache for steady-state matching - Saturation scoring to skip redundant merge checks - Adaptive first-word protection with cardinality threshold - Tag input fingerprint cache (zero-alloc on cache hit) - Pre-allocated DynamicValue backing arrays - Lazy dict promotion for high-cardinality wildcard values Vendored pre-built libpatterns binaries (temporary, pending dd-source merge): - linux/amd64, linux/arm64, darwin/arm64
# Conflicts: # pkg/logs/sender/grpc/batch_strategy.go # pkg/logs/sender/grpc/stream_worker.go # pkg/proto/datadog/stateful/stateful_encoding.proto # pkg/proto/pbgo/statefulpb/stateful_encoding.pb.go # tasks/agent.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Dev branch for Yoon's stateful encoding work. This contains the full feature set:
See the stacked PRs for reviewable breakdown: