Skip to content

Commit

Permalink
Tweak logging params
Browse files Browse the repository at this point in the history
  • Loading branch information
mikehgrantsgov committed Dec 6, 2024
1 parent 1fbdac8 commit 1fc67b4
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions api/src/adapters/newrelic/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from types import TracebackType
from typing import Any

import flask
import newrelic.agent

logger = logging.getLogger(__name__)
Expand All @@ -12,12 +13,13 @@


def record_custom_event(event_type: str, params: dict[Any, Any]) -> None:
# legacy aliases
params["request.uri"] = params.get("request.path")
params["request.headers.x-amzn-requestid"] = params.get("request_id")

params["api.request.path"] = params.get("request.path")
params["api.request.method"] = params.get("request.method")
params["api.request.uri"] = params.get("request.path")
params["api.request.url_rule"] = params.get("request.url_rule")
params["api.request.id"] = params.get("request.path")

if flask.has_request_context():
params["api.request.internal_id"] = getattr(flask.g, "internal_request_id", None)

# If there are more custom attributes than the limit, the agent will upload
# a partial payload, dropping keys after hitting its limit
Expand Down

0 comments on commit 1fc67b4

Please sign in to comment.