Due to inherent inaccuracies in binary floating point arithmetic, the OT shim's implementation has slight imprecision when converting time values from the OT format to the OTel format and vice versa.
For the user it may not matter too much. In the tests, we tolerate imprecision of up to 1 microsecond using assertAlmostEqual().
This problem has been explained in detail in the docs (#244) which aren't merged at the time of writing:
https://github.com/kinvolk/opentelemetry-python/blob/bd020e9720f343a5a370cfb673df7beb4a98ac44/ext/opentelemetry-ext-opentracing-shim/src/opentelemetry/ext/opentracing_shim/__init__.py#L51-L78
I've added TODOs in the relevant places in the tests:
|
# Tolerate inaccuracies of less than a microsecond. |
|
# TODO: Put a link to an explanation in the docs. |
|
# TODO: This seems to work consistently, but we should find out the |
|
# biggest possible loss of precision. |
|
# Tolerate inaccuracies of less than a microsecond. |
|
# TODO: Put a link to an explanation in the docs. |
|
# TODO: This seems to work consistently, but we should find out the |
|
# biggest possible loss of precision. |
|
# Tolerate inaccuracies of less than a microsecond. |
|
# TODO: Put a link to an explanation in the docs. |
|
# TODO: This seems to work consistently, but we should find out the |
|
# biggest possible loss of precision. |
We should add a link to the relevant part in the official docs once merged.
Due to inherent inaccuracies in binary floating point arithmetic, the OT shim's implementation has slight imprecision when converting time values from the OT format to the OTel format and vice versa.
For the user it may not matter too much. In the tests, we tolerate imprecision of up to 1 microsecond using
assertAlmostEqual().This problem has been explained in detail in the docs (#244) which aren't merged at the time of writing:
https://github.com/kinvolk/opentelemetry-python/blob/bd020e9720f343a5a370cfb673df7beb4a98ac44/ext/opentelemetry-ext-opentracing-shim/src/opentelemetry/ext/opentracing_shim/__init__.py#L51-L78
I've added TODOs in the relevant places in the tests:
opentelemetry-python/ext/opentelemetry-ext-opentracing-shim/tests/test_shim.py
Lines 123 to 126 in 26d56c0
opentelemetry-python/ext/opentelemetry-ext-opentracing-shim/tests/test_shim.py
Lines 137 to 140 in 26d56c0
opentelemetry-python/ext/opentelemetry-ext-opentracing-shim/tests/test_shim.py
Lines 403 to 406 in 26d56c0
We should add a link to the relevant part in the official docs once merged.