We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
grpc client fails when parse_method_path() does not return a value for package
### Which version of dd-trace-py are you using?

ddtrace==0.48.0

### Which version of pip are you using?

pip 21.1

### Which version of the libraries are you using?

ddtrace==0.48.0

### How can we reproduce your problem?

parse_method_path() can [return None](https://github.com/DataDog/dd-trace-py/blob/7f817089fac3efc2d1204d347e5d21abe344445c/ddtrace/contrib/grpc/utils.py#L12) for the `package` value. This is then passed to [span._set_str_tag()](https://github.com/DataDog/dd-trace-py/blob/7f817089fac3efc2d1204d347e5d21abe344445c/ddtrace/contrib/grpc/client_interceptor.py#L184), which expects the value to always be `str`.

### What is the result that you get?
```2021-04-29 12:50:27 [6] [ERROR] grpc._server     Exception calling application: not expecting type '<class 'NoneType'>'
Traceback (most recent call last):
  File "/pyenv/versions/app_venv/lib/python3.7/site-packages/grpc/_server.py", line 435, in _call_behavior
    response_or_iterator = behavior(argument, context)
  File "/pyenv/versions/app_venv/lib/python3.7/site-packages/ddtrace/contrib/grpc/server_interceptor.py", line 112, in unary_unary
    return self._fn(constants.GRPC_METHOD_KIND_UNARY, self.__wrapped__.unary_unary, args, kwargs)
  File "/pyenv/versions/app_venv/lib/python3.7/site-packages/ddtrace/contrib/grpc/server_interceptor.py", line 79, in _fn
    span._set_str_tag(constants.GRPC_METHOD_PACKAGE_KEY, method_package)
  File "/pyenv/versions/app_venv/lib/python3.7/site-packages/ddtrace/span.py", line 318, in _set_str_tag
    self.meta[key] = ensure_text(value, errors="replace")
  File "/pyenv/versions/app_venv/lib/python3.7/site-packages/ddtrace/vendor/six/__init__.py", line 937, in ensure_text
    raise TypeError("not expecting type '%s'" % type(s))
TypeError: not expecting type '<class 'NoneType'>'
```

### What is the result that you expected?
The interceptor does not raise exceptions when the value is not available.

The issue seems to be surfaces as a result of #2218. it's not clear if the method package should be omitted or converted to a string as done in some of the other integrations edited in that PR.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `ddtrace/contrib/grpc/utils.py`
Content:
```
1 from . import constants
2 
3 
4 def parse_method_path(method_path):
5     """ Returns (package, service, method) tuple from parsing method path """
6     # unpack method path based on "/{package}.{service}/{method}"
7     # first remove leading "/" as unnecessary
8     package_service, method_name = method_path.lstrip("/").rsplit("/", 1)
9 
10     # {package} is optional
11     package_service = package_service.rsplit(".", 1)
12     if len(package_service) == 2:
13         return package_service[0], package_service[1], method_name
14 
15     return None, package_service[0], method_name
16 
17 
18 def set_grpc_method_meta(span, method, method_kind):
19     method_path = method
20     method_package, method_service, method_name = parse_method_path(method_path)
21     span._set_str_tag(constants.GRPC_METHOD_PATH_KEY, method_path)
22     span._set_str_tag(constants.GRPC_METHOD_PACKAGE_KEY, method_package)
23     span._set_str_tag(constants.GRPC_METHOD_SERVICE_KEY, method_service)
24     span._set_str_tag(constants.GRPC_METHOD_NAME_KEY, method_name)
25     span._set_str_tag(constants.GRPC_METHOD_KIND_KEY, method_kind)
26
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/ddtrace/contrib/grpc/utils.py b/ddtrace/contrib/grpc/utils.py
--- a/ddtrace/contrib/grpc/utils.py
+++ b/ddtrace/contrib/grpc/utils.py
@@ -19,7 +19,8 @@
     method_path = method
     method_package, method_service, method_name = parse_method_path(method_path)
     span._set_str_tag(constants.GRPC_METHOD_PATH_KEY, method_path)
-    span._set_str_tag(constants.GRPC_METHOD_PACKAGE_KEY, method_package)
+    if method_package is not None:
+        span._set_str_tag(constants.GRPC_METHOD_PACKAGE_KEY, method_package)
     span._set_str_tag(constants.GRPC_METHOD_SERVICE_KEY, method_service)
     span._set_str_tag(constants.GRPC_METHOD_NAME_KEY, method_name)
     span._set_str_tag(constants.GRPC_METHOD_KIND_KEY, method_kind)

{"golden_diff": "diff --git a/ddtrace/contrib/grpc/utils.py b/ddtrace/contrib/grpc/utils.py\n--- a/ddtrace/contrib/grpc/utils.py\n+++ b/ddtrace/contrib/grpc/utils.py\n@@ -19,7 +19,8 @@\n     method_path = method\n     method_package, method_service, method_name = parse_method_path(method_path)\n     span._set_str_tag(constants.GRPC_METHOD_PATH_KEY, method_path)\n-    span._set_str_tag(constants.GRPC_METHOD_PACKAGE_KEY, method_package)\n+    if method_package is not None:\n+        span._set_str_tag(constants.GRPC_METHOD_PACKAGE_KEY, method_package)\n     span._set_str_tag(constants.GRPC_METHOD_SERVICE_KEY, method_service)\n     span._set_str_tag(constants.GRPC_METHOD_NAME_KEY, method_name)\n     span._set_str_tag(constants.GRPC_METHOD_KIND_KEY, method_kind)\n", "issue": "grpc client fails when parse_method_path() does not return a value for package\n### Which version of dd-trace-py are you using?\r\n\r\nddtrace==0.48.0\r\n\r\n### Which version of pip are you using?\r\n\r\npip 21.1\r\n\r\n### Which version of the libraries are you using?\r\n\r\nddtrace==0.48.0\r\n\r\n### How can we reproduce your problem?\r\n\r\nparse_method_path() can [return None](https://github.com/DataDog/dd-trace-py/blob/7f817089fac3efc2d1204d347e5d21abe344445c/ddtrace/contrib/grpc/utils.py#L12) for the `package` value. This is then passed to [span._set_str_tag()](https://github.com/DataDog/dd-trace-py/blob/7f817089fac3efc2d1204d347e5d21abe344445c/ddtrace/contrib/grpc/client_interceptor.py#L184), which expects the value to always be `str`.\r\n\r\n### What is the result that you get?\r\n```2021-04-29 12:50:27 [6] [ERROR] grpc._server     Exception calling application: not expecting type '<class 'NoneType'>'\r\nTraceback (most recent call last):\r\n  File \"/pyenv/versions/app_venv/lib/python3.7/site-packages/grpc/_server.py\", line 435, in _call_behavior\r\n    response_or_iterator = behavior(argument, context)\r\n  File \"/pyenv/versions/app_venv/lib/python3.7/site-packages/ddtrace/contrib/grpc/server_interceptor.py\", line 112, in unary_unary\r\n    return self._fn(constants.GRPC_METHOD_KIND_UNARY, self.__wrapped__.unary_unary, args, kwargs)\r\n  File \"/pyenv/versions/app_venv/lib/python3.7/site-packages/ddtrace/contrib/grpc/server_interceptor.py\", line 79, in _fn\r\n    span._set_str_tag(constants.GRPC_METHOD_PACKAGE_KEY, method_package)\r\n  File \"/pyenv/versions/app_venv/lib/python3.7/site-packages/ddtrace/span.py\", line 318, in _set_str_tag\r\n    self.meta[key] = ensure_text(value, errors=\"replace\")\r\n  File \"/pyenv/versions/app_venv/lib/python3.7/site-packages/ddtrace/vendor/six/__init__.py\", line 937, in ensure_text\r\n    raise TypeError(\"not expecting type '%s'\" % type(s))\r\nTypeError: not expecting type '<class 'NoneType'>'\r\n```\r\n\r\n### What is the result that you expected?\r\nThe interceptor does not raise exceptions when the value is not available.\r\n\r\nThe issue seems to be surfaces as a result of #2218. it's not clear if the method package should be omitted or converted to a string as done in some of the other integrations edited in that PR.\n", "before_files": [{"content": "from . import constants\n\n\ndef parse_method_path(method_path):\n    \"\"\" Returns (package, service, method) tuple from parsing method path \"\"\"\n    # unpack method path based on \"/{package}.{service}/{method}\"\n    # first remove leading \"/\" as unnecessary\n    package_service, method_name = method_path.lstrip(\"/\").rsplit(\"/\", 1)\n\n    # {package} is optional\n    package_service = package_service.rsplit(\".\", 1)\n    if len(package_service) == 2:\n        return package_service[0], package_service[1], method_name\n\n    return None, package_service[0], method_name\n\n\ndef set_grpc_method_meta(span, method, method_kind):\n    method_path = method\n    method_package, method_service, method_name = parse_method_path(method_path)\n    span._set_str_tag(constants.GRPC_METHOD_PATH_KEY, method_path)\n    span._set_str_tag(constants.GRPC_METHOD_PACKAGE_KEY, method_package)\n    span._set_str_tag(constants.GRPC_METHOD_SERVICE_KEY, method_service)\n    span._set_str_tag(constants.GRPC_METHOD_NAME_KEY, method_name)\n    span._set_str_tag(constants.GRPC_METHOD_KIND_KEY, method_kind)\n", "path": "ddtrace/contrib/grpc/utils.py"}], "after_files": [{"content": "from . import constants\n\n\ndef parse_method_path(method_path):\n    \"\"\" Returns (package, service, method) tuple from parsing method path \"\"\"\n    # unpack method path based on \"/{package}.{service}/{method}\"\n    # first remove leading \"/\" as unnecessary\n    package_service, method_name = method_path.lstrip(\"/\").rsplit(\"/\", 1)\n\n    # {package} is optional\n    package_service = package_service.rsplit(\".\", 1)\n    if len(package_service) == 2:\n        return package_service[0], package_service[1], method_name\n\n    return None, package_service[0], method_name\n\n\ndef set_grpc_method_meta(span, method, method_kind):\n    method_path = method\n    method_package, method_service, method_name = parse_method_path(method_path)\n    span._set_str_tag(constants.GRPC_METHOD_PATH_KEY, method_path)\n    if method_package is not None:\n        span._set_str_tag(constants.GRPC_METHOD_PACKAGE_KEY, method_package)\n    span._set_str_tag(constants.GRPC_METHOD_SERVICE_KEY, method_service)\n    span._set_str_tag(constants.GRPC_METHOD_NAME_KEY, method_name)\n    span._set_str_tag(constants.GRPC_METHOD_KIND_KEY, method_kind)\n", "path": "ddtrace/contrib/grpc/utils.py"}]}