Skip to content

Commit 91550eb

Browse files
committed
chore: clean up code a little more.
1 parent 7eedfb9 commit 91550eb

File tree

2 files changed

+3
-15
lines changed

2 files changed

+3
-15
lines changed

.coveragerc-py37

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,4 @@ exclude_lines =
2222

2323
# Exclude async-specific classes and functions in execution_id.py
2424
class AsgiMiddleware:
25-
async def __call__
2625
def set_execution_context_async

src/functions_framework/execution_id.py

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -105,17 +105,14 @@ def __init__(self, app):
105105
self.app = app
106106

107107
async def __call__(self, scope, receive, send):
108-
if scope["type"] == "http":
108+
if scope["type"] == "http": # pragma: no branch
109109
execution_id_header = b"function-execution-id"
110-
trace_context_header = b"x-cloud-trace-context"
111110
execution_id = None
112-
trace_context = None
113111

114112
for name, value in scope.get("headers", []):
115113
if name.lower() == execution_id_header:
116114
execution_id = value.decode("latin-1")
117-
elif name.lower() == trace_context_header:
118-
trace_context = value.decode("latin-1")
115+
break
119116

120117
if not execution_id:
121118
execution_id = _generate_execution_id()
@@ -125,15 +122,7 @@ async def __call__(self, scope, receive, send):
125122
)
126123
scope["headers"] = new_headers
127124

128-
span_id = None
129-
if trace_context:
130-
trace_match = re.match(_TRACE_CONTEXT_REGEX_PATTERN, trace_context)
131-
if trace_match:
132-
span_id = trace_match.group("span_id")
133-
134-
scope["execution_context"] = ExecutionContext(execution_id, span_id)
135-
136-
await self.app(scope, receive, send) # pragma: no cover
125+
await self.app(scope, receive, send)
137126

138127

139128
def set_execution_context(request, enable_id_logging=False):

0 commit comments

Comments
 (0)