-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OTEL flow run context propagation with Labels #16122
OTEL flow run context propagation with Labels #16122
Conversation
CodSpeed Performance ReportMerging #16122 will not alter performanceComparing Summary
|
4a563c1
to
d435acd
Compare
d435acd
to
6bc104a
Compare
…o-standard-client
…o-standard-client
…o-standard-client
…o-standard-client
…o-standard-client
…/cloud-734-move-update_flow_run_labels-to-standard-client
…o-standard-client
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a couple comments to start
…client' of https://github.com/PrefectHQ/prefect into jean/cloud-734-move-update_flow_run_labels-to-standard-client
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looking pretty good! one more comment
…o-standard-client
…client' of https://github.com/PrefectHQ/prefect into jean/cloud-734-move-update_flow_run_labels-to-standard-client
…o-standard-client
@@ -2094,3 +2094,84 @@ def a_slow_flow(): | |||
"exception.escaped": "False", | |||
}, | |||
) | |||
|
|||
async def test_flow_run_propagates_otel_traceparent_to_subflow( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be worthwhile to parameterize this with a sync and async flow now that the engine is split.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have it done in an upstream PR #16233
assert child_span.context and parent_span.context | ||
assert child_span.context.trace_id == parent_span.context.trace_id | ||
|
||
async def test_flow_run_creates_and_stores_otel_traceparent( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be worthwhile to parameterize this with a sync and async flow now that the engine is split.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
…o-standard-client
…client' of https://github.com/PrefectHQ/prefect into jean/cloud-734-move-update_flow_run_labels-to-standard-client
…/cloud-734-move-update_flow_run_labels-to-standard-client
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two small requests on the orchestration client changes, but otherwise LGTM!
src/prefect/client/orchestration.py
Outdated
async def update_flow_run_labels( | ||
self, flow_run_id: UUID, labels: KeyValueLabelsField | ||
) -> httpx.Response: | ||
""" | ||
Updates the labels of a flow run. | ||
""" | ||
|
||
response = await self._client.patch( | ||
f"/flow_runs/{flow_run_id}/labels", json=labels | ||
) | ||
response.raise_for_status() | ||
return response |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's not return the response from here since it looks like it isn't needed.
async def update_flow_run_labels( | |
self, flow_run_id: UUID, labels: KeyValueLabelsField | |
) -> httpx.Response: | |
""" | |
Updates the labels of a flow run. | |
""" | |
response = await self._client.patch( | |
f"/flow_runs/{flow_run_id}/labels", json=labels | |
) | |
response.raise_for_status() | |
return response | |
async def update_flow_run_labels( | |
self, flow_run_id: UUID, labels: KeyValueLabelsField | |
) -> None: | |
""" | |
Updates the labels of a flow run. | |
""" | |
response = await self._client.patch( | |
f"/flow_runs/{flow_run_id}/labels", json=labels | |
) | |
response.raise_for_status() |
src/prefect/client/orchestration.py
Outdated
def update_flow_run_labels( | ||
self, flow_run_id: UUID, labels: KeyValueLabelsField | ||
) -> httpx.Response: | ||
""" | ||
Updates the labels of a flow run. | ||
""" | ||
response = self._client.patch( | ||
f"/flow_runs/{flow_run_id}/labels", | ||
json=labels, | ||
) | ||
response.raise_for_status() | ||
return response |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto
def update_flow_run_labels( | |
self, flow_run_id: UUID, labels: KeyValueLabelsField | |
) -> httpx.Response: | |
""" | |
Updates the labels of a flow run. | |
""" | |
response = self._client.patch( | |
f"/flow_runs/{flow_run_id}/labels", | |
json=labels, | |
) | |
response.raise_for_status() | |
return response | |
def update_flow_run_labels( | |
self, flow_run_id: UUID, labels: KeyValueLabelsField | |
) -> None: | |
""" | |
Updates the labels of a flow run. | |
""" | |
response = self._client.patch( | |
f"/flow_runs/{flow_run_id}/labels", | |
json=labels, | |
) | |
response.raise_for_status() |
This PR adds OTEL context propagation when
__OTEL_TRACEPARENTS
are found in a parent flow run. It also adds a way to update flow run labels withupdate_flow_run_labels
. This is so that if no__OTEL_TRACEPARENT
is found we can update the label with the newly created span's context.Checklist
<link to issue>
"mint.json
.