con un clic
project-knowledge
// LoongCollector project knowledge: architecture, terminology, codebase map, and coding standards (C++/Go).
// LoongCollector project knowledge: architecture, terminology, codebase map, and coding standards (C++/Go).
在进行 Code Review 时,使用这个技能对 LoongCollector 变更进行安全导向、架构一致性优先的深度代码评审。
Write commit messages following to Conventional Commits standards.
Building LoongCollector C++ and Go components. Use when compiling any part of the project.
Design document writing conventions. Use when writing or reviewing technical design documents.
LoongCollector E2E 测试全流程指南:设计、编写、运行和调试。当需要编写新 E2E 测试、运行现有测试、或排查 E2E 测试失败时使用此 skill。
Mermaid diagram conventions. Use whenever diagrams are needed in documentation or code review.
| name | project-knowledge |
| description | LoongCollector project knowledge: architecture, terminology, codebase map, and coding standards (C++/Go). |
The LoongCollector architecture is based on a plugin system with the following key components:
Core Application: Main entry point in core/logtail.cpp, initializes Application class in core/application/Application.cpp. Follows singleton pattern, manages overall lifecycle.
Plugin System: Supports plugins for data collection, processing, and flushing:
Pipeline Management: Collection pipelines managed by CollectionPipelineManager handle data flow from inputs through processors to flushers.
Configuration: Supports both local and remote configuration management with watchers that monitor for configuration changes.
Queuing System: Implements various queue types including bounded queues, circular queues, and exactly-once delivery queues for reliable data transmission.
Monitoring: Built-in monitoring and metrics collection for tracking the collector's own performance and health.
core/ # Core C++ code
plugin/ # Plugin system
input/ # Data collection input plugins
processor/ # Data processing plugins
flusher/ # Data output plugins (SLS, file, etc.)
collection_pipeline/ # Main pipeline flow (queue, batch, serialization)
config/ # Configuration (loading, providers, feedback)
provider/ # Config providers (Enterprise, Legacy)
common/ # Common utilities, data structures, network, string, crypto
monitor/ # Monitoring, metrics collection, alerting
logger/ # Logging system
checkpoint/ # Checkpoint, state management
app_config/ # Global configuration
models/ # Core data structures (events, logs, metrics)
parser/ # Log parsers
task_pipeline/ # Task scheduling
go_pipeline/ # Go plugin integration
ebpf/ # eBPF collection and plugins
host_monitor/ # Host-level monitoring
shennong/ # Shennong metrics
prometheus/ # Prometheus collection
file_server/ # File collection and management
container_manager/ # Container environment management
application/ # Main application entry
protobuf/ # Protobuf protocol definitions
metadata/ # K8s and other metadata collection
constants/ # Constants
tools/ # Internal utility scripts
unittest/ # Unit tests
legacy_test/ # Historical test cases
pkg/ # Go packages
helper/ # Go helper functions
containercenter/ # Go container-related functions
plugin_main/ # Plugin main entry
pluginmanager/ # Go plugin manager (lifecycle, registration)
plugins/ # Go plugin packages
input/ # Go input plugins (docker, etc.)
processor/ # Go processor plugins
flusher/ # Go flusher plugins
aggregator/ # Go aggregator plugins
extension/ # Go extension plugins
all/ # Plugin registration and init
test/ # Go plugin tests
test/ # Integration tests
e2e/ # E2E test cases (open source Go plugins)
e2e_enterprise/ # E2E enterprise test cases (host + K8s)
docs/ # Project documentation
scripts/ # Build, deploy, test scripts
docker/ # Docker-related files
rpm/ # RPM packaging
external/ # External dependencies
spdlog - Loggingrapidjson - JSON parsinggtest, gmockprotobufre2cityhashjsoncpp, yamlcpplz4, zlib, zstdcurl, ssl, cryptoboost, gflags, leveldb, uuidtcmalloc (optional)| Term | Description |
|---|---|
| LoongCollector | The observability data collection agent (formerly iLogtail) |
| Pipeline | A data processing chain: Input -> Processor(s) -> Flusher |
| Plugin | A modular component that performs specific data operations |
| Input Plugin | Collects data from a source (file, network, metric, etc.) |
| Processor Plugin | Transforms data (parse, filter, enrich, etc.) |
| Flusher Plugin | Sends data to a destination (SLS, stdout, Prometheus, etc.) |
| Config | Collection configuration defining pipeline behavior |
| Checkpoint | Persistent state tracking for exactly-once delivery |
| Runner | Execution wrapper for a specific plugin instance |
| Queue | Data buffer between pipeline stages |
| Batch | Group of events processed/sent together |
| SLS | Alibaba Cloud Simple Log Service |
| eBPF | Extended Berkeley Packet Filter (kernel tracing) |
| SPL | Structured Processing Language |
| Path | Purpose |
|---|---|
core/logtail.cpp | Main entry point |
core/application/Application.cpp | Application singleton, lifecycle management |
core/collection_pipeline/CollectionPipelineManager.cpp | Pipeline lifecycle |
core/collection_pipeline/CollectionPipeline.cpp | Pipeline execution |
core/runner/ProcessorRunner.cpp | Processor execution |
core/runner/FlusherRunner.cpp | Flusher execution |
core/config/watcher/PipelineConfigWatcher.cpp | Config change detection |
core/file_server/FileServer.cpp | File collection management |
core/file_server/checkpoint/CheckpointManagerV2.cpp | Exactly-once checkpoint |
mUserId)kMaxSendBufferSize)std::unique_ptr / std::shared_ptr for memory managementstd::optional, std::variant, std::any for type-safe alternativesconstexpr and const for compile-time computationsstd::string_view for read-only string operationsstd::runtime_error, std::invalid_argument)std::move for move semantics<algorithm> (e.g., std::sort, std::for_each)std::array or std::vector over raw arraysstatic_cast, dynamic_cast, reinterpret_castenum class for strongly typed enumerationsfmt.Errorf with %w for error wrappingtesting package