Thank you for considering contributing to the TraceKit Java SDK! This document provides guidelines and instructions for contributing.
- Getting Started
- Development Setup
- Building the Project
- Running Tests
- Code Style
- Making Changes
- Pull Request Process
- Project Structure
- Fork the repository on GitHub
- Clone your fork locally:
git clone https://github.com/YOUR-USERNAME/tracekit-java-sdk.git cd tracekit-java-sdk - Add the upstream repository:
git remote add upstream https://github.com/context-io/tracekit-java-sdk.git
- Java Development Kit (JDK): 11 or higher
- Maven: 3.6+ (or use the included Maven wrapper)
- Git: For version control
- IDE (optional but recommended):
- IntelliJ IDEA (recommended)
- Eclipse
- VS Code with Java extensions
- Open the project:
File > Openand select thepom.xmlfile - IntelliJ will automatically import the Maven project
- Enable annotation processing:
Settings > Build, Execution, Deployment > Compiler > Annotation Processors - Install recommended plugins:
- Lombok (if using IntelliJ < 2020.3)
- CheckStyle-IDEA (for code style validation)
- Import as Maven project:
File > Import > Maven > Existing Maven Projects - Select the root directory containing
pom.xml - Eclipse will automatically configure the project
For running examples and tests, you may need to set:
export TRACEKIT_API_KEY=your-test-api-key
export TRACEKIT_ENDPOINT=https://api.tracekit.dev/v1/traces# Using Maven wrapper (recommended)
./mvnw clean install
# Or using system Maven
mvn clean install# Build only tracekit-core
mvn clean install -pl tracekit-core
# Build only tracekit-spring-boot
mvn clean install -pl tracekit-spring-bootmvn clean install -DskipTestsmvn javadoc:javadocJavaDoc will be generated in target/site/apidocs/ for each module.
mvn testmvn test -pl tracekit-coremvn test -Dtest=TracekitSDKTestmvn test -Dtest=TracekitSDKTest#testInitialization# Integration tests are marked with @Tag("integration")
mvn verifyGenerate test coverage report using JaCoCo:
mvn clean verifyCoverage reports will be in target/site/jacoco/index.html.
This project follows the Google Java Style Guide with minor modifications:
- Indentation: 4 spaces (not 2)
- Line Length: 120 characters maximum
- Import Order:
- Static imports
java.*andjavax.*- Third-party libraries
- Project imports
Format your code before committing:
# Using Maven formatter plugin (if configured)
mvn formatter:format
# Or configure your IDE to format on save- Classes: PascalCase (e.g.,
TracekitSDK,TracekitConfig) - Methods: camelCase (e.g.,
getServiceName(),buildConfiguration()) - Constants: UPPER_SNAKE_CASE (e.g.,
DEFAULT_ENDPOINT,SDK_VERSION) - Variables: camelCase (e.g.,
apiKey,serviceName)
All public classes and methods must have JavaDoc:
/**
* Brief description of what this class/method does.
*
* <p>Additional details if needed, including usage examples.</p>
*
* @param paramName description of parameter
* @return description of return value
* @throws ExceptionType when this exception is thrown
*/
public ReturnType methodName(ParamType paramName) throws ExceptionType {
// implementation
}Before submitting a PR, ensure:
- No compiler warnings: Code compiles without warnings
- All tests pass:
mvn testreturns success - No checkstyle violations: Follow code style guidelines
- Test coverage: New code should have >80% test coverage
- JavaDoc complete: All public APIs are documented
-
Create a feature branch from
main:git checkout -b feature/your-feature-name
-
Use descriptive branch names:
feature/add-kafka-supportbugfix/fix-null-pointer-in-configdocs/update-readmerefactor/improve-error-handling
Follow the Conventional Commits specification:
<type>(<scope>): <subject>
<body>
<footer>
Types:
feat: New featurefix: Bug fixdocs: Documentation changestest: Adding or updating testsrefactor: Code refactoringperf: Performance improvementschore: Build process or auxiliary tool changes
Examples:
feat(core): add support for custom span processors
Implement custom span processor configuration to allow users
to add their own processing logic before spans are exported.
Closes #123
fix(spring-boot): resolve null pointer in auto-configuration
Fix NPE when api-key is not configured by adding proper
validation in TracekitAutoConfiguration.
Fixes #456
-
Unit Tests: Test individual components in isolation
@Test void testConfigBuilderValidation() { assertThrows(IllegalArgumentException.class, () -> { TracekitConfig.builder().build(); }); }
-
Integration Tests: Test component interactions
@Test @Tag("integration") void testEndToEndTracing() { // Test full tracing pipeline }
-
Use descriptive test names: Test names should describe what is being tested
@Test void shouldThrowExceptionWhenApiKeyIsMissing() { } @Test void shouldDetectLocalUIWhenPortIsOpen() { }
-
Follow AAA pattern: Arrange, Act, Assert
@Test void shouldConfigureSDKWithValidParameters() { // Arrange TracekitConfig config = TracekitConfig.builder() .apiKey("test-key") .serviceName("test-service") .build(); // Act TracekitSDK sdk = TracekitSDK.create(config); // Assert assertEquals("test-service", sdk.getServiceName()); }
-
Update your branch with the latest changes from upstream:
git fetch upstream git rebase upstream/main
-
Run all tests:
mvn clean verify
-
Build successfully:
mvn clean install
-
Update documentation if needed:
- Update README.md for new features
- Add/update JavaDoc for public APIs
- Update CHANGELOG.md (if it exists)
-
Push your changes to your fork:
git push origin feature/your-feature-name
-
Create a Pull Request on GitHub
-
Fill out the PR template with:
- Clear description of changes
- Motivation and context
- Related issue numbers
- Screenshots (if UI changes)
- Checklist completion
- Automated checks: CI/CD pipeline must pass
- Code review: At least one maintainer approval required
- Discussion: Address reviewer feedback promptly
- Squash commits: May be required before merge
-
Delete your feature branch:
git branch -d feature/your-feature-name git push origin --delete feature/your-feature-name
-
Update your local main branch:
git checkout main git pull upstream main
tracekit-java-sdk/
├── tracekit-core/ # Core SDK module
│ ├── src/main/java/ # Main source code
│ ├── src/test/java/ # Unit tests
│ └── pom.xml # Module POM
├── tracekit-spring-boot/ # Spring Boot integration
│ ├── src/main/java/ # Auto-configuration
│ ├── src/test/java/ # Integration tests
│ └── pom.xml # Module POM
├── examples/ # Example applications
│ └── spring-boot-example/ # Spring Boot demo
├── pom.xml # Parent POM
├── README.md # Project README
├── CONTRIBUTING.md # This file
└── LICENSE # MIT License
dev.tracekit: Core SDK classesdev.tracekit.local: Local UI detectiondev.tracekit.security: Security scanningdev.tracekit.spring: Spring Boot integration
If you have questions or need help:
- Check existing GitHub Issues
- Create a new issue with the
questionlabel - Email support@tracekit.dev
By contributing, you agree that your contributions will be licensed under the MIT License.