OpenCensus logging Integration
Project description
The logging integration enriches the log records with trace ID, span ID and sampling flag. The following attributes will be added to LogRecord:
traceId
spanId
traceSampled
Note that this only takes effect for loggers created after the integration.
Installation
pip install opencensus-ext-logging
Usage
import logging
from opencensus.trace import config_integration
from opencensus.trace.samplers import AlwaysOnSampler
from opencensus.trace.tracer import Tracer
config_integration.trace_integrations(['logging'])
logging.basicConfig(format='%(asctime)s traceId=%(traceId)s spanId=%(spanId)s %(message)s')
tracer = Tracer(sampler=AlwaysOnSampler())
logger = logging.getLogger(__name__)
logger.warning('Before the span')
with tracer.span(name='hello'):
logger.warning('In the span')
logger.warning('After the span')
References
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file opencensus-ext-logging-0.1.1.tar.gz.
File metadata
- Download URL: opencensus-ext-logging-0.1.1.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c203b70f034151dada529f543af330ba17aaffec27d8a5267d03c713eb1de334
|
|
| MD5 |
0f55738a150e2d36b05d0838120f9cf7
|
|
| BLAKE2b-256 |
3dba25115de16088d7c3cf694c6ac24b9c5d2c549dcad0d84269033f1c6c9ffd
|
File details
Details for the file opencensus_ext_logging-0.1.1-py2.py3-none-any.whl.
File metadata
- Download URL: opencensus_ext_logging-0.1.1-py2.py3-none-any.whl
- Upload date:
- Size: 4.0 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cfdaf5da5d8b195ff3d1af87a4066a6621a28046173f6be4b0b6caec4a3ca89f
|
|
| MD5 |
4aeb46caee3ed8a7b04228092dd14c24
|
|
| BLAKE2b-256 |
74583a37ed716a28a103b619569f257f1519106ff1bef572fd65a5607b19e11b
|