|
| 1 | +""" |
| 2 | +This module provides "python -m instana" functionality. This is used for basic module |
| 3 | +information display and a IPython console to diagnose environments. |
| 4 | +
|
| 5 | +The console is disabled by default unless the ipython package is installed. |
| 6 | +""" |
| 7 | +import os |
| 8 | +import sys |
| 9 | + |
1 | 10 | print("""\ |
2 | 11 | ============================================================================ |
3 | 12 | 8888888 888b 888 .d8888b. 88888888888 d8888 888b 888 d8888 |
|
9 | 18 | 888 888 Y8888 Y88b d88P 888 d8888888888 888 Y8888 d8888888888 |
10 | 19 | 8888888 888 Y888 "Y8888P" 888 d88P 888 888 Y888 d88P 888 |
11 | 20 | ============================================================================ |
| 21 | +""") |
| 22 | + |
| 23 | +if "console" in sys.argv: |
| 24 | + try: |
| 25 | + import IPython |
| 26 | + except ImportError: |
| 27 | + print("This console is not enabled by default.") |
| 28 | + print("IPython not installed. To use this debug console do: 'pip install ipython'\n") |
| 29 | + else: |
| 30 | + print("Welcome to the Instana console.\n") |
| 31 | + print("This is a simple IPython console with the Instana Python Sensor pre-loaded.\n") |
| 32 | + |
| 33 | + if "INSTANA_DEBUG" not in os.environ: |
| 34 | + print("If you want debug output of this sensors' activity run instead:\n") |
| 35 | + print(" INSTANA_DEBUG=true python -m instana console") |
| 36 | + |
| 37 | + print(""" |
| 38 | +Helpful Links |
| 39 | +============================================================================ |
12 | 40 |
|
| 41 | +Monitoring Python Documentation: |
| 42 | +https://docs.instana.io/ecosystem/python |
| 43 | +
|
| 44 | +Help & Support: |
| 45 | +https://support.instana.com/ |
| 46 | +""") |
| 47 | + |
| 48 | + IPython.start_ipython(argv=[]) |
| 49 | +else: |
| 50 | + print("""\ |
13 | 51 | This is an informational screen for Instana. |
14 | 52 |
|
| 53 | +Supported commands: |
| 54 | + - console: |
| 55 | + * Requires ipython package: pip install ipython |
| 56 | + * Example: |
| 57 | + - python -m instana console |
| 58 | +
|
15 | 59 | See the Instana Python documentation for details on using this package with |
16 | | -your Python applications, workers, queues and more. |
| 60 | +your Python applications, workers, queues, neural networks and more. |
17 | 61 |
|
18 | 62 |
|
19 | 63 | Related Blog Posts: |
|
33 | 77 | https://docs.instana.io/ecosystem/python |
34 | 78 |
|
35 | 79 | Help & Support: |
36 | | -https://support.instana.com/hc/en-us |
| 80 | +https://support.instana.com/ |
37 | 81 |
|
38 | 82 | Python Instrumentation on Github: |
39 | 83 | https://github.com/instana/python-sensor/ |
|
0 commit comments