open-telemetry / opentelemetry-python

OpenTelemetry Python API and SDK
https://opentelemetry.io
Apache License 2.0
1.67k stars 570 forks source link

OTLP exporter is encoding invalid span/trace IDs in the logs fix #4006

Open soumyadeepm04 opened 5 days ago

soumyadeepm04 commented 5 days ago

Description

set the trace and span id fields to None for the returned log record in _encode_log if the corresponding ids are invalid. Fixed the test case accordingly.

Fixes #3828

Type of change

Please delete options that are not relevant.

How Has This Been Tested?

Test case already exists, modified it accordingly. Tested locally to ensure that the trace and span id fields are not present in the output if they are invalid.

Does This PR Require a Contrib Repo Change?

Checklist:

soumyadeepm04 commented 5 days ago

I did not add or remove any public symbols so I have no clue why that test is failing. Could someone help me with this?

xrmx commented 2 days ago

I did not add or remove any public symbols so I have no clue why that test is failing. Could someone help me with this?

I think you get that check failing because you are not on latest main. Please add a changelog entry

soumyadeepm04 commented 1 day ago

I guess we are missing a test for the behaviour, like asserting we are not serializing the fields if it is 0

Would you like me to add a test case for the same and if so, would that require me to add a test case both in the "opentelemetry-exporter-otlp-proto-grpc" and "opentelemetry-exporter-otlp-proto-http" directories?

xrmx commented 22 hours ago

I guess we are missing a test for the behaviour, like asserting we are not serializing the fields if it is 0

Would you like me to add a test case for the same and if so, would that require me to add a test case both in the "opentelemetry-exporter-otlp-proto-grpc" and "opentelemetry-exporter-otlp-proto-http" directories?

Yeah, please add a test to both the exporter because the internal helpers are not unit tested on their own