Skip to content

[Instana] Support configuration with code#4153

Merged
martincostello merged 16 commits intoopen-telemetry:mainfrom
martincostello:add-instana-options
Apr 27, 2026
Merged

[Instana] Support configuration with code#4153
martincostello merged 16 commits intoopen-telemetry:mainfrom
martincostello:add-instana-options

Conversation

@martincostello
Copy link
Copy Markdown
Member

@martincostello martincostello commented Apr 18, 2026

Changes

  • Add support for configuring with options class like other exporters.
  • Add net8.0 and net10.0 TFMs.
  • Use modern C# features.
  • Add support for custom HttpClient creation.
  • Remove redundant code.
  • Extend assertions to verify JSON payloads.
  • Fix most StyleCop warnings.
  • Replace Newtonsoft.Json in tests with System.Text.Json.

Merge requirement checklist

  • CONTRIBUTING guidelines followed (license requirements, nullable enabled, static analysis, etc.)
  • Unit tests added/updated
  • Appropriate CHANGELOG.md files updated for non-trivial changes
  • Changes in public API reviewed (if applicable)

@github-actions github-actions Bot added comp:exporter.influxdb Things related to OpenTelemetry.Exporter.InfluxDB comp:exporter.instana Things related to OpenTelemetry.Instrumentation.Instana labels Apr 18, 2026
Comment thread src/OpenTelemetry.Exporter.Instana/CHANGELOG.md Outdated
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 18, 2026

Codecov Report

❌ Patch coverage is 94.20290% with 20 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.31%. Comparing base (9b07906) to head (3e710bb).
⚠️ Report is 41 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...lementation/Processors/DefaultActivityProcessor.cs 70.83% 7 Missing ⚠️
...metry.Exporter.Instana/Implementation/Transport.cs 86.79% 7 Missing ⚠️
...ry.Exporter.InfluxDB/InfluxDBExporterExtensions.cs 66.66% 2 Missing ⚠️
...er.Instana/Implementation/InstanaSpanSerializer.cs 97.82% 2 Missing ⚠️
...stana/Implementation/InstanaExporterEventSource.cs 0.00% 1 Missing ⚠️
...xporter.Instana/TracerProviderBuilderExtensions.cs 96.29% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #4153      +/-   ##
==========================================
+ Coverage   73.71%   74.31%   +0.59%     
==========================================
  Files         467      457      -10     
  Lines       18362    18252     -110     
==========================================
+ Hits        13536    13564      +28     
+ Misses       4826     4688     -138     
Flag Coverage Δ
unittests-Exporter.InfluxDB 95.81% <66.66%> (ø)
unittests-Exporter.Instana 91.89% <94.69%> (+17.03%) ⬆️
unittests-Instrumentation.Cassandra ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...try.Exporter.Instana/Implementation/InstanaSpan.cs 100.00% <100.00%> (ø)
...orter.Instana/Implementation/InstanaSpanFactory.cs 100.00% <100.00%> (ø)
...Instana/Implementation/InstanaSpanTransformInfo.cs 100.00% <100.00%> (ø)
...Implementation/Processors/ActivityProcessorBase.cs 100.00% <100.00%> (+8.33%) ⬆️
...mplementation/Processors/ErrorActivityProcessor.cs 100.00% <100.00%> (ø)
...plementation/Processors/EventsActivityProcessor.cs 93.75% <100.00%> (ø)
...Implementation/Processors/TagsActivityProcessor.cs 95.00% <100.00%> (+3.69%) ⬆️
.../OpenTelemetry.Exporter.Instana/InstanaExporter.cs 100.00% <100.00%> (+4.61%) ⬆️
...lemetry.Exporter.Instana/InstanaExporterOptions.cs 100.00% <100.00%> (ø)
...stana/Implementation/InstanaExporterEventSource.cs 42.85% <0.00%> (+42.85%) ⬆️
... and 5 more

