Skip to content

feat(logs): add stateful encoding module plumbing and token types#49215

Draft
DDuongNguyen wants to merge 1 commit intojsaf/stateful-transport-initfrom
04-10-feat_logs_add_stateful_encoding_module_plumbing_and_token_types
Draft

feat(logs): add stateful encoding module plumbing and token types#49215
DDuongNguyen wants to merge 1 commit intojsaf/stateful-transport-initfrom
04-10-feat_logs_add_stateful_encoding_module_plumbing_and_token_types

Conversation

@DDuongNguyen
Copy link
Copy Markdown
Contributor

@DDuongNguyen DDuongNguyen commented Apr 10, 2026

What does this PR do?

Lays the foundation for the stateful encoding feature by introducing:

  • Token type system (pkg/logs/patterns/token/): Core types — Token, TokenList, Signature, Tokenizer interface — that all downstream pattern modules depend on
  • Protobuf definitions (pkg/proto/datadog/stateful/): The StatefulEncoding gRPC service contract and message types for streaming encoded log data
  • Configuration (pkg/config/setup/, comp/logs/agent/config/): New logs_config.use_grpc and stateful encoding knobs (max patterns, eviction thresholds, etc.)
  • Go module plumbing: go.mod / go.sum replace directives, go.work, and modules.yml updates so the new sub-modules resolve across the monorepo
  • DESIGN.md (pkg/logs/patterns/DESIGN.md): Architecture overview of the full feature — read this first for context on the entire stack

This is PR 1/6 in a stack. It is based on #48879 (stateful gRPC transport init by @TheSafo). Review the DESIGN.md for a high-level map of what each subsequent PR adds.

Motivation

The stateful encoding pipeline needs shared types, protobuf contracts, and config wiring before any feature code can be added. Splitting these into the first PR keeps every subsequent PR focused on a single architectural layer.

Describe how you validated your changes

  • Existing unit tests for token types pass (pkg/logs/patterns/token/)
  • go build ./... succeeds for affected modules
  • Proto-generated code compiles and matches the .proto source

How to Review this PR

  1. Start with pkg/logs/patterns/DESIGN.md for the full architecture overview
  2. Review pkg/proto/datadog/stateful/stateful_encoding.proto for the gRPC contract
  3. Skim pkg/logs/patterns/token/ for the core type definitions
  4. The go.mod / go.sum changes are mechanical replace directives — spot-check a few

Additional Notes

The bulk of the file count comes from go.mod replace directives (~185 modules). These are additive and mechanical. The actual feature code in this PR is the token package, proto definitions, and config additions.

Copy link
Copy Markdown
Contributor Author

DDuongNguyen commented Apr 10, 2026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant