en un clic
flight-profiler-getglobal
// Inspect Python module global field or class static field value in a running Python process. Use this for safe, read-only inspection of global variables, configuration objects, or class-level state.
// Inspect Python module global field or class static field value in a running Python process. Use this for safe, read-only inspection of global variables, configuration objects, or class-level state.
Prerequisites and connection details for attaching to a live Python process with PyFlightProfiler. Read this skill first before using any other PyFlightProfiler command (watch, trace, stack, perf, etc.).
Translate a file path to its Python module name in a running Python process. Use this when you know a file path but need the module name for commands like watch, trace, or reload.
Hot-reload a Python function implementation from the latest file content without restarting the process. Use this to apply code fixes live after identifying a bug with watch/trace.
Inspect stack frames of a running Python process including thread stacks, native C-level frames, and async coroutine stacks. Use this to see what each thread is currently doing and diagnose hangs, deadlocks, or stuck async tasks.
Trace execution time of Python method invocations in a live process with call stack visualization. Use this to see a hierarchical call tree showing which sub-calls are slow and where time is spent within a function.
Inspect live Python class instances in a running process — find all instances of a class, examine their attributes/state, or invoke methods on them. Also supports forcing GC. Use this when you need to probe object-level runtime state beyond what watch/getglobal can provide.
| name | flight-profiler-getglobal |
| description | Inspect Python module global field or class static field value in a running Python process. Use this for safe, read-only inspection of global variables, configuration objects, or class-level state. |
Inspect Python module global field or class static field value. A safe, read-only way to check configuration, feature flags, counters, or any module-level / class-level state.
Prerequisites: Read the flight-profiler-attach skill first for platform requirements, installation, permissions, and connection details.
flight_profiler <pid> --cmd "getglobal module [class] field [options]" --no-color
module — the module name as it would be imported in the target process. For example, if the target code does from myapp.config import settings, then module is myapp.config. PyFlightProfiler locates the module via importlib.import_module. If you're unsure of the module name, run a separate command to resolve it first: flight_profiler <pid> --cmd "module /absolute/path/to/file.py" --no-color, then use the returned module name here.class (optional) — class name for static field inspectionfield — field name to inspect| Flag | Description | Default |
|---|---|---|
-x, --expand <value> | Object tree expand level (1-6, or -1 for unlimited) | 2 |
-e, --expr <value> | Expression to evaluate on the target. The variable target refers to the resolved field value. | target |
-r, --raw | Use __str__ (equivalent to print(obj)) instead of default JSON serialization | off |
-v, --verbose | Display all nested items in list/dict without truncation | off |
-e Expression-e directly controls what you see in the output. Always match the user's intent to the right expression — the default target shows the entire object.
| User intent | -e value |
|---|---|
| See the entire variable | target (default) |
| See a specific dict key | target['key'] |
| See a nested field | target['a']['b'] |
| See an object attribute | target.attr |
| Get the length / count | len(target) |
| Check a condition | target['key'] == expected |
| List all keys | list(target.keys()) |
getglobal returns immediately with a single result block:
EXPR: target
TYPE: <class 'dict'>
VALUE: {
"database_url": "postgresql://localhost:5432/mydb",
"debug": True,
"max_connections": 10,
"nested": {
"level1": {'level2': 'deep_value'}
}
}
| Field | Description |
|---|---|
EXPR | The expression used to extract the displayed value (default target) |
TYPE | Python type of the expression result |
VALUE | The value, formatted as JSON (or __str__ if -r) |
When the expression fails (e.g., accessing a nonexistent attribute):
EXPR: target.nonexistent
FAILED_REASON: AttributeError: 'dict' object has no attribute 'nonexistent'
flight_profiler <pid> --cmd "getglobal __main__ config" --no-color
EXPR: target
TYPE: <class 'dict'>
VALUE: {
"database_url": "postgresql://localhost:5432/mydb",
"debug": True,
"max_connections": 10,
"nested": {
"level1": {'level2': 'deep_value'}
}
}
Note: at default expand level (-x 2), the nested.level1 dict is shown as a compact repr. Use -x 3 to expand deeper (see example 5).
flight_profiler <pid> --cmd "getglobal __main__ counter" --no-color
EXPR: target
TYPE: <class 'int'>
VALUE: 61
The value reflects the live state — counter was 42 at startup but has been incrementing.
flight_profiler <pid> --cmd "getglobal __main__ AppConfig VERSION" --no-color
EXPR: target
TYPE: <class 'str'>
VALUE: "2.1.0"
flight_profiler <pid> --cmd "getglobal __main__ AppConfig FEATURES" --no-color
EXPR: target
TYPE: <class 'dict'>
VALUE: {
"caching": False,
"logging": True,
"metrics": True
}
-x 3Expands nested objects one level deeper than default:
flight_profiler <pid> --cmd "getglobal __main__ config -x 3" --no-color
EXPR: target
TYPE: <class 'dict'>
VALUE: {
"database_url": "postgresql://localhost:5432/mydb",
"debug": True,
"max_connections": 10,
"nested": {
"level1": {
"level2": "deep_value"
}
}
}
Compare with example 1 — nested.level1.level2 is now fully expanded.
Use -e to drill into the object without expanding the entire tree:
flight_profiler <pid> --cmd "getglobal __main__ config -e target['database_url']" --no-color
EXPR: target['database_url']
TYPE: <class 'str'>
VALUE: "postgresql://localhost:5432/mydb"
flight_profiler <pid> --cmd "getglobal __main__ active_users -e len(target)" --no-color
EXPR: len(target)
TYPE: <class 'int'>
VALUE: 5
flight_profiler <pid> --cmd "getglobal __main__ CacheManager _store -e target['user:1']" --no-color
EXPR: target['user:1']
TYPE: <class 'dict'>
VALUE: {
"age": 30,
"name": "alice"
}
-r (use __str__ instead of JSON)flight_profiler <pid> --cmd "getglobal __main__ config -r" --no-color
EXPR: target
TYPE: <class 'dict'>
VALUE: {'database_url': 'postgresql://localhost:5432/mydb', 'debug': True, 'max_connections': 10, 'nested': {'level1': {'level2': 'deep_value'}}}
Entire dict on one line using Python's native __str__ representation.
-vShows all items in lists/dicts without truncation. Useful when collections are large and default output truncates them:
flight_profiler <pid> --cmd "getglobal __main__ active_users -v" --no-color
EXPR: target
TYPE: <class 'list'>
VALUE: [
"alice",
"bob",
"charlie",
"dave",
"eve"
]
-e Expression GuideThe -e option accepts any valid Python expression. The variable target refers to the resolved global variable or class static field.
Common patterns:
# Default: show the entire variable
-e target
# Access a dict key
-e target['key']
# Access a nested field
-e target['nested']['level1']
# Access an attribute
-e target.attribute
# Get length
-e len(target)
# Get type
-e type(target)
# List comprehension
-e [k for k in target.keys()]
# Check a condition
-e target['debug'] == True
# Slice a list
-e target[:3]
flight_profiler <pid> --cmd "getglobal __main__ config -x 4 -v" --no-color > /tmp/getglobal_output.txt
When an object is too large to serialize or the output is truncated/incomplete:
Prefer minimal extraction — use -e to extract only the fields you need, instead of the entire object:
# Instead of serializing the entire config:
-e target
# Extract only the field you care about:
-e target['database_url']
-e target['nested']['key']
-e type(target),len(target)
Use -v (verbose) — if you do need the full object, add -v to disable truncation so all nested items in lists/dicts are shown completely.
-x 3 or higher for deeply nested objects-e expressions to drill into nested objects without expanding the entire tree-r (raw) uses __str__ (like print(obj)) — useful for objects with custom __str__ or when you want the native Python representationconsole insteadmodule command if you only know the file pathflight_profiler/plugins/getglobal/cli_plugin_getglobal.pyflight_profiler/plugins/getglobal/getglobal_parser.pyflight_profiler/plugins/getglobal/server_plugin_getglobal.py