Skip to content

Commit

Permalink
[Bugfix] Fix missing otel_trace_id in FlowRunInfo.otel_trace_id (#3013)
Browse files Browse the repository at this point in the history
# Description

Currently, the otel_trace_id is not assigned in FlowRunInfo.deserialize.
In multi-container scenarios, the otel_trace_id will be missing.

# All Promptflow Contribution checklist:
- [ ] **The pull request does not introduce [breaking changes].**
- [ ] **CHANGELOG is updated for new features, bug fixes or other
significant changes.**
- [ ] **I have read the [contribution guidelines](../CONTRIBUTING.md).**
- [ ] **Create an issue and link to the pull request to get dedicated
review from promptflow team. Learn more: [suggested
workflow](../CONTRIBUTING.md#suggested-workflow).**

## General Guidelines and Best Practices
- [ ] Title of the pull request is clear and informative.
- [ ] There are a small number of commits, each of which have an
informative message. This means that previously merged commits do not
appear in the history of the PR. For more information on cleaning up the
commits in your PR, [see this
page](https://github.com/Azure/azure-powershell/blob/master/documentation/development-docs/cleaning-up-commits.md).

### Testing Guidelines
- [ ] Pull request includes test coverage for the included changes.

---------

Co-authored-by: Yangtong Xu <[email protected]>
  • Loading branch information
riddlexu and Yangtong Xu authored Apr 26, 2024
1 parent 4560eea commit 5c510d5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/promptflow-core/promptflow/contracts/run_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ def deserialize(data: dict) -> "FlowRunInfo":
system_metrics=data.get("system_metrics", None),
result=data.get("result", None),
upload_metrics=data.get("upload_metrics", False),
otel_trace_id=data.get("otel_trace_id", ""),
message_format=data.get("message_format", MessageFormatType.BASIC),
)
return flow_run_info
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ def test_deserialize(self):
"system_metrics": {"duration": "00:00:00.0154544", "total_tokens": 0},
"result": {"answer": "Hello world: What's promptflow?"},
"upload_metrics": False,
"otel_trace_id": "test_otel_trace_id",
}
flow_run_info = FlowRunInfo.deserialize(flow_run_info_dict)
assert flow_run_info.index == 0
Expand All @@ -134,3 +135,4 @@ def test_deserialize(self):
assert flow_run_info.api_calls is None
assert flow_run_info.system_metrics == {"duration": "00:00:00.0154544", "total_tokens": 0}
assert flow_run_info.output == {"answer": "Hello world: What's promptflow?"}
assert flow_run_info.otel_trace_id == "test_otel_trace_id"

0 comments on commit 5c510d5

Please sign in to comment.