Repository navigation
[Bundle] Track complexity - #5926
Open
Fernando Henrique Inocêncio Borba Ferreira (fhibf) wants to merge 15 commits into
Open
Fernando Henrique Inocêncio Borba Ferreira (fhibf) wants to merge 15 commits into
Fernando Henrique Inocêncio Borba Ferreira (fhibf) wants to merge 15 commits into
Conversation
Fernando Henrique Inocêncio Borba Ferreira (fhibf)
requested a review
from a team
as a code owner
October 15, 2026 20:46
Fernando Henrique Inocêncio Borba Ferreira (fhibf)
and others
added 8 commits
October 15, 2026 17:31
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Fernando Henrique Inocêncio Borba Ferreira (fhibf)
requested a balanced review from Copilot
October 16, 2026 16:22
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The calculator tests contain a compilation error, empty payload fixtures, and incorrect boundary inputs.
4 open findings
What changed in this PR
Adds bundle complexity tracking to Microsoft FHIR Server’s processing statistics and latency metrics.
Changes:
- Calculates complexity from operation counts, execution mode, and payload sizes.
- Moves latency emission into the bundle handler and adds a complexity dimension.
- Adds calculator tests and updates existing metric assertions.
| File | Description |
|---|---|
| src/Microsoft.Health.Fhir.Shared.Api/Microsoft.Health.Fhir.Shared.Api.projitems | Registers new bundle classes; removes metric filter. |
| src/Microsoft.Health.Fhir.Shared.Api/Features/Resources/Bundle/BundleHandlerStatistics.cs | Includes complexity in statistics. |
| src/Microsoft.Health.Fhir.Shared.Api/Features/Resources/Bundle/BundleHandlerParallelOperations.cs | Uses extracted execution context. |
| src/Microsoft.Health.Fhir.Shared.Api/Features/Resources/Bundle/BundleHandlerInternalOperationExecutionContext.cs | Extracts operation context into a class. |
| src/Microsoft.Health.Fhir.Shared.Api/Features/Resources/Bundle/BundleHandlerComplexityCalculator.cs | Implements complexity scoring. |
| src/Microsoft.Health.Fhir.Shared.Api/Features/Resources/Bundle/BundleHandler.cs | Calculates complexity and emits latency. |
| src/Microsoft.Health.Fhir.Shared.Api/Features/Filters/Metrics/BundleEndpointMetricEmitterAttribute.cs | Removes endpoint latency filter. |
| src/Microsoft.Health.Fhir.Shared.Api/Controllers/FhirController.cs | Removes bundle metric attribute. |
| src/Microsoft.Health.Fhir.Shared.Api.UnitTests/Microsoft.Health.Fhir.Shared.Api.UnitTests.projitems | Registers calculator and relocated tests. |
| src/Microsoft.Health.Fhir.Shared.Api.UnitTests/Features/Resources/Bundle/FhirTransactionFailedExceptionTests.cs | Relocates transaction exception tests. |
| src/Microsoft.Health.Fhir.Shared.Api.UnitTests/Features/Resources/Bundle/BundleHandlerTests.cs | Checks handler latency emission. |
| src/Microsoft.Health.Fhir.Shared.Api.UnitTests/Features/Resources/Bundle/BundleHandlerStatisticsTests.cs | Supplies complexity to statistics. |
| src/Microsoft.Health.Fhir.Shared.Api.UnitTests/Features/Resources/Bundle/BundleHandlerComplexityCalculatorTests.cs | Adds scoring and boundary tests. |
| src/Microsoft.Health.Fhir.Shared.Api.UnitTests/Features/Filters/Metrics/MetricEmitterAttributeTests.cs | Removes obsolete bundle filter test. |
| src/Microsoft.Health.Fhir.Shared.Api.UnitTests/Controllers/FhirControllerTests.cs | Removes obsolete attribute assertion. |
| src/Microsoft.Health.Fhir.Core/Models/BundleComplexity.cs | Defines four complexity levels. |
| src/Microsoft.Health.Fhir.Core/Logging/Metrics/Handlers/DefaultBundleMetricHandler.cs | Tags latency measurements with complexity. |
| src/Microsoft.Health.Fhir.Core/Logging/Metrics/BundleMetricNotification.cs | Adds complexity and validates elapsed time. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
New tests to validate profile refreshes.
Abigail Nicolas (abiisnn)
previously approved these changes
Oct 16, 2026
Mikael Weaver (mikaelweave)
approved these changes
Oct 16, 2026
| _profilesResolver, | ||
| _logger); | ||
| } | ||
| catch (InvalidOperationException e) |
Contributor
There was a problem hiding this comment.
nit - could combine the exception statements as the message is the same.
Fernando Henrique Inocêncio Borba Ferreira (fhibf)
enabled auto-merge (squash)
October 16, 2026 22:26
Contributor
Author
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

Description
Tracking the complexity of bundles with BundleHandlerComplexyCalculator. Different aspects of bundles are considered as part of the complexity calculation.
Additionally, this complexity is now included as part of the latency metric (as a dimension).
Other changes I've made:
Related issues
Addresses AB#209754.
Testing
Describe how this change was tested.
FHIR Team Checklist
Semver Change (docs)
Patch|Skip|Feature|Breaking (reason)