Skip to content

Commit

Permalink
feat: add condition for context propagation implementation
Browse files Browse the repository at this point in the history
Signed-off-by: Lukas Reining <lukas.reining@codecentric.de>
  • Loading branch information
lukas-reining committed Jan 31, 2024
1 parent c6e7064 commit 7fcf7e6
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 13 deletions.
26 changes: 17 additions & 9 deletions specification.json
Original file line number Diff line number Diff line change
Expand Up @@ -574,27 +574,35 @@
{
"id": "Conditional Requirement 3.3.1.1",
"machine_id": "conditional_requirement_3_3_1_1",
"content": "The API MUST have a method for setting a `transaction context propagator`.",
"RFC 2119 keyword": "MUST",
"content": "The API SHOULD have a method for setting a `transaction context propagator`.",
"RFC 2119 keyword": "SHOULD",
"children": []
},
}
]
},
{
"id": "Condition 3.3.1.2",
"machine_id": "condition_3_3_1_2",
"content": "The SDK implements context propagation.",
"RFC 2119 keyword": null,
"children": [
{
"id": "Conditional Requirement 3.3.1.2",
"machine_id": "conditional_requirement_3_3_1_2",
"id": "Conditional Requirement 3.3.1.2.1",
"machine_id": "conditional_requirement_3_3_1_2_1",
"content": "The API MUST have a method for setting the `evaluation context` of the `transaction context propagator` for the current transaction.",
"RFC 2119 keyword": "MUST",
"children": []
},
{
"id": "Conditional Requirement 3.3.1.3",
"machine_id": "conditional_requirement_3_3_1_3",
"id": "Conditional Requirement 3.3.1.2.2",
"machine_id": "conditional_requirement_3_3_1_2_2",
"content": "A `transaction context propagator` MUST have a method for setting the `evaluation context` of the current transaction.",
"RFC 2119 keyword": "MUST",
"children": []
},
{
"id": "Conditional Requirement 3.3.1.4",
"machine_id": "conditional_requirement_3_3_1_4",
"id": "Conditional Requirement 3.3.1.2.3",
"machine_id": "conditional_requirement_3_3_1_2_3",
"content": "A `transaction context propagator` MUST have a method for getting the `evaluation context` of the current transaction.",
"RFC 2119 keyword": "MUST",
"children": []
Expand Down
14 changes: 10 additions & 4 deletions specification/sections/03-evaluation-context.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,26 +175,32 @@ see: [dynamic-context paradigm](../glossary.md#dynamic-context-paradigm)

##### Conditional Requirement 3.3.1.1

> The API **MUST** have a method for setting a `transaction context propagator`.
> The API **SHOULD** have a method for setting a `transaction context propagator`.
If there already is a `transaction context propagator`, it is replaced with the new one.

##### Conditional Requirement 3.3.1.2
#### Condition 3.3.1.2

> The SDK implements context propagation.
A language may not have any applicable way of implementing `transaction context propagation` so the language SDK might not implement context propagation.

##### Conditional Requirement 3.3.1.2.1

> The API **MUST** have a method for setting the `evaluation context` of the `transaction context propagator` for the current transaction.
If a `transaction context propagator` is set, the SDK will call the [method defined in 3.3.1.3](#conditional-requirement-3313) with this `evaluation context` and so this `evaluation context` will be available during the current transaction.
If no `transaction context propagator` is set, this `evaluation context` is not used for evaluations.
This method then can be used for example in a request handler to add request-specific information to the `evaluation context`.

##### Conditional Requirement 3.3.1.3
##### Conditional Requirement 3.3.1.2.2

> A `transaction context propagator` **MUST** have a method for setting the `evaluation context` of the current transaction.
A `transaction context propagator` is responsible for persisting context for the duration of a single transaction.
Typically, a transaction context propagator will propagate the context using a language-specific carrier such as [ThreadLocal (Java)](https://docs.oracle.com/javase/8/docs/api/java/lang/ThreadLocal.html), [async hooks (Node.js)](https://nodejs.org/api/async_hooks.html), [Context (Go)](https://pkg.go.dev/context) or another similar mechanism.

##### Conditional Requirement 3.3.1.4
##### Conditional Requirement 3.3.1.2.3

> A `transaction context propagator` **MUST** have a method for getting the `evaluation context` of the current transaction.
Expand Down

0 comments on commit 7fcf7e6

Please sign in to comment.