Metadata-Version: 2.1
Name: opencensus-ext-fastapi
Version: 0.1.0
Summary: OpenCensus FastAPI Integration
Home-page: https://github.com/census-instrumentation/opencensus-python/tree/master/contrib/opencensus-ext-fastapi
Author: OpenCensus Authors
Author-email: census-developers@googlegroups.com
License: Apache-2.0
Platform: UNKNOWN
Classifier: Intended Audience :: Developers
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Requires-Dist: fastapi (>=0.75.2)
Requires-Dist: opencensus (<1.0.0,>=0.11.2)

OpenCensus FastAPI Integration
============================================================================

|pypi|

.. |pypi| image:: https://badge.fury.io/py/opencensus-ext-fastapi.svg
   :target: https://pypi.org/project/opencensus-ext-fastapi/

Installation
------------

::

    pip install opencensus-ext-fastapi

Usage
-----

.. code:: python

    from fastapi import FastAPI
    from opencensus.ext.fastapi.fastapi_middleware import FastAPIMiddleware

    app = FastAPI(__name__)
    app.add_middleware(FastAPIMiddleware)

    @app.get('/')
    def hello():
        return 'Hello World!'

Additional configuration can be provided, please read
`Customization <https://github.com/census-instrumentation/opencensus-python#customization>`_
for a complete reference.

.. code:: python

    app.add_middleware(
        FastAPIMiddleware,
        excludelist_paths=["paths"],
        excludelist_hostnames=["hostnames"],
        sampler=sampler,
        exporter=exporter,
        propagator=propagator,
    )


References
----------

* `OpenCensus Project <https://opencensus.io/>`_


