Skip to content
This repository was archived by the owner on Sep 17, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 49 additions & 1 deletion contrib/opencensus-ext-azure/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,54 @@ Installation
Usage
-----

Trace
~~~~~

The **Azure Monitor Trace Exporter** allows you to export `OpenCensus`_ traces to `Azure Monitor`_.

.. _Azure Monitor: https://docs.microsoft.com/azure/azure-monitor/
.. _OpenCensus: https://github.com/census-instrumentation/opencensus-python/

This example shows how to send a span "hello" to Azure Monitor.

* Create an Azure Monitor resource and get the instrumentation key, more information can be found `here <https://docs.microsoft.com/azure/azure-monitor/app/create-new-resource>`_.
* Put the instrumentation key in ``APPINSIGHTS_INSTRUMENTATIONKEY`` environment variable.


.. code:: python

from opencensus.ext.azure.trace_exporter import AzureExporter
from opencensus.trace import tracer as tracer_module

tracer = tracer_module.Tracer(exporter=AzureExporter())

with tracer.span(name='hello'):
print('Hello, World!')

You can also specify the instrumentation key explicitly in the code.

.. code:: python

# TBD
import requests

from opencensus.ext.azure.common import Options
from opencensus.ext.azure.trace_exporter import AzureExporter
from opencensus.trace import config_integration
from opencensus.trace.tracer import Tracer

if __name__ == '__main__':
config_integration.trace_integrations(['requests'])
tracer = Tracer(exporter=AzureExporter(Options(
# TODO: replace this with your own instrumentation key.
instrumentation_key='00000000-0000-0000-0000-000000000000',
timeout=29.9,
)))
with tracer.span(name='parent'):
response = requests.get(url='https://www.wikipedia.org/wiki/Rabbit')

References
----------

* `Azure Monitor <https://docs.microsoft.com/azure/azure-monitor/>`_
* `Examples <https://github.com/census-instrumentation/opencensus-python/tree/master/contrib/opencensus-ext-azure/examples>`_
* `OpenCensus Project <https://opencensus.io/>`_
2 changes: 2 additions & 0 deletions contrib/opencensus-ext-azure/examples/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

if __name__ == '__main__':
config_integration.trace_integrations(['requests'])
# TODO: you need to specify the instrumentation key in the
# APPINSIGHTS_INSTRUMENTATIONKEY environment variable.
tracer = Tracer(exporter=AzureExporter())
with tracer.span(name='parent'):
with tracer.span(name='child'):
Expand Down
25 changes: 25 additions & 0 deletions contrib/opencensus-ext-azure/examples/config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright 2019, OpenCensus Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from opencensus.ext.azure.common import Options
from opencensus.ext.azure.trace_exporter import AzureExporter
from opencensus.trace import tracer as tracer_module

tracer = tracer_module.Tracer(exporter=AzureExporter(Options(
# TODO: replace the all-zero GUID with your instrumentation key.
instrumentation_key='00000000-0000-0000-0000-000000000000',
)))

with tracer.span(name='foo'):
print('Hello, World!')
6 changes: 2 additions & 4 deletions contrib/opencensus-ext-azure/examples/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,13 @@
from opencensus.ext.flask.flask_middleware import FlaskMiddleware

