| 1 |
Metadata-Version: 2.1 |
| 2 |
Name: aiozipkin |
| 3 |
Version: 1.1.1a1 |
| 4 |
Summary: Distributed tracing instrumentation for asyncio application with zipkin |
| 5 |
Home-page: https://github.com/aio-libs/aiozipkin |
| 6 |
Author: Nikolay Novik |
| 7 |
Author-email: [email protected] |
| 8 |
License: Apache 2 |
| 9 |
Download-URL: https://pypi.python.org/pypi/aiozipkin |
| 10 |
Keywords: zipkin,distributed-tracing,tracing |
| 11 |
Platform: POSIX |
| 12 |
Classifier: License :: OSI Approved :: MIT License |
| 13 |
Classifier: Intended Audience :: Developers |
| 14 |
Classifier: Programming Language :: Python :: 3 |
| 15 |
Classifier: Programming Language :: Python :: 3.6 |
| 16 |
Classifier: Programming Language :: Python :: 3.7 |
| 17 |
Classifier: Programming Language :: Python :: 3.8 |
| 18 |
Classifier: Programming Language :: Python :: 3.9 |
| 19 |
Classifier: Operating System :: POSIX |
| 20 |
Classifier: Development Status :: 5 - Production/Stable |
| 21 |
Classifier: Framework :: AsyncIO |
| 22 |
Requires-Python: >=3.6 |
| 23 |
License-File: LICENSE |
| 24 |
|
| 25 |
aiozipkin |
| 26 |
========= |
| 27 |
.. image:: https://github.com/aio-libs/aiozipkin/workflows/CI/badge.svg |
| 28 |
:target: https://github.com/aio-libs/aiozipkin/actions?query=workflow%3ACI |
| 29 |
.. image:: https://codecov.io/gh/aio-libs/aiozipkin/branch/master/graph/badge.svg |
| 30 |
:target: https://codecov.io/gh/aio-libs/aiozipkin |
| 31 |
.. image:: https://api.codeclimate.com/v1/badges/1ff813d5cad2d702cbf1/maintainability |
| 32 |
:target: https://codeclimate.com/github/aio-libs/aiozipkin/maintainability |
| 33 |
:alt: Maintainability |
| 34 |
.. image:: https://img.shields.io/pypi/v/aiozipkin.svg |
| 35 |
:target: https://pypi.python.org/pypi/aiozipkin |
| 36 |
.. image:: https://readthedocs.org/projects/aiozipkin/badge/?version=latest |
| 37 |
:target: http://aiozipkin.readthedocs.io/en/latest/?badge=latest |
| 38 |
:alt: Documentation Status |
| 39 |
.. image:: https://badges.gitter.im/Join%20Chat.svg |
| 40 |
:target: https://gitter.im/aio-libs/Lobby |
| 41 |
:alt: Chat on Gitter |
| 42 |
|
| 43 |
**aiozipkin** is Python 3.6+ module that adds distributed tracing capabilities |
| 44 |
from asyncio_ applications with zipkin (http://zipkin.io) server instrumentation. |
| 45 |
|
| 46 |
zipkin_ is a distributed tracing system. It helps gather timing data needed |
| 47 |
to troubleshoot latency problems in microservice architectures. It manages |
| 48 |
both the collection and lookup of this data. Zipkinās design is based on |
| 49 |
the Google Dapper paper. |
| 50 |
|
| 51 |
Applications are instrumented with **aiozipkin** report timing data to zipkin_. |
| 52 |
The Zipkin UI also presents a Dependency diagram showing how many traced |
| 53 |
requests went through each application. If you are troubleshooting latency |
| 54 |
problems or errors, you can filter or sort all traces based on the |
| 55 |
application, length of trace, annotation, or timestamp. |
| 56 |
|
| 57 |
.. image:: https://raw.githubusercontent.com/aio-libs/aiozipkin/master/docs/zipkin_animation2.gif |
| 58 |
:alt: zipkin ui animation |
| 59 |
|
| 60 |
|
| 61 |
Features |
| 62 |
======== |
| 63 |
* Distributed tracing capabilities to **asyncio** applications. |
| 64 |
* Support zipkin_ ``v2`` protocol. |
| 65 |
* Easy to use API. |
| 66 |
* Explicit context handling, no thread local variables. |
| 67 |
* Can work with jaeger_ and stackdriver_ through zipkin compatible API. |
| 68 |
|
| 69 |
|
| 70 |
zipkin vocabulary |
| 71 |
----------------- |
| 72 |
Before code lets learn important zipkin_ vocabulary, for more detailed |
| 73 |
information please visit https://zipkin.io/pages/instrumenting |
| 74 |
|
| 75 |
.. image:: https://raw.githubusercontent.com/aio-libs/aiozipkin/master/docs/zipkin_glossary.png |
| 76 |
:alt: zipkin ui glossary |
| 77 |
|
| 78 |
* **Span** represents one specific method (RPC) call |
| 79 |
* **Annotation** string data associated with a particular timestamp in span |
| 80 |
* **Tag** - key and value associated with given span |
| 81 |
* **Trace** - collection of spans, related to serving particular request |
| 82 |
|
| 83 |
|
| 84 |
Simple example |
| 85 |
-------------- |
| 86 |
|
| 87 |
.. code:: python |
| 88 |
|
| 89 |
import asyncio |
| 90 |
import aiozipkin as az |
| 91 |
|
| 92 |
|
| 93 |
async def run(): |
| 94 |
# setup zipkin client |
| 95 |
zipkin_address = 'http://127.0.0.1:9411/api/v2/spans' |
| 96 |
endpoint = az.create_endpoint( |
| 97 |
"simple_service", ipv4="127.0.0.1", port=8080) |
| 98 |
tracer = await az.create(zipkin_address, endpoint, sample_rate=1.0) |
| 99 |
|
| 100 |
# create and setup new trace |
| 101 |
with tracer.new_trace(sampled=True) as span: |
| 102 |
# give a name for the span |
| 103 |
span.name("Slow SQL") |
| 104 |
# tag with relevant information |
| 105 |
span.tag("span_type", "root") |
| 106 |
# indicate that this is client span |
| 107 |
span.kind(az.CLIENT) |
| 108 |
# make timestamp and name it with START SQL query |
| 109 |
span.annotate("START SQL SELECT * FROM") |
| 110 |
# imitate long SQL query |
| 111 |
await asyncio.sleep(0.1) |
| 112 |
# make other timestamp and name it "END SQL" |
| 113 |
span.annotate("END SQL") |
| 114 |
|
| 115 |
await tracer.close() |
| 116 |
|
| 117 |
if __name__ == "__main__": |
| 118 |
loop = asyncio.get_event_loop() |
| 119 |
loop.run_until_complete(run()) |
| 120 |
|
| 121 |
|
| 122 |
aiohttp example |
| 123 |
--------------- |
| 124 |
|
| 125 |
*aiozipkin* includes *aiohttp* server instrumentation, for this create |
| 126 |
`web.Application()` as usual and install aiozipkin plugin: |
| 127 |
|
| 128 |
|
| 129 |
.. code:: python |
| 130 |
|
| 131 |
import aiozipkin as az |
| 132 |
|
| 133 |
def init_app(): |
| 134 |
host, port = "127.0.0.1", 8080 |
| 135 |
app = web.Application() |
| 136 |
endpoint = az.create_endpoint("AIOHTTP_SERVER", ipv4=host, port=port) |
| 137 |
tracer = await az.create(zipkin_address, endpoint, sample_rate=1.0) |
| 138 |
az.setup(app, tracer) |
| 139 |
|
| 140 |
|
| 141 |
That is it, plugin adds middleware that tries to fetch context from headers, |
| 142 |
and create/join new trace. Optionally on client side you can add propagation |
| 143 |
headers in order to force tracing and to see network latency between client and |
| 144 |
server. |
| 145 |
|
| 146 |
.. code:: python |
| 147 |
|
| 148 |
import aiozipkin as az |
| 149 |
|
| 150 |
endpoint = az.create_endpoint("AIOHTTP_CLIENT") |
| 151 |
tracer = await az.create(zipkin_address, endpoint) |
| 152 |
|
| 153 |
with tracer.new_trace() as span: |
| 154 |
span.kind(az.CLIENT) |
| 155 |
headers = span.context.make_headers() |
| 156 |
host = "http://127.0.0.1:8080/api/v1/posts/{}".format(i) |
| 157 |
resp = await session.get(host, headers=headers) |
| 158 |
await resp.text() |
| 159 |
|
| 160 |
|
| 161 |
Documentation |
| 162 |
------------- |
| 163 |
http://aiozipkin.readthedocs.io/ |
| 164 |
|
| 165 |
|
| 166 |
Installation |
| 167 |
------------ |
| 168 |
Installation process is simple, just:: |
| 169 |
|
| 170 |
$ pip install aiozipkin |
| 171 |
|
| 172 |
|
| 173 |
Support of other collectors |
| 174 |
=========================== |
| 175 |
**aiozipkin** can work with any other zipkin_ compatible service, currently we |
| 176 |
tested it with jaeger_ and stackdriver_. |
| 177 |
|
| 178 |
|
| 179 |
Jaeger support |
| 180 |
-------------- |
| 181 |
jaeger_ supports zipkin_ span format as result it is possible to use *aiozipkin* |
| 182 |
with jaeger_ server. You just need to specify *jaeger* server address and it |
| 183 |
should work out of the box. Not need to run local zipkin server. |
| 184 |
For more informations see tests and jaeger_ documentation. |
| 185 |
|
| 186 |
.. image:: https://raw.githubusercontent.com/aio-libs/aiozipkin/master/docs/jaeger.png |
| 187 |
:alt: jaeger ui animation |
| 188 |
|
| 189 |
|
| 190 |
Stackdriver support |
| 191 |
------------------- |
| 192 |
Google stackdriver_ supports zipkin_ span format as result it is possible to |
| 193 |
use *aiozipkin* with this google_ service. In order to make this work you |
| 194 |
need to setup zipkin service locally, that will send trace to the cloud. See |
| 195 |
google_ cloud documentation how to setup make zipkin collector: |
| 196 |
|
| 197 |
.. image:: https://raw.githubusercontent.com/aio-libs/aiozipkin/master/docs/stackdriver.png |
| 198 |
:alt: jaeger ui animation |
| 199 |
|
| 200 |
|
| 201 |
Requirements |
| 202 |
------------ |
| 203 |
|
| 204 |
* Python_ 3.6+ |
| 205 |
* aiohttp_ |
| 206 |
|
| 207 |
|
| 208 |
.. _PEP492: https://www.python.org/dev/peps/pep-0492/ |
| 209 |
.. _Python: https://www.python.org |
| 210 |
.. _aiohttp: https://github.com/KeepSafe/aiohttp |
| 211 |
.. _asyncio: http://docs.python.org/3.5/library/asyncio.html |
| 212 |
.. _uvloop: https://github.com/MagicStack/uvloop |
| 213 |
.. _zipkin: http://zipkin.io |
| 214 |
.. _jaeger: http://jaeger.readthedocs.io/en/latest/ |
| 215 |
.. _stackdriver: https://cloud.google.com/stackdriver/ |
| 216 |
.. _google: https://cloud.google.com/trace/docs/zipkin |
| 217 |
|
| 218 |
CHANGES |
| 219 |
======= |
| 220 |
|
| 221 |
.. |
| 222 |
You should *NOT* be adding new change log entries to this file, this |
| 223 |
file is managed by towncrier. You *may* edit previous change logs to |
| 224 |
fix problems like typo corrections or such. |
| 225 |
To add a new change log entry, please see |
| 226 |
https://pip.pypa.io/en/latest/development/#adding-a-news-entry |
| 227 |
we named the news folder "changes". |
| 228 |
|
| 229 |
WARNING: Don't drop the next directive! |
| 230 |
|
| 231 |
.. towncrier release notes start |
| 232 |
|
| 233 |
1.1.1a1 (2021-10-23) |
| 234 |
==================== |
| 235 |
|
| 236 |
Bugfixes |
| 237 |
-------- |
| 238 |
|
| 239 |
- Fix unhandled AssertionError in aiohttp integration when unknown resource requested by the user. |
| 240 |
`#400 <https://github.com/aio-libs/aiohttp/issues/400>`_ |
| 241 |
- Fix ``NoneType`` error when using ``SystemRoute``. |
| 242 |
`#410 <https://github.com/aio-libs/aiohttp/issues/410>`_ |
| 243 |
|
| 244 |
---- |
| 245 |
|
| 246 |
|
| 247 |
1.1.0 (2021-05-17) |
| 248 |
================== |
| 249 |
|
| 250 |
Bugfixes |
| 251 |
-------- |
| 252 |
|
| 253 |
- Expect trace request context to be of SimpleNamespace type. |
| 254 |
`#385 <https://github.com/aio-libs/aiohttp/issues/385>`_ |
| 255 |
|
| 256 |
|
| 257 |
---- |
| 258 |
|
| 259 |
|
| 260 |
1.0.0 (2020-11-06) |
| 261 |
================== |
| 262 |
|
| 263 |
Bugfixes |
| 264 |
-------- |
| 265 |
|
| 266 |
- Support Python 3.8 and Python 3.9 |
| 267 |
`#259 <https://github.com/aio-libs/aiohttp/issues/259>`_ |
| 268 |
|
| 269 |
|
| 270 |
---- |
| 271 |
|
| 272 |
|
| 273 |
0.7.1 (2020-09-20) |
| 274 |
================== |
| 275 |
|
| 276 |
Bugfixes |
| 277 |
-------- |
| 278 |
|
| 279 |
- Fix `Manifest.in` file; add `CHANGES.rst` to the Source Tarball. |
| 280 |
|
| 281 |
|
| 282 |
0.7.0 (2020-07-17) |
| 283 |
================== |
| 284 |
|
| 285 |
Features |
| 286 |
-------- |
| 287 |
|
| 288 |
- Add support of AWS X-Ray trace id format. |
| 289 |
`#273 <https://github.com/aio-libs/aiohttp/issues/273>`_ |
| 290 |
|
| 291 |
|
| 292 |
---- |
| 293 |
|
| 294 |
|
| 295 |
0.6.0 (2019-10-12) |
| 296 |
------------------ |
| 297 |
* Add context var support for python3.7 aiohttp instrumentation #187 |
| 298 |
* Single header tracing support #189 |
| 299 |
* Add retries and batches to transport (thanks @konstantin-stepanov) |
| 300 |
* Drop python3.5 support #238 |
| 301 |
* Use new typing syntax in codebase #237 |
| 302 |
|
| 303 |
|
| 304 |
0.5.0 (2018-12-25) |
| 305 |
------------------ |
| 306 |
* More strict typing configuration is used #147 |
| 307 |
* Fixed bunch of typos in code and docs #151 #153 (thanks @deejay1) |
| 308 |
* Added interface for Transport #155 (thanks @deejay1) |
| 309 |
* Added create_custom helper for easer tracer configuration #160 (thanks @deejay1) |
| 310 |
* Added interface for Sampler #160 (thanks @deejay1) |
| 311 |
* Added py.typed marker |
| 312 |
|
| 313 |
|
| 314 |
0.4.0 (2018-07-11) |
| 315 |
------------------ |
| 316 |
* Add more coverage with typing #147 |
| 317 |
* Breaking change: typo send_inteval => send_interval #144 (thanks @gugu) |
| 318 |
* Breaking change: do not append api/v2/spans to the zipkin dress #150 |
| 319 |
|
| 320 |
|
| 321 |
0.3.0 (2018-06-13) |
| 322 |
------------------ |
| 323 |
* Add support http.route tag for aiohttp #138 |
| 324 |
* Make zipkin address builder more permissive #141 (thanks @dsantosfff) |
| 325 |
|
| 326 |
|
| 327 |
0.2.0 (2018-03-03) |
| 328 |
------------------ |
| 329 |
* Breaking change: az.create is coroutine now #114 |
| 330 |
* Added context manger for tracer object #114 |
| 331 |
* Added more mypy types #117 |
| 332 |
|
| 333 |
|
| 334 |
0.1.1 (2018-01-26) |
| 335 |
------------------ |
| 336 |
* Added new_child helper method #83 |
| 337 |
|
| 338 |
|
| 339 |
0.1.0 (2018-01-21) |
| 340 |
------------------ |
| 341 |
After few months of work and beta releases here are basic features: |
| 342 |
|
| 343 |
* Initial release. |
| 344 |
* Implemented zipkin v2 protocol with HTTP transport |
| 345 |
* Added jaeger support |
| 346 |
* Added stackdriver support |
| 347 |
* Added aiohttp server support |
| 348 |
* Added aiohttp 3.0.0 client tracing support |
| 349 |
* Added examples and demos |
| 350 |
|