How apache/skywalking-go works
Main components
• Agent Core: Represent the core agent components found under the “agent” directory. This includes submodules for compile-time instrumentation, metrics (agent/core/metrics), tracing (agent/core/tracing), and operator logic.
• Plugin Framework: An extensive “plugins” folder contains multiple directories for different integrations (e.g., “amqp”, “dubbo”, “gin”, “grpc”, “sql”, and many more). Show that these plugins extend the agent’s functionality to various frameworks by using a central “Plugin Manager” or “Plugin Interface” concept.
• Reporter: The “agent/reporter” and plugins subdirectories (like plugins/core/reporter) handle sending the collected data (traces/metrics/logs) to external systems (Apache SkyWalking backend, for instance).
• API/Integration Layer: Locate files such as “api.go” and supporting API implementations to present the communication endpoints for external applications or for integration into client code.
• Test and Documentation: Although not part of the runtime architecture, indicating the “test” and “docs” directory can provide context for how the agent is validated and documented.
Architectural principles & patterns
• Modular & Extensible Design: Emphasize that the architecture is heavily modular with reusable components. Distinct layers (instrumentation core, plugin framework, reporting layer) should be visually separated.
• Plugin Pattern and Interceptors: Indicate that many plugins implement instrumentation by intercepting function calls (observed by directories like plugins/core/operator and plugins/core/instrument) – effectively a chain-of-responsibility pattern.
• Separation of Concerns: Clearly separate build-time (static code instrumentation via compile modules) and runtime instrumentation components (reporting, plugin handlers).
• Instrumentation Core
• Plugin System (with various external integrations)
• Reporter & API Communication
• Tooling/Configuration management
Elements
– Instrumentation process: Application Code → Agent Core (compile/rewrite) → Plugin Interceptors
– Reporting process: Plugin/Agent Core → Reporter → External SkyWalking Backend
• Notation for external dependencies: Show external systems (i.e., SkyWalking backend collectors, third-party logging/monitoring systems) as separate entities.
Additional details
• Mention usage of dependency management and build configuration (files like go.mod, Makefile, Dockerfile) to indicate how the project is built and deployed.
Happy diagramming!