Describe your environment
OS: Windows
Python version: Python 3.13
SDK version: the latest
API version: the latest
TraceState.add() does not fully check whether the inputs are correct.
What happened?
TraceState.add() should reject the illegal inputs.
Steps to Reproduce
Here is my test case:
`from opentelemetry.trace import TraceState
Java constants mapped to Python
EMPTY = TraceState()
FIRST_VALUE = "first_value" # Adjust to match your test's actual constant
class MyTestCase(unittest.TestCase):
def test_valid_long_tenant_id(self):
result = EMPTY.add("12345678901234567890@nr", FIRST_VALUE)
assert result.get("12345678901234567890@nr") == FIRST_VALUE
def test_vendor_id_longer_than_13_characters(self):
with self.assertRaises(Exception) as context:
EMPTY.add("1@nrabcdefghijkl", FIRST_VALUE)
self.assertTrue('This is broken' in context.exception)
def test_vendor_id_longer_than_13_characters_long_tenant_id(self):
with self.assertRaises(Exception) as context:
EMPTY.add("12345678901234567890@nrabcdefghijkl", FIRST_VALUE)
self.assertTrue('This is broken' in context.exception)
def test_tenant_id_longer_than_240_characters(self):
tenant_id = "a" * 241
with self.assertRaises(Exception) as context:
EMPTY.add(f"{tenant_id}@nr", FIRST_VALUE)
self.assertTrue('This is broken' in context.exception)
def test_non_vendor_format_first_key_character(self):
with self.assertRaises(Exception) as context:
EMPTY.add("1acdfrgs", FIRST_VALUE)
self.assertTrue('This is broken' in context.exception)`
Expected Result
Shall reject.
Actual Result
Added.
Additional context
No response
Would you like to implement a fix?
None
Tip
React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.
Describe your environment
OS: Windows
Python version: Python 3.13
SDK version: the latest
API version: the latest
TraceState.add() does not fully check whether the inputs are correct.
What happened?
TraceState.add() should reject the illegal inputs.
Steps to Reproduce
Here is my test case:
`from opentelemetry.trace import TraceState
Java constants mapped to Python
EMPTY = TraceState()
FIRST_VALUE = "first_value" # Adjust to match your test's actual constant
class MyTestCase(unittest.TestCase):
Expected Result
Shall reject.
Actual Result
Added.
Additional context
No response
Would you like to implement a fix?
None
Tip
React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding
+1orme too, to help us triage it. Learn more here.