Skip to content

Commit

Permalink
Use py_zipkin and bump to v0.13.0
Browse files Browse the repository at this point in the history
  • Loading branch information
kaisen committed Sep 19, 2016
1 parent 8cad388 commit fe7bdb8
Show file tree
Hide file tree
Showing 23 changed files with 136 additions and 1,601 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
0.13.0 (2016-09-12)
-------------------
- Moved non-pyramid and zipkin-only code to py_zipkin package

0.12.3 (2016-07-27)
-------------------
- Fix coverage command invocation to be compatible with coverage v4.2
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Features include:

* Blacklisting specific route/paths from getting traced.

* `zipkin_tracing_percent` to control the %age of requests getting sampled.
* `zipkin_tracing_percent` to control the percentage of requests getting sampled.

* API `create_headers_for_new_span` to generate new client headers.

Expand Down
4 changes: 2 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
'sphinx.ext.intersphinx',
]

release = "0.10.0"
release = "0.13.0"

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
Expand All @@ -19,7 +19,7 @@

# General information about the project.
project = u'pyramid_zipkin'
copyright = u'2015, Yelp, Inc'
copyright = u'2016, Yelp, Inc'

exclude_patterns = []

Expand Down
26 changes: 11 additions & 15 deletions docs/source/configuring_zipkin.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@ Required configuration settings

zipkin.transport_handler
~~~~~~~~~~~~~~~~~~~~~~~~
A callback function which takes two parameters, the `stream name` and the
`message data`. A sample method can be something like this:
A callback function which takes a single `message data` parameter.
A sample method can be something like this:

A) FOR `kafka` TRANSPORT:

.. code-block:: python
from kafka import SimpleProducer, KafkaClient
def kafka_handler(stream_name, message):
def kafka_handler(message):
kafka = KafkaClient('{0}:{1}'.format('localhost', 9092))
producer = SimpleProducer(kafka, async=True)
producer.send_messages(stream_name, message)
producer.send_messages('some_stream_name', message)
The above example uses python package `kafka-python <https://pypi.python.org/pypi/kafka-python>`_.

Expand All @@ -32,7 +32,7 @@ zipkin.transport_handler
from thrift.transport import TTransport, TSocket
from thrift.protocol import TBinaryProtocol
def scribe_handler(stream_name, message):
def scribe_handler(message):
socket = TSocket.TSocket(host="HOST", port=9999)
transport = TTransport.TFramedTransport(socket)
protocol = TBinaryProtocol.TBinaryProtocol(
Expand All @@ -41,7 +41,7 @@ zipkin.transport_handler
transport.open()
message_b64 = base64.b64encode(message).strip()
log_entry = scribe.LogEntry(stream_name, message_b64)
log_entry = scribe.LogEntry('some_stream_name', message_b64)
result = client.Log(messages=[log_entry])
if result == 0:
print 'success'
Expand All @@ -50,21 +50,17 @@ zipkin.transport_handler
`facebook-scribe <https://pypi.python.org/pypi/facebook-scribe/>`_
for the scribe APIs but any similar package can do the work.

service_name
~~~~~~~~~~~~~~~
A string representing the name of the service under instrumentation.


Optional configuration settings
-------------------------------

All below settings are optional and have a sane default functionality set.
These can be used to fine tune as per your use case.

zipkin.stream_name
~~~~~~~~~~~~~~~~~~
The `stream_name` the message will be logged to via transport layer.
It defaults to `zipkin`.
service_name
~~~~~~~~~~~~~~~
A string representing the name of the service under instrumentation.
It defaults to `unknown`.


zipkin.blacklisted_paths
Expand Down Expand Up @@ -142,4 +138,4 @@ These settings can be added at Pyramid application setup like so:
settings['zipkin.set_extra_binary_annotations'] = lambda req, resp: {'attr': str(req.attr)}
# ...and so on with the other settings...
config = Configurator(settings=settings)
config.include('zipkin')
config.include('pyramid_zipkin')
12 changes: 3 additions & 9 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,17 @@ pyramid_zipkin documentation
============================

This project acts as a `Pyramid <http://docs.pylonsproject.org/en/latest/docs/pyramid.html>`_
tween to facilitate creation of `zipkin <https://github.com/openzipkin/zipkin/wiki>`_ service spans.
tween by using `py_zipkin <https://github.com/Yelp/py_zipkin>`_ to facilitate creation of `zipkin <https://github.com/openzipkin/zipkin/wiki>`_ service spans.

Features include:

* Blacklisting specific route/paths from getting traced.

* ``zipkin_tracing_percent`` to control the percentage of requests getting sampled.

* API ``create_headers_for_new_span`` to generate new client headers.
* Adds ``http.uri``, ``http.uri.qs``, and ``status_code`` binary annotations automatically for each trace.

* API ``SpanContext`` for logging trees of spans in code.

* Adds ``http.uri`` and ``http.uri.qs`` binary annotations automatically for each trace.

* Allows configuration of arbitrary additional binary annotations.

* Allows logging of additional annotations and client spans at any point in request context.
* Allows configuration of additional arbitrary binary annotations.

Install
-------
Expand Down
40 changes: 2 additions & 38 deletions docs/source/pyramid_zipkin.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,37 +4,10 @@ pyramid_zipkin Package
:mod:`pyramid_zipkin` Package
-----------------------------

:mod:`zipkin` Module
:mod:`tween` Module
-------------------------

.. automodule:: pyramid_zipkin.zipkin
:members:
:undoc-members:
:show-inheritance:


:mod:`thread_local` Module
--------------------------

.. automodule:: pyramid_zipkin.thread_local
:members:
:undoc-members:
:show-inheritance:


:mod:`thrift_helper` Module
----------------------------

.. automodule:: pyramid_zipkin.thrift_helper
:members:
:undoc-members:
:show-inheritance:


:mod:`logging_helper` Module
------------------------------------

.. automodule:: pyramid_zipkin.logging_helper
.. automodule:: pyramid_zipkin.tween
:members:
:undoc-members:
:show-inheritance:
Expand All @@ -47,12 +20,3 @@ pyramid_zipkin Package
:members:
:undoc-members:
:show-inheritance:


:mod:`exception` Module
----------------------------

.. automodule:: pyramid_zipkin.exception
:members:
:undoc-members:
:show-inheritance:
4 changes: 3 additions & 1 deletion pyramid_zipkin/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# -*- coding: utf-8 -*-

from pyramid.tweens import EXCVIEW


def includeme(config): # pragma: no cover
"""
:type config: :class:`pyramid.config.Configurator`
"""
config.add_tween('pyramid_zipkin.zipkin.zipkin_tween', over=EXCVIEW)
config.add_tween('pyramid_zipkin.tween.zipkin_tween', over=EXCVIEW)
6 changes: 0 additions & 6 deletions pyramid_zipkin/exception.py

This file was deleted.

0 comments on commit fe7bdb8

Please sign in to comment.