| doc_id | MON-PROJ-007 |
|---|---|
| doc_title | Contributing to Monitoring System |
| doc_version | 1.0.0 |
| doc_date | 2026-04-04 |
| doc_status | Released |
| project | monitoring_system |
| category | PROJ |
SSOT: This document is the single source of truth for Contributing to Monitoring System.
Language: English | 한국어
We welcome contributions to the Monitoring System! This document provides guidelines for contributing to the project.
- Getting Started
- Development Setup
- Making Changes
- Coding Standards
- Testing
- Submitting Changes
- Code Review Process
- Community Guidelines
- C++20 capable compiler (GCC 11+, Clang 14+, MSVC 2019+)
- CMake 3.16 or later
- Git
- Basic understanding of monitoring systems and observability
- Fork the repository on GitHub
- Clone your fork locally:
git clone https://github.com/yourusername/monitoring_system.git
cd monitoring_system# Create build directory
mkdir build && cd build
# Configure with development options
cmake .. \
-DCMAKE_BUILD_TYPE=Debug \
-DBUILD_TESTS=ON \
-DBUILD_BENCHMARKS=ON \
-DENABLE_COVERAGE=ON
# Build
cmake --build . --parallel $(nproc)# Run all tests
ctest --output-on-failure
# Run specific test categories
./tests/monitoring_system_tests --gtest_filter="MetricsTest.*"
./tests/monitoring_system_tests --gtest_filter="AlertingTest.*"
./tests/monitoring_system_tests --gtest_filter="DashboardTest.*"
# Run benchmarks
./benchmarks/monitoring_benchmarks
# Run stress tests
./tests/stress_tests --duration=60 --threads=4- Create feature branches from
main - Use descriptive branch names:
feature/add-metrics-aggregation,fix/memory-leak-collector - Keep branches focused on a single feature or fix
git checkout -b feature/your-feature-nameFollow the conventional commit format:
type(scope): description
body (optional)
footer (optional)
Types:
feat: New featurefix: Bug fixdocs: Documentation changesstyle: Formatting changesrefactor: Code refactoringtest: Adding/modifying testsperf: Performance improvementsbuild: Build system changes
Examples:
feat(metrics): add histogram metric type support
Add support for histogram metrics with configurable buckets
and automatic percentile calculation.
Closes #123
fix(alerting): resolve memory leak in alert processor
Fix memory leak caused by unreleased alert rule objects
in the alert processing pipeline.
Fixes #456
- Follow modern C++20 standards
- Use RAII principles consistently
- Prefer stack allocation over heap allocation
- Use smart pointers when heap allocation is necessary
- Avoid raw pointers except for non-owning references
- Use 4 spaces for indentation (no tabs)
- Maximum line length: 100 characters
- Use snake_case for variables and functions
- Use PascalCase for classes and types
- Use UPPER_CASE for constants and macros
// Classes and types
class MetricsCollector;
using MetricValue = double;
enum class AlertSeverity;
// Functions and variables
void collect_metrics();
auto metric_value = get_current_value();
const size_t buffer_size = 1024;
// Constants and macros
constexpr int MAX_METRICS = 10000;
#define MONITORING_VERSION_MAJOR 2- Use Doxygen-style comments for public APIs
- Include usage examples in API documentation
- Document complex algorithms and design decisions
- Keep comments up-to-date with code changes
/**
* @brief Collects metrics from registered collectors
*
* This function iterates through all registered metric collectors
* and aggregates their values into a single metrics snapshot.
*
* @param timestamp The timestamp for the metrics snapshot
* @return MetricsSnapshot containing all collected metrics
*
* @example
* auto snapshot = metrics_manager.collect_metrics(
* std::chrono::system_clock::now());
*/
MetricsSnapshot collect_metrics(TimePoint timestamp);- Unit Tests: Test individual components in isolation
- Integration Tests: Test component interactions
- Performance Tests: Verify performance characteristics
- Stress Tests: Test system under load
- Use Google Test framework
- Write tests for all public APIs
- Include both positive and negative test cases
- Test error conditions and edge cases
- Maintain high test coverage (>90%)
TEST(MetricsCollectorTest, CollectBasicMetrics) {
MetricsCollector collector;
collector.register_metric("cpu_usage", MetricType::Gauge);
auto snapshot = collector.collect();
EXPECT_FALSE(snapshot.empty());
EXPECT_TRUE(snapshot.contains("cpu_usage"));
}
TEST(MetricsCollectorTest, HandlesInvalidMetricName) {
MetricsCollector collector;
EXPECT_THROW(
collector.register_metric("", MetricType::Counter),
std::invalid_argument
);
}- Profile performance-critical code paths
- Use benchmarks to prevent performance regressions
- Consider memory allocation patterns
- Optimize for common use cases
- Code compiles without warnings
- All tests pass
- New code is covered by tests
- Documentation is updated
- Code follows style guidelines
- Commit messages are properly formatted
- Update your branch:
git checkout main
git pull upstream main
git checkout your-feature-branch
git rebase main- Push your changes:
git push origin your-feature-branch-
Create Pull Request:
- Use descriptive title and description
- Reference related issues
- Include testing instructions
- Add screenshots for UI changes
-
Address Review Feedback:
- Respond to all comments
- Make requested changes
- Update tests as needed
- Correctness: Does the code work as intended?
- Design: Is the code well-designed and maintainable?
- Functionality: Does it meet the requirements?
- Complexity: Is the code easy to understand?
- Tests: Are there appropriate tests?
- Naming: Are names clear and descriptive?
- Comments: Are comments helpful and accurate?
- Style: Does it follow the style guide?
- Documentation: Is the documentation adequate?
- Initial response: Within 2 business days
- Complete review: Within 5 business days
- Re-review after changes: Within 2 business days
- Be respectful and inclusive
- Welcome newcomers and help them learn
- Focus on constructive feedback
- Assume positive intent
- Respect different perspectives and experiences
- Issues: Use GitHub Issues for bug reports and feature requests
- Discussions: Use GitHub Discussions for questions and general discussion
- Email: kcenon@naver.com for sensitive matters
- Check existing documentation and examples
- Search existing issues and discussions
- Ask specific, detailed questions
- Provide minimal reproducible examples
- Minimize memory allocations in hot paths
- Use lock-free data structures where appropriate
- Prefer batch operations over individual calls
- Cache frequently accessed data
- Profile before optimizing
- Use result types for error handling
- Provide meaningful error messages
- Log errors with appropriate context
- Fail fast for programming errors
- Gracefully handle runtime errors
- Validate all input data
- Use secure coding practices
- Avoid buffer overflows
- Handle sensitive data appropriately
- Follow principle of least privilege
Contributors will be recognized in:
- CHANGELOG.md for significant contributions
- README.md contributors section
- GitHub contributors graph
- Annual contributor appreciation posts
Thank you for contributing to the Monitoring System! Your efforts help make observability better for everyone.
Last Updated: 2025-10-20