Skip to content

Commit

Permalink
Deprecate parse_headers function
Browse files Browse the repository at this point in the history
  • Loading branch information
ocelotl committed Nov 17, 2022
1 parent d710f61 commit 06df6d8
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions opentelemetry-api/src/opentelemetry/util/re.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import logging
from logging import getLogger
from re import compile, split
from typing import Dict, List, Mapping
from urllib.parse import unquote

_logger = logging.getLogger(__name__)
from deprecated import deprecated

_logger = getLogger(__name__)

# The following regexes reference this spec: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/exporter.md#specifying-headers-via-environment-variables

Expand All @@ -40,6 +42,13 @@


# pylint: disable=invalid-name


@deprecated(version="1.15.0", reason="You should use parse_env_headers")
def parse_headers(s: str) -> Mapping[str, str]:
return parse_env_headers(s)


def parse_env_headers(s: str) -> Mapping[str, str]:
"""
Parse ``s``, which is a ``str`` instance containing HTTP headers encoded
Expand All @@ -57,7 +66,7 @@ def parse_env_headers(s: str) -> Mapping[str, str]:
_logger.warning(
"Header format invalid! Header values in environment variables must be "
"URL encoded per the OpenTelemetry Protocol Exporter specification: %s",
header
header,
)
continue
# value may contain any number of `=`
Expand Down

0 comments on commit 06df6d8

Please sign in to comment.