From 4b77eb8a79af07743001e7071f496c73b647b177 Mon Sep 17 00:00:00 2001 From: Peter Giacomo Lombardo Date: Tue, 28 May 2019 15:09:53 +0200 Subject: [PATCH 1/2] Enable a ipython console that is disabled by default. --- instana/__main__.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/instana/__main__.py b/instana/__main__.py index cb78597e..42724210 100644 --- a/instana/__main__.py +++ b/instana/__main__.py @@ -1,3 +1,5 @@ +import sys + print("""\ ============================================================================ 8888888 888b 888 .d8888b. 88888888888 d8888 888b 888 d8888 @@ -9,9 +11,25 @@ 888 888 Y8888 Y88b d88P 888 d8888888888 888 Y8888 d8888888888 8888888 888 Y888 "Y8888P" 888 d88P 888 888 Y888 d88P 888 ============================================================================ +""") +if "console" in sys.argv: + try: + import IPython + except ImportError: + print("This console is not enabled by default.") + print("IPython not installed. To use this debug console do: 'pip install ipython'\n") + else: + print("Welcome to the Instana debug console.\n") + + IPython.start_ipython(argv=[]) +else: + print("""\ This is an informational screen for Instana. +Supported commands: + - console: "python -m instana console" + See the Instana Python documentation for details on using this package with your Python applications, workers, queues and more. @@ -38,3 +56,5 @@ Python Instrumentation on Github: https://github.com/instana/python-sensor/ """) + + From 4c9d26afcdf233baf8145db737f823986b2eafd7 Mon Sep 17 00:00:00 2001 From: Peter Giacomo Lombardo Date: Mon, 3 Jun 2019 12:37:23 +0200 Subject: [PATCH 2/2] Touchups and more help links --- instana/__main__.py | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/instana/__main__.py b/instana/__main__.py index 42724210..c2f89ea6 100644 --- a/instana/__main__.py +++ b/instana/__main__.py @@ -1,3 +1,10 @@ +""" +This module provides "python -m instana" functionality. This is used for basic module +information display and a IPython console to diagnose environments. + +The console is disabled by default unless the ipython package is installed. +""" +import os import sys print("""\ @@ -20,7 +27,23 @@ print("This console is not enabled by default.") print("IPython not installed. To use this debug console do: 'pip install ipython'\n") else: - print("Welcome to the Instana debug console.\n") + print("Welcome to the Instana console.\n") + print("This is a simple IPython console with the Instana Python Sensor pre-loaded.\n") + + if "INSTANA_DEBUG" not in os.environ: + print("If you want debug output of this sensors' activity run instead:\n") + print(" INSTANA_DEBUG=true python -m instana console") + + print(""" +Helpful Links +============================================================================ + +Monitoring Python Documentation: +https://docs.instana.io/ecosystem/python + +Help & Support: +https://support.instana.com/ +""") IPython.start_ipython(argv=[]) else: @@ -28,10 +51,13 @@ This is an informational screen for Instana. Supported commands: - - console: "python -m instana console" + - console: + * Requires ipython package: pip install ipython + * Example: + - python -m instana console See the Instana Python documentation for details on using this package with -your Python applications, workers, queues and more. +your Python applications, workers, queues, neural networks and more. Related Blog Posts: @@ -51,10 +77,8 @@ https://docs.instana.io/ecosystem/python Help & Support: -https://support.instana.com/hc/en-us +https://support.instana.com/ Python Instrumentation on Github: https://github.com/instana/python-sensor/ """) - -