From 256b45578dd9b68e7f9a992fb9ae42a56635e799 Mon Sep 17 00:00:00 2001 From: Noemi <45180344+unflxw@users.noreply.github.com> Date: Mon, 18 Mar 2024 15:21:36 +0100 Subject: [PATCH] Modify installation instructions Add a warning emoji whenever manual instrumentation is required, that is, always. For Django's instructions, refer to the modification needed as a generic "your entrypoints" and leave it for the docs to explain further. Change other instructions to use `import appsignal`, replacing the use of `from __appsignal__ import appsignal`. --- src/appsignal/cli/install.py | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/src/appsignal/cli/install.py b/src/appsignal/cli/install.py index 35584c4..56ca219 100644 --- a/src/appsignal/cli/install.py +++ b/src/appsignal/cli/install.py @@ -23,6 +23,8 @@ INSTALL_FILE_NAME = "__appsignal__.py" +WARNING_EMOJI = "\u26A0\ufe0f" + class InstallCommand(AppsignalCLICommand): """Generate Appsignal client integration code.""" @@ -123,9 +125,11 @@ def _django_installation(self) -> None: print() self._add_dependency("opentelemetry-instrumentation-django") - print("Django requires some manual configuration.") - print("The __appsignal__ module needs to be imported in the manage.py file") - print("and the appsignal.start() method needs to be called in the main method.") + print(f"{WARNING_EMOJI} Django requires some manual configuration.") + print( + "AppSignal needs to be imported and started at your Django application's " + "entry points." + ) print() print("Please refer to the documentation for more information:") print("https://docs.appsignal.com/python/instrumentations/django.html") @@ -139,9 +143,14 @@ def _flask_installation(self) -> None: print() self._add_dependency("opentelemetry-instrumentation-flask") - print("Flask requires some manual configuration.") - print("The __appsignal__ module needs to be imported before Flask is imported") - print("and the appsignal.start() method needs to be called right after.") + print(f"{WARNING_EMOJI} Flask requires some manual configuration.") + print( + "AppSignal needs to be imported and initialized before Flask is imported." + ) + print() + print(" import appsignal") + print(" appsignal.start()") + print(" import flask") print() print("Please refer to the documentation for more information:") print("https://docs.appsignal.com/python/instrumentations/flask.html") @@ -149,10 +158,11 @@ def _flask_installation(self) -> None: def _generic_installation(self) -> None: print("✅ Done! AppSignal for Python has now been installed.") print() + print(f"{WARNING_EMOJI} Some manual configuration might be required.") print("To start AppSignal in your application, add the following code to your") print("application's entrypoint:") print() - print(" from __appsignal__ import appsignal") + print(" import appsignal") print(" appsignal.start()") print() print("You can check a list of the supported integrations here:")