Skip to content

Commit a21b3c4

Browse files
committed
docs: add a CONTRIBUTING.md with build instruction
1 parent fbd819e commit a21b3c4

File tree

1 file changed

+243
-0
lines changed

1 file changed

+243
-0
lines changed

CONTRIBUTING.md

Lines changed: 243 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,243 @@
1+
# Contributing to tracing-opentelemetry-instrumentation-sdk
2+
3+
Thank you for your interest in contributing! This document provides guidelines and instructions for setting up your development environment and contributing to the project.
4+
5+
## Development Environment Setup
6+
7+
### Prerequisites
8+
9+
1. **Install mise** (if not already installed):
10+
11+
```bash
12+
# Using the install script
13+
curl https://mise.run | sh
14+
15+
# Or using a package manager
16+
# macOS: brew install mise
17+
# Arch: pacman -S mise
18+
# Ubuntu/Debian: see https://mise.jdx.dev/installing-mise.html
19+
```
20+
21+
2. **Clone the repository**:
22+
23+
```bash
24+
git clone https://github.com/davidB/tracing-opentelemetry-instrumentation-sdk.git
25+
cd tracing-opentelemetry-instrumentation-sdk
26+
```
27+
28+
3. **Install tools and dependencies**:
29+
30+
```bash
31+
# Install all tools defined in .mise.toml (Rust, protoc, grpcurl, etc.)
32+
mise install
33+
34+
# Activate the environment (or use 'mise use' for shell integration)
35+
mise activate
36+
```
37+
38+
### Available Development Tasks
39+
40+
We use `mise` tasks for all development workflows. Here are the main tasks:
41+
42+
#### Code Quality & Formatting
43+
44+
```bash
45+
# Format code
46+
mise run format
47+
48+
# Lint code (clippy + format check)
49+
mise run lint
50+
51+
# Check code with all feature combinations
52+
mise run check
53+
54+
# Run cargo deny security checks
55+
mise run deny
56+
```
57+
58+
#### Testing
59+
60+
```bash
61+
# Run tests (using nextest + doctests)
62+
mise run test
63+
64+
# Test each feature separately (slower but thorough)
65+
mise run test-each-feature
66+
```
67+
68+
#### Tool Installation
69+
70+
These tasks automatically install required tools if not present:
71+
72+
```bash
73+
# Individual tool installation (usually handled automatically by other tasks)
74+
mise run install:cargo-hack
75+
mise run install:cargo-nextest
76+
mise run install:cargo-insta
77+
mise run install:cargo-deny
78+
```
79+
80+
#### Container & Examples
81+
82+
```bash
83+
# Start Jaeger all-in-one for local development
84+
mise run run-jaeger
85+
86+
# Run example applications
87+
mise run run-example-grpc-server # gRPC server example
88+
mise run run-example-grpc-client # gRPC client example
89+
mise run run-example-axum-otlp-server # Axum HTTP server
90+
mise run run-example-http-client # HTTP client test
91+
mise run run-example-load # Load testing example
92+
```
93+
94+
#### Version Management
95+
96+
```bash
97+
# Set version across all workspace crates
98+
mise run set-version 0.1.0
99+
```
100+
101+
### Development Workflow
102+
103+
1. **Setup environment** (first time only):
104+
105+
```bash
106+
mise install
107+
```
108+
109+
2. **Before making changes**:
110+
111+
```bash
112+
# Format and check code
113+
mise run format
114+
mise run lint
115+
mise run check
116+
```
117+
118+
3. **While developing**:
119+
120+
```bash
121+
# Run tests frequently
122+
mise run test
123+
124+
# Test with examples if relevant
125+
mise run run-jaeger & # Start Jaeger in background
126+
mise run run-example-axum-otlp-server
127+
```
128+
129+
4. **Before submitting PR**:
130+
```bash
131+
# Full validation
132+
mise run format
133+
mise run lint
134+
mise run check
135+
mise run test
136+
mise run deny
137+
```
138+
139+
### Testing with OpenTelemetry
140+
141+
#### Local Jaeger Setup
142+
143+
```bash
144+
# Start Jaeger (runs on various ports including 16686 for UI, 4317/4318 for OTLP)
145+
mise run run-jaeger
146+
147+
# Open Jaeger UI
148+
open http://localhost:16686
149+
```
150+
151+
#### Running Examples
152+
153+
```bash
154+
# Terminal 1: Start Jaeger
155+
mise run run-jaeger
156+
157+
# Terminal 2: Start example server
158+
mise run run-example-axum-otlp-server
159+
160+
# Terminal 3: Send requests and check traces
161+
mise run run-example-http-client
162+
# Then check traces in Jaeger UI at http://localhost:16686
163+
```
164+
165+
### Project Structure
166+
167+
This workspace contains several crates:
168+
169+
- **`init-tracing-opentelemetry/`**: Helpers to initialize tracing + opentelemetry
170+
- **`axum-tracing-opentelemetry/`**: Axum middlewares for tracing integration
171+
- **`tonic-tracing-opentelemetry/`**: Tonic (gRPC) middlewares for tracing
172+
- **`tracing-opentelemetry-instrumentation-sdk/`**: Core instrumentation SDK
173+
- **`fake-opentelemetry-collector/`**: Testing utilities and fake collector
174+
- **`testing-tracing-opentelemetry/`**: Test utilities
175+
- **`examples/`**: Working examples demonstrating usage
176+
177+
### Code Style & Guidelines
178+
179+
- **Formatting**: We use `rustfmt` with default settings
180+
- **Linting**: All clippy warnings must be addressed
181+
- **Testing**: Add tests for new functionality
182+
- **Documentation**: Update documentation for public APIs
183+
- **Examples**: Update examples if adding new features
184+
185+
### Continuous Integration
186+
187+
Our CI pipeline runs:
188+
189+
- `mise run check` - Feature compatibility checks
190+
- `mise run lint` - Code formatting and clippy
191+
- `mise run test` - Full test suite
192+
- `mise run deny` - Security and license checks
193+
194+
Make sure all these pass locally before submitting a PR.
195+
196+
### Common Issues & Solutions
197+
198+
#### Tool Installation Issues
199+
200+
If tools fail to install automatically:
201+
202+
```bash
203+
# Install cargo-binstall manually
204+
curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
205+
206+
# Then retry the task
207+
mise run <task-name>
208+
```
209+
210+
#### Container Runtime
211+
212+
The project supports multiple container runtimes (podman, nerdctl, docker). If you have issues:
213+
214+
```bash
215+
# Make sure one of these is installed and available
216+
which podman || which nerdctl || which docker
217+
```
218+
219+
#### Environment Variables
220+
221+
Key environment variables (already set in `.mise.toml`):
222+
223+
- `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT="http://127.0.0.1:4317"`
224+
- `OTEL_EXPORTER_OTLP_TRACES_PROTOCOL="grpc"`
225+
- `OTEL_TRACES_SAMPLER="always_on"`
226+
227+
### Getting Help
228+
229+
- Check existing [issues](https://github.com/davidB/tracing-opentelemetry-instrumentation-sdk/issues)
230+
- Review the [examples/](examples/) directory for usage patterns
231+
- Look at test files for API usage examples
232+
- Open a new issue for bugs or feature requests
233+
234+
### Submitting Changes
235+
236+
1. Fork the repository
237+
2. Create a feature branch: `git checkout -b feature/my-new-feature`
238+
3. Make your changes following the guidelines above
239+
4. Run the full test suite: `mise run lint && mise run test && mise run deny`
240+
5. Commit with descriptive messages
241+
6. Push to your fork and submit a pull request
242+
243+
Thank you for contributing!

0 commit comments

Comments
 (0)