Skip to content

Conversation

@nikhilmantri0902
Copy link
Contributor

Fixes #3152
Design discussion issue (if applicable) #

Changes

Update OTLP exporter to fill the relevant bits in SpanFlags.

Merge requirement checklist

  • CONTRIBUTING guidelines followed
  • Unit tests added/updated (if applicable)
  • Appropriate CHANGELOG.md files updated for non-trivial, user-facing changes
  • Changes in public API reviewed (if applicable)

@nikhilmantri0902 nikhilmantri0902 requested a review from a team as a code owner September 7, 2025 05:12
@nikhilmantri0902 nikhilmantri0902 changed the title Feat: Add is_remote flag in exporter for spans and span links feat: Add is_remote flag in exporter for spans and span links Sep 7, 2025
@codecov
Copy link

codecov bot commented Sep 7, 2025

Codecov Report

❌ Patch coverage is 92.78351% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.7%. Comparing base (6f75c58) to head (54a69b4).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
opentelemetry-proto/src/transform/trace.rs 91.9% 7 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff          @@
##            main   #3153   +/-   ##
=====================================
  Coverage   80.6%   80.7%           
=====================================
  Files        126     126           
  Lines      22195   22286   +91     
=====================================
+ Hits       17898   17986   +88     
- Misses      4297    4300    +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@lalitb lalitb requested a review from Copilot September 8, 2025 18:52
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Implements span flags support for the isRemote property in the OTLP exporter as specified in issue #3152. This change enables proper setting of OTLP span flags based on whether the parent span context is remote or local.

  • Added parent_span_context field to SpanData structures to store parent span context information
  • Implemented build_span_flags function to set appropriate flags (0x100 for local, 0x300 for remote spans)
  • Updated all span creation sites to include the new field and comprehensive test coverage

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.

Show a summary per file
File Description
opentelemetry-sdk/src/trace/export.rs Added parent_span_context field to public SpanData struct
opentelemetry-sdk/src/trace/span.rs Added field to internal SpanData and updated export data building
opentelemetry-sdk/src/trace/tracer.rs Populated parent_span_context field during span creation
opentelemetry-proto/src/transform/trace.rs Implemented build_span_flags function and updated span/link transformations
opentelemetry-zipkin/src/exporter/model/span.rs Updated test data with new field
opentelemetry-sdk/src/trace/span_processor.rs Updated test span data creation
opentelemetry-sdk/src/testing/trace/span_exporters.rs Updated test helper function
opentelemetry-sdk/benches/batch_span_processor.rs Updated benchmark span data
opentelemetry-otlp/src/exporter/http/mod.rs Updated test span data
opentelemetry-sdk/CHANGELOG.md Documented the new feature
opentelemetry-proto/CHANGELOG.md Documented the transformation changes

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

- Replace Option<SpanContext> with bool for parent_span_is_remote field
- Eliminates unnecessary cloning of SpanContext objects
- More efficient memory usage and cleaner API
- Updated build_span_flags function to accept boolean parameter
- Updated all test files to use new boolean field
- Maintains same functionality with better performance

Addresses reviewer feedback for more efficient implementation.
- Put function parameters on single line to match rustfmt requirements
- Fixes linting error in CI
- Remove unused local_parent and remote_parent variables
- These were left over from the refactoring to use boolean parameters
- Fixes compilation errors in CI
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Add is_remote flag in exporter for spans and span links

2 participants