-
Notifications
You must be signed in to change notification settings - Fork 658
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
Change tracing to use Resource.to_json()
#2747
Comments
Hey @ocelotl I'm interested in this ticket. Could you explain a bit more? What do we want to use the new Resource.to_json() for or instead of? |
@jeremydvoss Currently resource in tracing is formatted using this private |
The _format_attributes and resource.to_json methods handle the null case differently. The former would produce
Furthermore, the to_json method actually produces a string and not a dictionary as expected. But that can be changed. @srikanthccv Do we want to add blank resource.attribute and resource.schema_url keys when there are no values, or keep the current behavior? |
@jeremydvoss |
Since the logic of the to_json method and the ultimate output behavior needs to remain the same, the only option is to use the to_json method but remove the key-value pairs that are empty. It's not as clean as I might like. I'll create a PR and see what the community thinks. |
@lzchen the console span exporter is intended for debugging purposes and people shouldn't rely it for any other purposes. It is okay to reformat the spans. Am i misunderstanding something? |
@srikanthccv |
We are explicit about the usage of this component in our stable package. opentelemetry-python/opentelemetry-sdk/src/opentelemetry/sdk/trace/export/__init__.py Lines 416 to 421 in 9fbc93b
I don't think we have any breaking changes to our stable package interfaces. I am not sure under what category this comes under (behavioural change?). While the intended usage is for debugging purpose, I have seen people workaround things for their need. We can never know what happens in the wild. Your comment made me rethink my position. One potential case is when people have some big programs that they instrumented and they can't use any exporter which requires n/w access, so instead they write it to a file and periodically collect and parse this file to upload the telemetry to backend. I don't mind keeping the current behaviour. |
Merged #2784 |
Could you create an issue to change tracing to use
Resource.to_json()
, in a way that's not breaking?Originally posted by @lzchen in #2722 (comment)
The text was updated successfully, but these errors were encountered: