Skip to main content

OpenCensus Requests Integration

Project description

pypi

OpenCensus can trace HTTP requests made with the requests package. The request URL, method, and status will be collected.

You can enable requests integration by specifying 'requests' to trace_integrations.

It’s possible to configure a list of URL you don’t want traced. By default the request to exporter won’t be traced. It’s configurable by giving an array of hostname/port to the attribute excludelist_hostnames in OpenCensus context’s attributes:

Only the hostname must be specified if only the hostname is specified in the URL request.

Installation

pip install opencensus-ext-requests

Usage

import requests
from opencensus.trace import config_integration
from opencensus.trace.tracer import Tracer

if __name__ == '__main__':
    config_integration.trace_integrations(['requests'])
    tracer = Tracer()
    with tracer.span(name='parent'):
        response = requests.get(url='https://www.wikipedia.org/wiki/Rabbit')

References

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

opencensus-ext-requests-0.7.6.tar.gz (4.4 kB view hashes)

Uploaded Source

Built Distribution

opencensus_ext_requests-0.7.6-py2.py3-none-any.whl (5.3 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page