app = Flask(__name__)
# TODO:
# Replace 00000000-0000-0000-0000-000000000000 with your Instrumentation Key
# https://docs.microsoft.com/en-us/azure/azure-monitor/app/create-new-resource
# TODO: replace the all-zero GUID with your instrumentation key.
app.config['OPENCENSUS'] = {
'TRACE': {
'SAMPLER': 'opencensus.trace.samplers.ProbabilitySampler(rate=1)',
'EXPORTER': '''opencensus.ext.azure.trace_exporter.AzureExporter(
opencensus.ext.azure.common.Options(
instrumentation_key="00000000-0000-0000-0000-000000000000",
instrumentation_key='00000000-0000-0000-0000-000000000000',
timeout=29.9,
))''',
},
Expand Down
2 changes: 2 additions & 0 deletions contrib/opencensus-ext-azure/examples/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
from opencensus.ext.azure.trace_exporter import AzureExporter
from opencensus.ext.flask.flask_middleware import FlaskMiddleware

# TODO: you need to specify the instrumentation key in the
# APPINSIGHTS_INSTRUMENTATIONKEY environment variable.
app = Flask(__name__)
middleware = FlaskMiddleware(app, exporter=AzureExporter())

Expand Down
8 changes: 4 additions & 4 deletions contrib/opencensus-ext-azure/examples/simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
from opencensus.ext.azure.trace_exporter import AzureExporter
from opencensus.trace import tracer as tracer_module

# TODO: you need to specify the instrumentation key in the
# APPINSIGHTS_INSTRUMENTATIONKEY environment variable.
tracer = tracer_module.Tracer(exporter=AzureExporter())

if __name__ == '__main__':
with tracer.span(name='foo') as foo:
with foo.span(name='bar'):
print('Hello, World!')
with tracer.span(name='foo'):
print('Hello, World!')
12 changes: 10 additions & 2 deletions contrib/opencensus-ext-dbapi/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ Installation
Usage
-----

.. code:: python
The OpenCensus Database API Integration library provides the database
integration infrastructure for extensions `opencensus-ext-mysql`_
and `opencensus-ext-pymysql`_.

# TBD
.. _opencensus-ext-mysql: https://github.com/census-instrumentation/opencensus-python/tree/master/contrib/opencensus-ext-mysql
.. _opencensus-ext-pymysql: https://github.com/census-instrumentation/opencensus-python/tree/master/contrib/opencensus-ext-pymysql

References
----------

* `OpenCensus Project <https://opencensus.io/>`_
5 changes: 5 additions & 0 deletions contrib/opencensus-ext-django/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,8 @@ for a complete reference.
)''',
}
}

References
----------

* `OpenCensus Project <https://opencensus.io/>`_
5 changes: 5 additions & 0 deletions contrib/opencensus-ext-flask/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,8 @@ for a complete reference.
)''',
}
}

References
----------

* `OpenCensus Project <https://opencensus.io/>`_
9 changes: 8 additions & 1 deletion contrib/opencensus-ext-google-cloud-clientlibs/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,11 @@ Usage

.. code:: python

# TBD
from opencensus.trace import config_integration

config_integration.trace_integrations(['google_cloud_clientlibs'])

References
----------

* `OpenCensus Project <https://opencensus.io/>`_
10 changes: 9 additions & 1 deletion contrib/opencensus-ext-grpc/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,12 @@ Usage

.. code:: python

# TBD
from opencensus.trace import config_integration

config_integration.trace_integrations(['grpc'])

References
----------

* `gRPC <https://grpc.io/>`_
* `OpenCensus Project <https://opencensus.io/>`_
15 changes: 14 additions & 1 deletion contrib/opencensus-ext-httplib/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,17 @@ Usage

.. code:: python

# TBD
import requests
from opencensus.trace import config_integration
from opencensus.trace.tracer import Tracer

config_integration.trace_integrations(['httplib'])
tracer = Tracer()

with tracer.span(name='parent'):
response = requests.get('https://www.wikipedia.org/wiki/Rabbit')

References
----------

* `OpenCensus Project <https://opencensus.io/>`_
23 changes: 22 additions & 1 deletion contrib/opencensus-ext-jaeger/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,27 @@ Installation
Usage
-----

The **OpenCensus Jaeger Exporter** allows you to export `OpenCensus`_ traces to `Jaeger`_.

.. _Jaeger: https://www.jaegertracing.io/
.. _OpenCensus: https://github.com/census-instrumentation/opencensus-python/

.. code:: python

# TBD
from opencensus.ext.jaeger.trace_exporter import JaegerExporter
from opencensus.trace import tracer as tracer_module

tracer = tracer_module.Tracer(exporter=JaegerExporter(
service_name='my service',
agent_host_name='localhost',
agent_port=6831,
))

with tracer.span(name='hello'):
print('Hello, World!')

References
----------

