Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 46 additions & 2 deletions instana/__main__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
"""
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("""\
============================================================================
8888888 888b 888 .d8888b. 88888888888 d8888 888b 888 d8888
Expand All @@ -9,11 +18,46 @@
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 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:
print("""\
This is an informational screen for Instana.

Supported commands:
- 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:
Expand All @@ -33,7 +77,7 @@
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/
Expand Down