Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate get_browser_timing_footer API #999

Merged
merged 14 commits into from
Jan 5, 2024
Merged
13 changes: 3 additions & 10 deletions newrelic/api/asgi_application.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,16 +157,9 @@ async def send_inject_browser_agent(self, message):

# if there's a valid body string, attempt to insert the HTML
if verify_body_exists(self.body):
header = self.transaction.browser_timing_header()
if not header:
# If there's no header, abort browser monitoring injection
await self.send_buffered()
return

footer = self.transaction.browser_timing_footer()
browser_agent_data = six.b(header) + six.b(footer)

body = insert_html_snippet(self.body, lambda: browser_agent_data, self.search_maximum)
body = insert_html_snippet(
self.body, lambda: six.b(self.transaction.browser_timing_header()), self.search_maximum
)

# If we have inserted the browser agent
if len(body) != len(self.body):
Expand Down
9 changes: 5 additions & 4 deletions newrelic/api/transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ def __init__(self, application, enabled=None, source=None):
self.synthetics_job_id = None
self.synthetics_monitor_id = None
self.synthetics_header = None

# Synthetics Info Header
self.synthetics_type = None
self.synthetics_initiator = None
Expand Down Expand Up @@ -1912,9 +1912,10 @@ def get_browser_timing_header(nonce=None):


def get_browser_timing_footer(nonce=None):
transaction = current_transaction()
if transaction and hasattr(transaction, "browser_timing_footer"):
return transaction.browser_timing_footer(nonce)
warnings.warn(
"The get_browser_timing_footer function is deprecated. Please migrate to only using the get_browser_timing_header API instead.",
DeprecationWarning,
)
return ""


Expand Down
Loading
Loading