跳转到主要内容

OpenCensus FastAPI集成

项目描述

pypi

安装

pip install opencensus-ext-fastapi

使用

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!'

可以提供额外的配置,请阅读自定义以获取完整参考。

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

参考

项目详情


下载文件

下载适用于您的平台的文件。如果您不确定选择哪个,请了解更多关于安装包的信息。

源分发

opencensus-ext-fastapi-0.1.0.tar.gz (4.1 kB 查看哈希值)

上传时间:

构建分发

opencensus_ext_fastapi-0.1.0-py2.py3-none-any.whl (5.0 kB 查看哈希值)

上传时间: Python 2 Python 3

支持者