Skip to content

docs(guides): add comprehensive collector development guide#465

Merged
kcenon merged 1 commit into
mainfrom
docs/issue-455-create-collector-development-guide
Feb 9, 2026
Merged

docs(guides): add comprehensive collector development guide#465
kcenon merged 1 commit into
mainfrom
docs/issue-455-create-collector-development-guide

Conversation

@kcenon

@kcenon kcenon commented Feb 9, 2026

Copy link
Copy Markdown
Owner

Closes #455

Summary

  • Created docs/guides/COLLECTOR_DEVELOPMENT.md (1055 lines) covering all 7 sections from the issue specification
  • All code examples derived from actual source code analysis of collector_base.h, collector_plugin.h, metric_factory.h, collector_adapters.h, and existing collector implementations
  • Includes ASCII architecture diagrams, decision tables, and complete code walkthroughs

Sections

  1. Collector Architecture - Dual interface overview (collector_base<T> CRTP vs collector_plugin), factory system diagram, interface comparison table, collection lifecycle
  2. Implementing a Custom Collector - Step-by-step CRTP walkthrough, create_base_metric usage, configuration convention, alternative plugin approach, hybrid CRTP+plugin pattern
  3. Platform-Specific Collectors - #ifdef guards vs Strategy pattern with decision table, platform detection macros, graceful fallback patterns, Windows include ordering
  4. Thread Safety Requirements - Method-level safety requirements, built-in CRTP thread safety, atomic operations for high-frequency metrics, thread-local buffer integration, safe shutdown
  5. Factory Registration - Three registration methods (helper functions, direct factory, REGISTER_COLLECTOR macro), instance creation APIs, plugin system registration, config-driven selection
  6. Testing Custom Collectors - Unit test patterns (lifecycle, metrics, disabled state, statistics, health, types), factory tests, platform tests, performance benchmarks, thread safety tests
  7. Reference: Built-in Collector Catalog - 17 collectors across 4 categories (core, utility, hardware plugin, container plugin) with files, metrics, and platform support

Test Plan

  • CRTP pattern fully explained with diagrams
  • Complete custom collector implementation walkthrough
  • Platform-specific implementation patterns documented
  • Thread safety requirements clearly stated
  • Factory registration process documented
  • Testing guide with examples
  • Built-in collector reference table
  • Verify all referenced source files exist in codebase (28/28 verified)
  • Review consistency with existing documentation (terminology matches ARCHITECTURE.md, plugin_architecture.md)

Verification Notes

  • File references: All 28 referenced paths verified (24 headers + 4 documents)
  • Code accuracy: All code examples derived from actual source files, not hypothetical
  • Naming consistency: Metric naming convention (<domain>.<metric_name>) consistent with existing collectors
  • Interface accuracy: Both collector_base<T> and collector_plugin APIs match actual header signatures

Create docs/guides/COLLECTOR_DEVELOPMENT.md covering:
- CRTP collector_base<T> pattern with diagrams
- Complete custom collector implementation walkthrough
- Platform-specific patterns (#ifdef vs Strategy)
- Thread safety requirements and atomic patterns
- Factory registration (3 methods) and creation APIs
- Testing strategies (unit, factory, platform, performance, thread safety)
- Built-in collector catalog (17 collectors across 4 categories)
@kcenon kcenon merged commit 7d6bfae into main Feb 9, 2026
21 checks passed
@kcenon kcenon deleted the docs/issue-455-create-collector-development-guide branch February 9, 2026 00:37
kcenon added a commit that referenced this pull request Apr 13, 2026
Create docs/guides/COLLECTOR_DEVELOPMENT.md covering:
- CRTP collector_base<T> pattern with diagrams
- Complete custom collector implementation walkthrough
- Platform-specific patterns (#ifdef vs Strategy)
- Thread safety requirements and atomic patterns
- Factory registration (3 methods) and creation APIs
- Testing strategies (unit, factory, platform, performance, thread safety)
- Built-in collector catalog (17 collectors across 4 categories)
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.

[Task] docs: Create collector development guide

1 participant