Skip to content
Merged
Show file tree
Hide file tree
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
20 changes: 11 additions & 9 deletions docs/config/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@ A list of the possible config values for the deep python agent. They can be set

Note: When setting as environment variable prefix the key with 'DEEP_'. e.g. DEEP_SERVICE_URL

| Key | Default | Description |
|-----------------------|------------|--------------------------------------------------------------------------------------------------------------------------------------|
| SERVICE_URL | deep:43315 | The url (hostname:port) of the deep service to connect to. |
| SERVICE_SECURE | True | Can be set to False if the service doesn't support secure connections. |
| LOGGING_CONF | None | Can be used to override the python logging config used by the agent. |
| POLL_TIMER | 10 | The time (in seconds) of the interval between polls. |
| SERVICE_AUTH_PROVIDER | None | The auth provider to use, each provider can have their own config, see available [auth providers](../auth/providers.md) for details. |
| IN_APP_INCLUDE | None | A string of comma (,) seperated values that indicate a package is part of the app. |
| IN_APP_EXCLUDE | None | A string of comma (,) seperated values that indicate a package is not part of the app. |
| Key | Default | Description |
|-----------------------|------------|----------------------------------------------------------------------------------------------------------------------------------------------------------|
| SERVICE_URL | deep:43315 | The url (hostname:port) of the deep service to connect to. |
| SERVICE_SECURE | True | Can be set to False if the service doesn't support secure connections. |
| LOGGING_CONF | None | Can be used to override the python logging config used by the agent. |
| POLL_TIMER | 10 | The time (in seconds) of the interval between polls. |
| SERVICE_AUTH_PROVIDER | None | The auth provider to use, each provider can have their own config, see available [auth providers](../auth/providers.md) for details. |
| IN_APP_INCLUDE | None | A string of comma (,) seperated values that indicate a package is part of the app. |
| IN_APP_EXCLUDE | None | A string of comma (,) seperated values that indicate a package is not part of the app. |
| APP_ROOT | Calculated | This is the root folder in which the application is running. If not set it is calculated as the directory in which the file that calls `Deep.start` is in. |



8 changes: 8 additions & 0 deletions src/deep/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
import inspect
import os

from deep import logging, version
from deep.api import Deep
Expand All @@ -23,6 +25,12 @@ def start(config=None):
if config is None:
config = {}

# we use the app root to shorten file paths for display
if 'APP_ROOT' not in config:
# if app root is not set then we use the folder in which the code that called us is in as the app root
config['APP_ROOT'] = os.getenv("DEEP_APP_ROOT", None) or os.path.dirname(
os.path.dirname(inspect.stack()[1].filename))

from deep.config.config_service import ConfigService
cfg = ConfigService(config)
logging.init(cfg)
Expand Down
3 changes: 3 additions & 0 deletions src/deep/processor/frame_collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ def is_app_frame(self, filename: str) -> Tuple[bool, Optional[str]]:
if filename.startswith(path):
return True, path

if filename.startswith(self._config.APP_ROOT):
return True, self._config.APP_ROOT

return False, None

def process_frame_variables_breadth_first(self, f_locals):
Expand Down