-
Notifications
You must be signed in to change notification settings - Fork 621
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add all needed spans, and add support of instrumentation and uninstru…
…mentation
- Loading branch information
1 parent
6acb1c5
commit b561657
Showing
4 changed files
with
147 additions
and
50 deletions.
There are no files selected for viewing
55 changes: 55 additions & 0 deletions
55
...ion/opentelemetry-instrumentation-pika/src/opentelemetry/instrumentation/pika/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,57 @@ | ||
# Copyright The OpenTelemetry 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. | ||
""" | ||
Instrument `pika` to trace RabbitMQ applications. | ||
Usage | ||
----- | ||
* Start broker backend | ||
.. code-block:: python | ||
docker run -p 5672:5672 rabbitmq | ||
* Run instrumented task | ||
.. code:: python | ||
import pika | ||
from opentelemetry.instrumentation.pika import PikaInstrumentation | ||
connection = pika.BlockingConnection(pika.URLParameters('amqp://localhost')) | ||
channel = connection.channel() | ||
channel.queue_declare(queue='hello') | ||
pika_instrumentation = PikaInstrumentation() | ||
pika_instrumentation.instrument(channel=channel) | ||
channel.basic_publish(exchange='', routing_key='hello', body=b'Hello World!') | ||
pika_instrumentation.uninstrument(channel=channel) | ||
PikaInstrumentation also supports instrumentation without creating an object, and receiving a tracer_provider | ||
.. code:: Python | ||
PikaInstrumentation.instrument_channel(channel, tracer_provider=tracer_provider) | ||
API | ||
--- | ||
""" | ||
|
||
|
||
from .version import __version__ | ||
from .pika_instrumentor import PikaInstrumentation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters