-
Notifications
You must be signed in to change notification settings - Fork 798
Description
opentelemetry-python uses strings as keys for Context. However, the spec is written to expect a special Key object https://github.com/open-telemetry/opentelemetry-specification/blob/v1.1.0/specification/context/context.md#create-a-key
The key name exists for debugging purposes and does not uniquely identify the key. Multiple calls to CreateKey with the same name SHOULD NOT return the same value unless language constraints dictate otherwise.
I don't think "language constraints dictate otherwise" for Python (CreateKey could just return a new Key object every time and compare by identity).
Even then this is only a SHOULD requirement that is violated here, so the current implementation can in theory be made spec conformant just by providing a method def create_key(keyname: str): return keyname.