... and 23 files with indirect coverage changes

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@martincostello martincostello marked this pull request as ready for review April 18, 2026 17:33
@martincostello martincostello requested a review from a team as a code owner April 18, 2026 17:33
Copilot AI review requested due to automatic review settings April 18, 2026 17:33
Copy link
Copy Markdown
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

This PR modernizes the Instana exporter by introducing an options-based configuration model, updating target frameworks, and refactoring the export pipeline/transport while updating tests to validate JSON payloads using System.Text.Json.

Changes:

  • Added InstanaExporterOptions + AddInstanaExporter(Action<InstanaExporterOptions>) configuration and updated env-var handling.
  • Refactored export pipeline (sync processors, new SpanSender/Transport, removed sync-over-async and redundant helper abstractions).
  • Updated/expanded unit tests (new HTTP server-based tests, JSON payload assertions, migrated tests from Newtonsoft.Json).

Reviewed changes

Copilot reviewed 38 out of 38 changed files in this pull request and generated 12 comments.

Show a summary per file
File Description
test/OpenTelemetry.Exporter.Instana.Tests/TracerProviderBuilderExtensionsTests.cs Adds end-to-end tests for builder extension + env/options configuration
test/OpenTelemetry.Exporter.Instana.Tests/TestSpanSender.cs Removes old test sender abstraction
test/OpenTelemetry.Exporter.Instana.Tests/TestInstanaExporterHelper.cs Removes old helper abstraction
test/OpenTelemetry.Exporter.Instana.Tests/TestActivityProcessor.cs Removes old async processor stub
test/OpenTelemetry.Exporter.Instana.Tests/Processors/TagsActivityProcessorTests.cs Updates tests for sync processor + assertions cleanup
test/OpenTelemetry.Exporter.Instana.Tests/Processors/EventsActivityProcessorTests.cs Updates tests for sync processor + stronger assertions
test/OpenTelemetry.Exporter.Instana.Tests/Processors/ErrorActivityProcessorTests.cs Updates tests for sync processor + updated data model
test/OpenTelemetry.Exporter.Instana.Tests/Processors/DefaultActivityProcessorTests.cs Updates tests for sync processor and new data model
test/OpenTelemetry.Exporter.Instana.Tests/OpenTelemetry.Exporter.Instana.Tests.csproj Swaps test JSON dependency + links shared test infra
test/OpenTelemetry.Exporter.Instana.Tests/InstanaSpanTest.cs Migrates test JSON model to System.Text.Json attributes
test/OpenTelemetry.Exporter.Instana.Tests/InstanaSpanSerializerTests.cs Uses System.Text.Json to validate serialized payload
test/OpenTelemetry.Exporter.Instana.Tests/InstanaSpanFactoryTests.cs Updates for new span data shape (Values)
test/OpenTelemetry.Exporter.Instana.Tests/InstanaExporterTests.cs Reworks exporter tests to validate actual HTTP payload/headers
src/OpenTelemetry.Exporter.Instana/TracerProviderBuilderExtensions.cs Adds options-based exporter registration + env var config
src/OpenTelemetry.Exporter.Instana/README.md Updates docs to mention options-based configuration
src/OpenTelemetry.Exporter.Instana/OpenTelemetry.Exporter.Instana.csproj Switches to TargetFrameworksForLibraries (+ netfx on Windows)
src/OpenTelemetry.Exporter.Instana/InstanaExporterOptions.cs Introduces public options type
src/OpenTelemetry.Exporter.Instana/InstanaExporterHelper.cs Removes old helper implementation
src/OpenTelemetry.Exporter.Instana/InstanaExporterConstants.cs Renames constants + trims unused env var constants
src/OpenTelemetry.Exporter.Instana/InstanaExporter.cs Refactors exporter to use options + new sender/transport
src/OpenTelemetry.Exporter.Instana/Implementation/Transport.cs Refactors HTTP transport and batching
src/OpenTelemetry.Exporter.Instana/Implementation/SpanSender.cs New background sender loop + queue limiting
src/OpenTelemetry.Exporter.Instana/Implementation/Processors/*.cs Converts processors from async to sync + updates constants/data model usage
src/OpenTelemetry.Exporter.Instana/Implementation/Processors/IActivityProcessor.cs Changes processor contract from async to sync
src/OpenTelemetry.Exporter.Instana/Implementation/Processors/ActivityProcessorBase.cs Updates chaining logic + initializes Values
src/OpenTelemetry.Exporter.Instana/Implementation/InstanaSpanTransformInfo.cs Modernizes transform info type
src/OpenTelemetry.Exporter.Instana/Implementation/InstanaSpanSerializer.cs Refactors manual JSON serialization internals
src/OpenTelemetry.Exporter.Instana/Implementation/InstanaSpanFactory.cs Makes factory static and updates initialization
src/OpenTelemetry.Exporter.Instana/Implementation/InstanaSpan.cs Updates span/data model (Values) + modern C#
src/OpenTelemetry.Exporter.Instana/Implementation/InstanaExporterEventSource.cs Minor modernization
src/OpenTelemetry.Exporter.Instana/Implementation/ISpanSender.cs Removes old interface
src/OpenTelemetry.Exporter.Instana/IInstanaExporterHelper.cs Removes old interface
src/OpenTelemetry.Exporter.Instana/CHANGELOG.md Documents new TFMs, options support, and behavior change
src/OpenTelemetry.Exporter.Instana/.publicApi/PublicAPI.Unshipped.txt Adds new public API surface for options + builder overload
src/OpenTelemetry.Exporter.InfluxDB/InfluxDBExporterExtensions.cs Minor expression-bodied refactor

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/OpenTelemetry.Exporter.Instana/Implementation/Transport.cs
Comment thread src/OpenTelemetry.Exporter.Instana/README.md
Comment thread src/OpenTelemetry.Exporter.Instana/Implementation/SpanSender.cs Outdated
Comment thread src/OpenTelemetry.Exporter.Instana/Implementation/Transport.cs Outdated
Comment thread src/OpenTelemetry.Exporter.Instana/InstanaExporterOptions.cs
- Add support for configuring with options class.
- Add `net8.0` and `net10.0` TFMs.
- Use modern C# features.
- Support batch export limit configuration and apply limits.
- Remove sync-over-async.
- Add support for custom `HttpClient` creation.
- Remove redundant code.
- Fix InstanaExporterTests.
- Update README.
- Extend assertions to verify JSON payloads.
- Remove redundant code.
- Remove redundant mocks.
- Fix some StyleCop warnings.
Fix most StyleCop warnings and remove unused constants.
Add tests for TracerProviderBuilder extensions.
- Write literal `true` string instead of computing it.
- Fix-up comments.
- Add TODO to remove manual JSON serialization.
Use System.Text.Json in tests instead.
Add CHANGELOG entry for TFM additions.
- Suppress `CA5399`.
- Update CHANGELOG with PR number.
- Tweak some XML documentation.
Move the suppression to the right place.
Address most Copilot code review comments.
Address more Copilot feedback.
Address final piece of Copilot review feedback.
The batch exporter already runs a background task to export, so use that rather than have another one just to use async.

namespace OpenTelemetry.Exporter.Instana.Implementation;

// TODO Use a proper JSON serializer that encodes strings safely.
Copy link
Copy Markdown
Member Author

@martincostello martincostello Apr 20, 2026

Choose a reason for hiding this comment

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

I've already done the changes to resolve this in a different branch - I'll open a PR with the changes once this is merged.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@Kielek
Copy link
Copy Markdown
Member

Kielek commented Apr 21, 2026

@kirrg001, could you please take a look or find better Instana-go-to person?
It will be great if you can reach me and Martin on CNCF slack DM to discuss what is behind this change.

Copy link
Copy Markdown
Member

@Kielek Kielek left a comment

Choose a reason for hiding this comment

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

LGTMRS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp:exporter.influxdb Things related to OpenTelemetry.Exporter.InfluxDB comp:exporter.instana Things related to OpenTelemetry.Instrumentation.Instana

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants