Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Align Cloud Trace JSON Format with OpenTelemetry Standards (#2946)
# Description This pull request updates the Cloud Trace JSON serialization to align with the OpenTelemetry (OTel) standards. By modifying the dictionary structure used in the `ReadableSpan.to_json` method, we ensure consistency with OTel's implementation, enhancing interoperability and the developer experience. The changes are in accordance with the format specified in the OTel documentation. The appended 'Z' in the timestamp represents the UTC timezone, aligning with the `ReadableSpan.to_json` implementation that reflects timezone information in Cloud Trace JSON. ## Sample JSON Change Remove irrelevant field and align format ```diff { "name": "python_tool_with_simple_image", "context": { "trace_id": "d86d8adc5f7a30e87a621e6a806da4cf", "span_id": "260f4226117b9403", "trace_state": "" }, "kind": 1, - "start_time": "2024-04-11T09:22:46.841063", - "end_time": "2024-04-11T09:22:46.870394", + "start_time": "2024-04-11T09:22:46.841063Z", + "end_time": "2024-04-11T09:22:46.870394Z", "status": { "status_code": "Ok", "description": "" }, "attributes": { "framework": "promptflow", "span_type": "Flow", "line_run_id": "dbcca243-9984-4ccd-a008-32d298728e2e", "inputs": "{\n \"image\": \"logo.jpg\"\n}", "output": "..." }, "events": [ { "name": "promptflow.function.inputs", - "timestamp": "2024-04-11T09:22:46.841063", + "timestamp": "2024-04-11T09:22:46.841063Z", "attributes": { "payload": "{\n \"image\": \"logo.jpg\"\n}" } }, { "name": "promptflow.function.output", - "timestamp": "2024-04-11T09:22:46.870394", + "timestamp": "2024-04-11T09:22:46.870394Z", "attributes": { "payload": "..." } } ], "resource": { "attributes": { "service.name": "promptflow", "subscription.id": [REDACT], "resource_group.name": "promptflow", "workspace.name": "promptflow-canary-dev", "collection": "default" }, "schema_url": "" }, - "partition_key": "default_3a284a00-1f34-4159-889c-c5eabfa2a896", - "collection_id": "default_3a284a00-1f34-4159-889c-c5eabfa2a896", - "id": "260f4226117b9403", - "created_by": { - "object_id": [REDACT], - "tenant_id": [REDACT], - "name": "Cheng Liu" - } } ``` # All Promptflow Contribution checklist: - [X] **The pull request does not introduce [breaking changes].** - [ ] **CHANGELOG is updated for new features, bug fixes or other significant changes.** - [X] **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 - [X] Title of the pull request is clear and informative. - [X] 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 - [X] Pull request includes test coverage for the included changes.
- Loading branch information