Metadata-Version: 2.0
Name: ddtrace-graphql
Version: 0.0.4
Summary: Python library for tracing graphql calls with Datadog
Home-page: https://github.com/beezz/ddtrace-graphql
Author: Michal Kuffa
Author-email: michal@bynder.com
License: UNKNOWN
Description-Content-Type: UNKNOWN
Keywords: tracing datadog graphql graphene
Platform: UNKNOWN
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Debuggers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Requires-Dist: ddtrace
Requires-Dist: graphql-core
Provides-Extra: test
Requires-Dist: tox; extra == 'test'
Requires-Dist: pytest; extra == 'test'
Requires-Dist: pytest-cov; extra == 'test'


===============
ddtrace-graphql
===============


.. image:: https://travis-ci.org/beezz/ddtrace-graphql.svg?branch=master
   :target: https://travis-ci.org/beezz/ddtrace-graphql


.. image:: https://pyup.io/repos/github/beezz/ddtrace-graphql/shield.svg
   :target: https://pyup.io/repos/github/beezz/ddtrace-graphql/


Python library to trace graphql calls with Datadog.

* `graphql-core <https://github.com/graphql-python/graphql-core>`_

* `Datadog APM (Tracing) <https://docs.datadoghq.com/tracing/>`_

* `Datadog Trace Client <http://pypi.datadoghq.com/trace/docs/>`_


Installation
============

Using pip
---------

.. code-block:: bash

   $ pip install ddtrace-graphql


From source
------------

.. code-block:: bash

   $ git clone https://github.com/beezz/ddtrace-graphql.git
   $ cd ddtrace-graphql && python setup.py install


Usage
=====

To trace all GraphQL requests patch the library. Put this snippet to your
application main entry point.


.. code-block:: python

   __import__('ddtrace_graphql').patch()

   # OR

   from ddtrace_graphql import patch
   patch()


Check out the `datadog trace client <http://pypi.datadoghq.com/trace/docs/>`_
for all supported libraries and frameworks.

.. note:: For the patching to work properly, ``patch`` needs to be called
          before any other imports of the ``graphql`` function.

.. code-block:: python

   # app/__init__.py
   __import__('ddtrace_graphql').patch()

   # from that point all calls to graphql are traced
   from graphql import graphql
   result = graphql(schema, query)


Trace only certain calls with ``traced_graphql`` function

.. code-block:: python

    from ddtrace_graphql import traced_graphql
    traced_graphql(schema, query)


Development
===========

Install from source in development mode
---------------------------------------

.. code-block:: bash

   $ git clone https://github.com/beezz/ddtrace-graphql.git
   $ pip install --editable ddtrace-graphql[test]


Run tests
---------

.. code-block:: bash

   $ tox


