Thank you for your interest in contributing to the Red Hat Telemetry Collection API! This document provides guidelines and instructions for contributing to this project.
- Getting Started
- Development Setup
- Building the Project
- Testing
- Commit Conventions
- Pull Request Process
- Certificate of Origin
Before you begin, ensure you have the following installed:
- Node.js (version 18 or higher)
- npm (comes with Node.js)
- Git
- Fork the repository on GitHub
- Clone your fork locally:
git clone https://github.com/YOUR_USERNAME/vscode-redhat-telemetry.git
cd vscode-redhat-telemetry- Add the upstream repository as a remote:
git remote add upstream https://github.com/redhat-developer/vscode-redhat-telemetry.gitInstall all project dependencies:
npm installThis will install:
- TypeScript and build tools
- Testing frameworks (Mocha, Chai)
- Linting tools (ESLint)
- Commit linting tools (commitlint, husky)
- Webpack for bundling
The project is organized as follows:
src/
├── common/ # Shared code for all platforms
│ ├── api/ # Core telemetry API
│ ├── impl/ # Implementation details
│ ├── utils/ # Utility functions
│ └── vscode/ # VS Code specific utilities
├── node/ # Node.js specific implementations
├── webworker/ # Web worker specific implementations
└── tests/ # Test files
To build the project for development:
npm run buildThis command will:
- Clean the
lib/directory - Copy configuration files
- Compile TypeScript to JavaScript
For a production build with webpack bundling:
npm run packagenpm run clean- Remove thelib/directorynpm run copy-files- Copy configuration files to libnpm run compile- Compile TypeScript filesnpm run build- Full build process (clean + copy + compile)npm run package- Build and bundle with webpacknpm run prepublish- Build for publishing
Run the test suite:
npm testGenerate test coverage reports:
npm run coverageCoverage reports will be generated in the coverage/ directory.
Tests are located in src/tests/ and follow the naming pattern *.test.ts. The project uses:
- Mocha as the test framework
- Chai for assertions
- ts-node for TypeScript support
This project follows the Conventional Commits specification. All commit messages must follow this format:
<type>: <description>
[optional body]
[optional footer(s)]
feat: A new featurefix: A bug fixdocs: Documentation only changesstyle: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)refactor: A code change that neither fixes a bug nor adds a featureperf: A code change that improves performancetest: Adding missing tests or correcting existing testschore: Changes to the build process or auxiliary tools and libraries
feat: add support for custom telemetry endpoints
fix(api): resolve memory leak in event queue
docs: update contributing guidelines
test: add unit tests for telemetry service
chore: update dependencies to latest versionsThe project uses commitlint to validate commit messages. This is enforced via a Git hook that runs automatically when you commit.
If your commit message doesn't follow the conventional format, the commit will be rejected with an error message explaining what needs to be fixed.
-
Create a Feature Branch
git checkout -b feature/your-feature-name
-
Make Your Changes
- Write your code following the existing patterns
- Add tests for new functionality
- Update documentation if needed
-
Test Your Changes
npm test npm run build -
Commit Your Changes
git add . git commit -m "feat: add your feature description"
-
Push to Your Fork
git push origin feature/your-feature-name
-
Create a Pull Request
- Go to your fork on GitHub
- Click "New Pull Request"
- Select your feature branch
- Fill out the PR template with a clear description
- Title: Use a clear, descriptive title
- Description: Explain what changes you made and why
- Tests: Ensure all tests pass
- Documentation: Update relevant documentation
- Breaking Changes: Clearly mark any breaking changes
By contributing to this project you agree to the Developer Certificate of Origin (DCO). This document was created by the Linux Kernel community and is a simple statement that you, as a contributor, have the legal right to make the contribution. See the DCO file for details.
Each commit must be signed off to indicate your agreement with the DCO. You can do this by adding the -s flag when committing:
git commit -s -m "feat: add new telemetry feature"Or by adding the sign-off line manually:
feat: add new telemetry feature
Signed-off-by: Your Name <your.email@example.com>
For the best development experience, we recommend:
- Install the recommended VS Code extensions
- Use the provided TypeScript configuration
- Enable format on save
To debug telemetry during development, set the environment variable:
export VSCODE_REDHAT_TELEMETRY_DEBUG=trueThis will log telemetry events to the console instead of sending them to Red Hat servers.
The project uses ESLint for code formatting and style enforcement. Run the linter:
npx eslint src/- Issues: Use GitHub Issues for bug reports and feature requests
- Discussions: Use GitHub Discussions for questions and general discussion
- Documentation: Check the README.md for usage examples
By contributing, you agree that your contributions will be licensed under the Apache-2.0 license.