@@ -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
139128def set_execution_context (request , enable_id_logging = False ):
0 commit comments