How newrelic/nri-rabbitmq works
Main Components
• Integration Engine – Represented by the main executable (nri-rabbitmq) built from the source code.
• Command-Line Interface – Parsing of command-line arguments (located in src/args).
• Data Collection Modules:
– Client Module (src/client): Handles communication with RabbitMQ’s Management API.
– Data Processing/Conversion Module (src/data): Contains code to convert raw inputs and definitions.
– Inventory Module (src/inventory): Manages inventory data obtained from configuration files.
– Metrics Module (src/metrics): Processes performance metrics received from RabbitMQ.
• Build and Packaging Infrastructure:
– Build scripts, Makefile, and packaging scripts found in the build directory – highlight different target platforms (e.g., Windows MSI packages).
• Testing Infrastructure:
– Tests and sample configurations under tests/ and within src packages.
Relationships and Data Flow
• From the CLI, the integration invokes the client module which communicates with the RabbitMQ Management API.
• The client module passes data to the data processing module, where converters and definitions are applied.
• Data then branches out into:
• The Metrics Module – handling performance statistics.
• The Inventory Module – handling configuration-derived inventory details.
• That both modules ultimately feed into New Relic’s monitoring pipelines (which could be represented as an external service or New Relic backend).
• Optionally, include the build process (Makefile, build scripts) as a separate “deployment” or “build pipeline” component that packages the executable for distribution.
• Testing components (src tests and tests folder) separately, showing that they are invoked during the build process.
Architectural Patterns and Design Principles
• Modularity – Highlight how the code is split into distinct packages such as args, client, data, inventory, and metrics. This separation clarifies single responsibility for each module.
• Clear Separation between data collection (via the client and API calls) and processing (conversion functions, metrics, and inventory).
• Build pipelines supporting cross-platform packaging (with specific Windows packaging logic and scripts for Linux/Nix).
Relevant Technologies, Frameworks, or Libraries
• Golang as the primary programming language.
• New Relic-specific libraries or APIs (although not explicitly seen, the integration clearly depends on New Relic’s data ingestion).
• Package management and dependency locking are handled via govendor.
• The build system utilizing Makefiles, CI configuration (GitHub workflows in .github/workflows), and scripts for multi-platform builds.