Repository: open-telemetry/opentelemetry-python-contrib

Issue:
Asgi request headers are not retrieved properly
Environment: 
Python: python3.8

fastapi==0.63.0
opentelemetry-api==0.16b1
opentelemetry-sdk==0.16b1
opentelemetry-instrumentation-fastapi==0.16b1
opentelemetry-exporter-google-cloud==0.16b1
opentelemetry-tools-google-cloud==0.16b1

When using `CloudTraceFormatPropagator` for [GCP](https://github.com/GoogleCloudPlatform/opentelemetry-operations-python), `X-Cloud-Trace-Context` header cannot be retrieved.

**Steps to reproduce**
Describe exactly how to reproduce the error. Include a code sample if applicable.

```
# server.py
import uvicorn
from fastapi import FastAPI, Request
from opentelemetry import trace
from opentelemetry.propagators import set_global_textmap
from opentelemetry.instrumentation.fastapi import FastAPIInstrumentor
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.tools import cloud_trace_propagator

set_global_textmap(cloud_trace_propagator.CloudTraceFormatPropagator())

app = FastAPI()

tracer = trace.get_tracer("test")
FastAPIInstrumentor.instrument_app(app)

@app.get("/trace")
async def test(r: Request):
    with tracer.start_as_current_span("test") as span:
        trace_id = span.get_span_context().trace_id
        print(f"{trace_id:32x}")  # should print trace ID from `X-Cloud-Trace-Context` header value

uvicorn.run(app)
```

```
# client.py
import requests

r = requests.Session()
r.headers.setdefault("X-Cloud-Trace-Context",
                        "f3ef5c2ede256aa77491057e600eca11/15104302039794794507;o=1")
r.get("http://localhost:8000/trace")
```

**What is the expected behavior?**
Printed value should be `f3ef5c2ede256aa77491057e600eca11` based from the header sent

**What is the actual behavior?**
A newly generated value everything `/trace` is called

**Additional context**
`X-Cloud-Trace-Context` header value is not retrieved properly in `CloudTraceFormatPropagator`



Discussion:

Resolving patch:
diff --git a/instrumentation/opentelemetry-instrumentation-asgi/src/opentelemetry/instrumentation/asgi/__init__.py b/instrumentation/opentelemetry-instrumentation-asgi/src/opentelemetry/instrumentation/asgi/__init__.py
--- a/instrumentation/opentelemetry-instrumentation-asgi/src/opentelemetry/instrumentation/asgi/__init__.py
+++ b/instrumentation/opentelemetry-instrumentation-asgi/src/opentelemetry/instrumentation/asgi/__init__.py
@@ -47,6 +47,11 @@ def get(
                 else None.
         """
         headers = carrier.get("headers")
+        if not headers:
+            return None
+
+        # asgi header keys are in lower case
+        key = key.lower()
         decoded = [
             _value.decode("utf8")
             for (_key, _value) in headers


Test patch:
diff --git a/instrumentation/opentelemetry-instrumentation-asgi/tests/test_getter.py b/instrumentation/opentelemetry-instrumentation-asgi/tests/test_getter.py
new file mode 100644
--- /dev/null
+++ b/instrumentation/opentelemetry-instrumentation-asgi/tests/test_getter.py
@@ -0,0 +1,50 @@
+# Copyright The OpenTelemetry Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+from unittest import TestCase
+
+from opentelemetry.instrumentation.asgi import CarrierGetter
+
+
+class TestCarrierGetter(TestCase):
+    def test_get_none(self):
+        getter = CarrierGetter()
+        carrier = {}
+        val = getter.get(carrier, "test")
+        self.assertIsNone(val)
+
+    def test_get_(self):
+        getter = CarrierGetter()
+        carrier = {"headers": [(b"test-key", b"val")]}
+        expected_val = ["val"]
+        self.assertEqual(
+            getter.get(carrier, "Test-Key"),
+            expected_val,
+            "Should be case insensitive",
+        )
+        self.assertEqual(
+            getter.get(carrier, "test-key"),
+            expected_val,
+            "Should be case insensitive",
+        )
+        self.assertEqual(
+            getter.get(carrier, "TEST-KEY"),
+            expected_val,
+            "Should be case insensitive",
+        )
+
+    def test_keys(self):
+        getter = CarrierGetter()
+        keys = getter.keys({})
+        self.assertEqual(keys, [])