跳转到主要内容

高性能C++实现LightStep追踪

项目描述

LightStep Streaming:我们的Python流式追踪器

流式Python追踪器是一个OpenTracing追踪器,它将数据发送到LightStep卫星

此追踪器使用非阻塞I/O写入并发地向多个卫星发送数据。内存被仔细管理,以确保在报告过程中仅复制一次跨度,并将它们作为生成时流式传输到卫星,以避免内存溢出。流式Python追踪器是用C++编写的。这个C++核心周围有一个薄的Python包装器,因此库可以像其他Python模块一样导入。

设置

如果您不熟悉OpenTracing或LightStep,我们建议在继续之前先了解一下。

在安装之前,请确保您的系统满足以下要求

  • Linux
  • Python 2.7或>= 3.2.0(以及pip)
  • opentracing PyPI模块(>=2.2.0)

要安装流式Python追踪器,请运行pip install lightstep-streaming

入门

OpenTracing的美丽之处在于所有跟踪器都遵循一个定义良好的API。唯一一个从跟踪器到跟踪器不同的步骤是设置步骤,当调用lightstep_streaming.Tracer的构造函数时。以下是一个示例程序,说明如何使用Streaming Python Tracer创建一个新的Tracer对象。有关创建Tracer对象后如何使用该对象的更多详细信息,请参阅OpenTracing Python API指南

import lightstep_streaming

tracer = lightstep_streaming.Tracer(
    component_name='[your service name]',
    access_token='[your LightStep access token]',

    # Use these defaults unless you know what you're doing
    use_stream_recorder=True,
    collector_plaintext=True,

    # You can put any number of Satellite endpoints in this list and the tracer
    # will rotate through them and send spans to each one.
    satellite_endpoints=[{'host': 'localhost', 'port': 8360}],

    # Turns off verbose logging, which is really only useful for debugging.
    verbose=False
)

# Generates one span
with tracer.start_active_span('[your operation name]'):
    pass

# Makes sure that the tracer has sent the span to a Satellite
tracer.flush()

Streaming Python Tracer配置参数的完整列表可在tracer_configuration.schema.json中找到。如果您想查看源代码,可以在LightStep C++ Tracer仓库中找到。

项目详情


下载文件

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

源代码分发

此版本没有可用的源代码分发文件。请参阅生成分发存档的教程

构建分发

lightstep_streaming-0.14.0-cp32-abi3-manylinux1_x86_64.whl (994.2 kB 查看哈希)

上传时间 CPython 3.2+

lightstep_streaming-0.14.0-cp27-cp27mu-manylinux1_x86_64.whl (993.9 kB 查看哈希)

上传时间 CPython 2.7mu

lightstep_streaming-0.14.0-cp27-cp27m-manylinux1_x86_64.whl (994.0 kB 查看哈希)

上传时间 CPython 2.7m

由以下机构支持

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF 赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误记录 StatusPage StatusPage 状态页面