-
Notifications
You must be signed in to change notification settings - Fork 558
Add GitHub Copilot repository instructions with development workflow guidance #3118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
Copilot
wants to merge
5
commits into
main
Choose a base branch
from
copilot/fix-3117
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
456e7b1
Initial plan
Copilot 56376b1
Add GitHub Copilot repository instructions
Copilot 787d9f6
Merge branch 'main' into copilot/fix-3117
cijothomas 54706cc
fix: Correct configuration priority order - code over env vars
Copilot dcdeb96
docs: Update development workflow guidance for individual crates
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# OpenTelemetry Rust Copilot Instructions | ||
|
||
This repository contains the OpenTelemetry implementation for Rust. When working with this codebase, please follow these guidelines: | ||
|
||
## Development Tools and Commands | ||
|
||
1. **Use clippy, rustfmt, and cargo check regularly.** | ||
- Run `cargo clippy --workspace --all-targets --all-features` for comprehensive linting | ||
- Run `cargo fmt --all` to format code consistently | ||
- Run `cargo check --workspace` to verify compilation | ||
|
||
2. **Use the provided development scripts:** | ||
- Run `./scripts/precommit.sh` before committing (runs format, lint, and test) | ||
- Run `./scripts/lint.sh` for comprehensive linting across all features | ||
- Run `./scripts/test.sh` for running tests | ||
|
||
## Workspace Structure | ||
|
||
This is a Cargo workspace containing multiple crates: | ||
- `opentelemetry` - Core API crate | ||
- `opentelemetry-sdk` - SDK implementation | ||
- `opentelemetry-otlp` - OTLP exporter | ||
- `opentelemetry-stdout` - Stdout exporter | ||
- And many more specialized crates | ||
|
||
When making changes, consider the impact across the entire workspace. | ||
|
||
## Feature Flags and Compilation | ||
|
||
- This codebase uses extensive feature flags for signals (`traces`, `metrics`, `logs`) | ||
- Experimental features are behind the `otel_unstable` feature flag | ||
- Use `cargo hack --each-feature` to test across feature combinations | ||
- Some crates like `opentelemetry-prometheus` are outside the main workspace | ||
|
||
## Code Standards | ||
|
||
- **MSRV**: Minimum Supported Rust Version is 1.75 | ||
- **Error Handling**: Wrap errors in signal-specific types (`TraceError`, `MetricError`, `LogsError`) | ||
- **Commits**: Use conventional commit format (e.g., `feat:`, `fix:`, `docs:`) | ||
- **Testing**: Run `cargo test --workspace` for comprehensive testing | ||
- **Documentation**: Include examples in documentation and maintain README files | ||
|
||
## OpenTelemetry Specifics | ||
|
||
- Follow the OpenTelemetry specification | ||
- Prioritize functionality over structural compliance with spec | ||
- Use Rust idioms rather than forcing spec API patterns | ||
- Configuration priority: compile-time config > Environment variables | ||
- Use `#[cfg(feature = "otel_unstable")]` for experimental features | ||
|
||
## Build Requirements | ||
|
||
- For `opentelemetry-otlp`: Requires `protoc` (Protocol Buffers compiler) | ||
- Clone with submodules: `git clone --recurse-submodule` | ||
- Set `PROTOC` environment variable if needed: `export PROTOC=$(which protoc)` | ||
|
||
## Testing and Validation | ||
|
||
- Run benchmarks with `cargo bench` for performance-sensitive changes | ||
- Test examples in the `examples/` directory to ensure they work | ||
- Validate changes don't break existing behavior across workspace | ||
- Consider impact on different runtime features (`rt-tokio`, etc.) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot perhaps its easier to just do cargo build/test from the individual crate when working on features for that crate alone. and scripts are anyway run in CI checks, but they can used for a final check, not something to do with each change etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated the development workflow guidance to emphasize individual crate commands for focused development and position the scripts as final validation tools. Changes committed in dcdeb96.