-
Notifications
You must be signed in to change notification settings - Fork 650
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
LogRecord Produces Invalid JSON Serialization of Resource #3345
Labels
bug
Something isn't working
Comments
sernst
added a commit
to sernst/opentelemetry-python
that referenced
this issue
Jun 13, 2023
Currently, the `LogRecord.to_json` method serializes the resource object using `repr` of its attributes. This differs from how the serialization process is handled in `ReadableSpan.to_json` and `MetricsData.to_json`, which utilize the `Resource.to_json` functionality directly. Using `repr` does not produce a json-parseable output and doesn't follow the same depth of serialization as the other two signal types. Therefore, this change carries over the serialization process from the spans and metrics signal types to the logs type. Closes open-telemetry#3345
sernst
added a commit
to sernst/opentelemetry-python
that referenced
this issue
Jun 13, 2023
Currently, the `LogRecord.to_json` method serializes the resource object using `repr` of its attributes. This differs from how the serialization process is handled in `ReadableSpan.to_json` and `MetricsData.to_json`, which utilize the `Resource.to_json` functionality directly. Using `repr` does not produce a json-parseable output and doesn't follow the same depth of serialization as the other two signal types. Therefore, this change carries over the serialization process from the spans and metrics signal types to the logs type. Fixes open-telemetry#3345
sernst
added a commit
to sernst/opentelemetry-python
that referenced
this issue
Jun 13, 2023
Currently, the `LogRecord.to_json` method serializes the resource object using `repr` of its attributes. This differs from how the serialization process is handled in `ReadableSpan.to_json` and `MetricsData.to_json`, which utilize the `Resource.to_json` functionality directly. Using `repr` does not produce a json-parseable output and doesn't follow the same depth of serialization as the other two signal types. Therefore, this change carries over the serialization process from the spans and metrics signal types to the logs type. Fixes open-telemetry#3345
sernst
added a commit
to sernst/opentelemetry-python
that referenced
this issue
Jun 20, 2023
Currently, the `LogRecord.to_json` method serializes the resource object using `repr` of its attributes. This differs from how the serialization process is handled in `ReadableSpan.to_json` and `MetricsData.to_json`, which utilize the `Resource.to_json` functionality directly. Using `repr` does not produce a json-parseable output and doesn't follow the same depth of serialization as the other two signal types. Therefore, this change carries over the serialization process from the spans and metrics signal types to the logs type. Fixes open-telemetry#3345
sernst
added a commit
to sernst/opentelemetry-python
that referenced
this issue
Jul 2, 2023
Currently, the `LogRecord.to_json` method serializes the resource object using `repr` of its attributes. This differs from how the serialization process is handled in `ReadableSpan.to_json` and `MetricsData.to_json`, which utilize the `Resource.to_json` functionality directly. Using `repr` does not produce a json-parseable output and doesn't follow the same depth of serialization as the other two signal types. Therefore, this change carries over the serialization process from the spans and metrics signal types to the logs type. Fixes open-telemetry#3345
ocelotl
pushed a commit
to sernst/opentelemetry-python
that referenced
this issue
Feb 2, 2024
Currently, the `LogRecord.to_json` method serializes the resource object using `repr` of its attributes. This differs from how the serialization process is handled in `ReadableSpan.to_json` and `MetricsData.to_json`, which utilize the `Resource.to_json` functionality directly. Using `repr` does not produce a json-parseable output and doesn't follow the same depth of serialization as the other two signal types. Therefore, this change carries over the serialization process from the spans and metrics signal types to the logs type. Fixes open-telemetry#3345
@open-telemetry/python-approvers I think this is fixed in #3972. We can close this one, too |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe your environment
Not Python version or environment specific.
Steps to reproduce
Use a console log exporter or create a lightweight log exporter that calls the
LogRecord.to_json
method to observe that the Resource object is a Pythonrepr
serialized object and not a JSON-compatible serialized object.What is the expected behavior?
I expect the Resource object serialization to be valid JSON and match the serialization of the other two signal types from
ReadableSpan.to_json
andMetricsData.to_json
.What is the actual behavior?
The output displays a Python
repr
version of theResource
attributes and is not a compatible structure with the other signal type exports of the same data format.Additional context
N/A
The text was updated successfully, but these errors were encountered: