feat: Add support to set partition key and headers via Request Context#3678
Conversation
…to message when using default mapper
…parent, baggage headers & trace state
There was a problem hiding this comment.
Gates Failed
Enforce advisory code health rules
(1 file with Complex Method)
Gates Passed
3 Quality Gates Passed
See analysis details in CodeScene
Reason for failure
| Enforce advisory code health rules | Violations | Code Health Impact | |
|---|---|---|---|
| CloudEventJsonMessageMapper.cs | 1 advisory rule | 10.00 → 9.69 | Suppress |
Quality Gate Profile: Clean Code Collective
Want more control? Customize Code Health rules or catch issues early with our IDE extension and CLI tool.
iancooper
left a comment
There was a problem hiding this comment.
I have some questions here. We already have a Span associated with the Context. We should be obtaining this information from the span associated with the context when we send it. Our context's span should inherit from any parent span it was created with.
We propagate the context in the BrighterTracer WriteProducerEvent where we call our customer propagator to fill the values in the message header.
I am wondering if this misses that context
There was a problem hiding this comment.
Code Health Improved
(1 files improve in Code Health)
Gates Failed
Enforce advisory code health rules
(1 file with Complex Conditional)
Gates Passed
3 Quality Gates Passed
See analysis details in CodeScene
Reason for failure
| Enforce advisory code health rules | Violations | Code Health Impact | |
|---|---|---|---|
| RequestContextExtensions.cs | 1 advisory rule | 10.00 → 9.39 | Suppress |
View Improvements
| File | Code Health Impact | Categories Improved |
|---|---|---|
| CloudEventsTransformer.cs | 8.92 → 9.69 | Complex Method, Overall Code Complexity |
Quality Gate Profile: Clean Code Collective
Want more control? Customize Code Health rules or catch issues early with our IDE extension and CLI tool.
| if (context != null | ||
| && context.Bag.TryGetValue(RequestContextBagNames.Headers, out var tmp) | ||
| && tmp is Dictionary<string, object> headers) |
There was a problem hiding this comment.
❌ New issue: Complex Conditional
GetHeaders has 1 complex conditionals with 2 branches, threshold = 2
| if (context != null | ||
| && context.Bag.TryGetValue(RequestContextBagNames.CloudEventsAdditionalProperties, out var tmp) | ||
| && tmp is Dictionary<string, object> cloudEventAdditionalProperties) |
There was a problem hiding this comment.
❌ New issue: Complex Conditional
GetCloudEventAdditionalProperties has 1 complex conditionals with 2 branches, threshold = 2
BrighterCommand#3678) * feat: Allow flow PartitionKey/Headers/TraceParent/TraceState/Baggage to message when using default mapper * feat: Change MassTransit and JustSaying to flow partition key, trace parent, baggage headers & trace state * fix build * feat: Remove Trace Parent/State and Baggage, also add DefaultHeaders for Publication and use RequestContext Bag
Add support to set Partition Key and Headers via Request Context
fix: #3662