From 456e7b1e212c401ecc344c5e0ea0037e501003ab Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 5 Aug 2025 05:06:34 +0000 Subject: [PATCH 1/4] Initial plan From 56376b13cb07003143f3009d240cc3c7035dfc3a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 5 Aug 2025 05:15:34 +0000 Subject: [PATCH 2/4] Add GitHub Copilot repository instructions - Create .github/copilot-instructions.md file following GitHub's documentation - Include required clippy, rustfmt, and cargo check instructions - Add comprehensive guidance for OpenTelemetry Rust development including: - Workspace structure and multi-crate considerations - Feature flags and experimental features - Code standards and MSRV requirements - Build requirements including protoc dependency - Testing and validation practices - OpenTelemetry-specific patterns and conventions Co-authored-by: cijothomas <5232798+cijothomas@users.noreply.github.com> --- .github/copilot-instructions.md | 62 +++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 .github/copilot-instructions.md diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md new file mode 100644 index 0000000000..af18dbeebd --- /dev/null +++ b/.github/copilot-instructions.md @@ -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: Environment variables > compile-time config +- 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.) \ No newline at end of file From 54706cc806e4474444befcd376fdbb57ef10647e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 5 Aug 2025 18:22:42 +0000 Subject: [PATCH 3/4] fix: Correct configuration priority order - code over env vars Co-authored-by: cijothomas <5232798+cijothomas@users.noreply.github.com> --- .github/copilot-instructions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index af18dbeebd..da6821c2c0 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -45,7 +45,7 @@ When making changes, consider the impact across the entire workspace. - Follow the OpenTelemetry specification - Prioritize functionality over structural compliance with spec - Use Rust idioms rather than forcing spec API patterns -- Configuration priority: Environment variables > compile-time config +- Configuration priority: compile-time config > Environment variables - Use `#[cfg(feature = "otel_unstable")]` for experimental features ## Build Requirements From dcdeb96f027e2d3d097a45b0df2d4f5adcfd5765 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 5 Aug 2025 18:38:59 +0000 Subject: [PATCH 4/4] docs: Update development workflow guidance for individual crates Co-authored-by: cijothomas <5232798+cijothomas@users.noreply.github.com> --- .github/copilot-instructions.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index da6821c2c0..df16d1f979 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -9,10 +9,15 @@ This repository contains the OpenTelemetry implementation for Rust. When working - Run `cargo fmt --all` to format code consistently - Run `cargo check --workspace` to verify compilation -2. **Use the provided development scripts:** +2. **For individual crate development:** + - Use `cargo build`, `cargo test`, `cargo clippy` within specific crates for focused development + - This is more efficient when working on features for a single crate + +3. **Use the provided scripts for final validation:** - 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 + - These scripts run in CI, so use them as final checks rather than with each change ## Workspace Structure