-
Notifications
You must be signed in to change notification settings - Fork 828
Description
This issue is related to issue #1851 regarding the way the otel Python Exporter parses OTEL_EXPORTER_OTLP_HEADERS.
What is the issue?
As per the otel exporter specs, the headers should be represented in a format matching the W3C Correlation-Context specs for HTTP header formats., but the Python exporter does not seem to be compliant with these specifications.
Proposed changes
It seems like the parsing of the headers in this line of the code currently has two problems. Here is the code I'm talking about:
self._headers = tuple(
tuple(item.split("=")) for item in self._headers.split(",")
)
- The keys should be trimmed of leading and training white spaces (OWS), but it does not currently. According to the format of keys,
leading and trailing whitespaces (OWS) are allowed but MUST be trimmed when converting the header into a data structure.
- The values also should remove OWS, and currently the parser creates a key-value pair by splitting on the equal sign
=character for each header specified, but the format of values says:
Note, value MAY contain any number of the equal sign (=) characters. Parsers MUST NOT assume that the equal sign is only used to separate key and value.