Guance Learn

Observability questions

Focused answers for definitions, architecture choices, troubleshooting, pricing, and evaluation.

Python programming and application logging
Explainer

Get the last element of a Python list

Read a list’s final item with negative indexing, handle empty lists deliberately, and distinguish reading an item from removing it.

Python programming and application logging
Explainer

Get the length of a Python list

Use len() to count list elements, understand what nested lists count, and handle iterators that do not provide a length.

Python programming and application logging
Explainer

Extract a substring in Python

Use string slices for index ranges, handle delimiters safely, and account for negative indexes, zero-length requests, and Unicode boundaries.

Python programming and application logging
Explainer

Measure Python program execution time

Use perf_counter for elapsed time, timeit for repeated small benchmarks, and a timer that still reports when the measured code raises.

Illustration of Git branches and version history
Technical guide

Search committed code throughout Git history

Search historical snapshots with git grep, find changes with git log -S or -G, and keep searches manageable in large or shallow repositories.

Illustration of server operations and request logs
Explainer

Handle application URLs behind an Nginx path prefix

Map a reverse-proxied application under a subpath, fix redirect and cookie paths, and understand the limits of HTML substitution.

Python programming and application logging
Explainer

Import a Python module dynamically by name or path

Use importlib for runtime module names, load a trusted file with a checked module spec, and understand discovery, caching, and reload limits.

Python programming and application logging
Explainer

Iterate over a Python dictionary with a for loop

Choose keys, values, or items, preserve insertion-order expectations, and avoid changing a dictionary’s keys during iteration.

Python programming and application logging
Explainer

Log HTTP requests made with Python Requests

Use urllib3 diagnostics or Requests response hooks, understand which failures and payloads they omit, and avoid exposing credentials in HTTP logs.

Python programming and application logging
Explainer

Write structured JSON logs in Python

Choose a JSON logging package or a custom formatter, preserve exception details and event timestamps, and validate fields before sending logs to a collector.

Python programming and application logging
Explainer

Log to a file and the console in Python

Attach separate handlers for file and console output, set their thresholds independently, and prevent duplicate records and uncontrolled file growth.

Python programming and application logging
Explainer

Send Python logs to standard output

Route Python logging to stdout with basicConfig or StreamHandler, and understand configuration ownership and container log collection.