Skip to content

Commit f283f82

Browse files
committed
initial commit
1 parent efa6321 commit f283f82

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

azure/durable_functions/models/DurableOrchestrationClient.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ def __init__(self, context: str):
4747
async def start_new(self,
4848
orchestration_function_name: str,
4949
instance_id: Optional[str] = None,
50-
client_input: Optional[Any] = None) -> str:
50+
client_input: Optional[Any] = None,
51+
trace_parent: str = None,
52+
trace_state: str = None) -> str:
5153
"""Start a new instance of the specified orchestrator function.
5254
5355
If an orchestration instance with the specified ID already exists, the
@@ -72,7 +74,10 @@ async def start_new(self,
7274
instance_id=instance_id, orchestration_function_name=orchestration_function_name)
7375

7476
response: List[Any] = await self._post_async_request(
75-
request_url, self._get_json_input(client_input))
77+
request_url,
78+
self._get_json_input(client_input),
79+
trace_parent,
80+
trace_state)
7681

7782
status_code: int = response[0]
7883
if status_code <= 202 and response[1]:

azure/durable_functions/models/utils/http_utils.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import aiohttp
44

55

6-
async def post_async_request(url: str, data: Any = None) -> List[Union[int, Any]]:
6+
async def post_async_request(url: str, data: Any = None, trace_parent: str = None, trace_state: str = None) -> List[Union[int, Any]]:
77
"""Post request with the data provided to the url provided.
88
99
Parameters
@@ -20,7 +20,11 @@ async def post_async_request(url: str, data: Any = None) -> List[Union[int, Any]
2020
"""
2121
async with aiohttp.ClientSession() as session:
2222
async with session.post(url,
23-
json=data) as response:
23+
json=data,
24+
headers={
25+
"traceparent": trace_parent,
26+
"tracestate": trace_state
27+
}) as response:
2428
# We disable aiohttp's input type validation
2529
# as the server may respond with alternative
2630
# data encodings. This is potentially unsafe.

0 commit comments

Comments
 (0)