* `Jaeger <https://www.jaegertracing.io/>`_
* `OpenCensus Project <https://opencensus.io/>`_
9 changes: 8 additions & 1 deletion contrib/opencensus-ext-mysql/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,11 @@ Usage

.. code:: python

# TBD
from opencensus.trace import config_integration

config_integration.trace_integrations(['mysql'])

References
----------

* `OpenCensus Project <https://opencensus.io/>`_
6 changes: 6 additions & 0 deletions contrib/opencensus-ext-ocagent/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,9 @@ Stats
ocagent_stats_exporter.new_stats_exporter(
service_name='service_name',
endpoint='localhost:55678')

References
----------

* `OpenCensus Project <https://opencensus.io/>`_
* `OpenCensus Services <https://github.com/census-instrumentation/opencensus-service>`_
9 changes: 8 additions & 1 deletion contrib/opencensus-ext-postgresql/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,11 @@ Usage

.. code:: python

# TBD
from opencensus.trace import config_integration

config_integration.trace_integrations(['postgresql'])

References
----------

* `OpenCensus Project <https://opencensus.io/>`_
4 changes: 4 additions & 0 deletions contrib/opencensus-ext-prometheus/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,7 @@ For further details for the Prometheus implementation, see the folder *prometheu
| contrib/opencensus-ext-prometheus/opencensus/ext/prometheus/stats_exporter/ | Stats implementation for Prometheus |
+-------------------------------------------------------------------------------+-------------------------------------+

References
----------

* `OpenCensus Project <https://opencensus.io/>`_
9 changes: 8 additions & 1 deletion contrib/opencensus-ext-pymongo/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,11 @@ Usage

.. code:: python

# TBD
from opencensus.trace import config_integration

config_integration.trace_integrations(['pymongo'])

References
----------

* `OpenCensus Project <https://opencensus.io/>`_
10 changes: 9 additions & 1 deletion contrib/opencensus-ext-pymysql/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,12 @@ Usage

.. code:: python

# TBD
from opencensus.trace import config_integration

config_integration.trace_integrations(['pymysql'])

References
----------

* `OpenCensus Project <https://opencensus.io/>`_

5 changes: 5 additions & 0 deletions contrib/opencensus-ext-pyramid/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,8 @@ for a complete reference.
}

config = Configurator(settings=settings)

References
----------

* `OpenCensus Project <https://opencensus.io/>`_
14 changes: 13 additions & 1 deletion contrib/opencensus-ext-requests/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,17 @@ Usage

.. code:: python

execution_context.set_opencensus_attr('blacklist_hostnames',['hostname:port'])
import requests
from opencensus.trace import config_integration
from opencensus.trace.tracer import Tracer

if __name__ == '__main__':
config_integration.trace_integrations(['requests'])
tracer = Tracer()
with tracer.span(name='parent'):
response = requests.get(url='https://www.wikipedia.org/wiki/Rabbit')

References
----------

* `OpenCensus Project <https://opencensus.io/>`_
9 changes: 8 additions & 1 deletion contrib/opencensus-ext-sqlalchemy/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,11 @@ Usage

.. code:: python

# TBD
from opencensus.trace import config_integration

config_integration.trace_integrations(['sqlalchemy'])

References
----------

* `OpenCensus Project <https://opencensus.io/>`_
4 changes: 4 additions & 0 deletions contrib/opencensus-ext-stackdriver/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,7 @@ For further details for the Stackdriver implementation, see the folder *stackdri
| contrib/opencensus-ext-stackdriver/opencensus/ext/stackdriver/stats_exporter/ | Stats implementation for Stackdriver|
+---------------------------------------------------------------------------------+-------------------------------------+

References
----------

* `OpenCensus Project <https://opencensus.io/>`_
9 changes: 8 additions & 1 deletion contrib/opencensus-ext-threading/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,11 @@ Usage

.. code:: python

# TBD
from opencensus.trace import config_integration

config_integration.trace_integrations(['threading'])

References
----------

* `OpenCensus Project <https://opencensus.io/>`_
Loading