Skip to content

Commit 8b18ddc

Browse files
authored
Filter Sanic config onject to only include configration values in context (elastic#1414)
1 parent 567ae4e commit 8b18ddc

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

elasticapm/contrib/sanic/utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
2929
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3030

31+
from string import ascii_uppercase
3132
from typing import Dict
3233

3334
from sanic import Sanic
@@ -71,7 +72,8 @@ async def get_request_info(config: Config, request: Request) -> Dict[str, str]:
7172
:return: A dictionary containing the context information of the ongoing transaction
7273
"""
7374
env = dict(get_env(request=request))
74-
env.update(dict(request.app.config))
75+
app_config = {k: v for k, v in dict(request.app.config).items() if all(letter in ascii_uppercase for letter in k)}
76+
env.update(app_config)
7577
result = {
7678
"env": env,
7779
"method": request.method,

0 commit comments

Comments
 (0)