This commit adds auto-instrumentation for elasticsearch. The
instrumentation has been mostly ported over from OpenTracing
elasticsearch instrumentation.
Co-authored-by: Yusuke Tsutsumi <yusuke@tsutsumi.io>
Co-authored-by: alrex <aboten@lightstep.com>
The lint job raising an error at installation:
ERROR: Could not find a version that satisfies the requirement opentelemetry-ext-asgi==0.10.dev0 (from opentelemetry-instrumentation-starlette==0.10.dev0) (from versions: 0.8b0, 0.9b0)
ERROR: No matching distribution found for opentelemetry-ext-asgi==0.10.dev0 (from opentelemetry-instrumentation-starlette==0.10.dev0)
The opentelemetry-ext-asgi should be installed before depending modules.
adding an initial starlette instrumentation.
tox does exact match on fields delimited by a dash. Thus,
any instrumentation that includes "instrumentation" in the name
would collide with testing of the "opentelemetry-instrumentation"
package.
Renaming opentelemetry-instrumentation to opentelemetry-instrumentation-base to fix that.
Co-authored-by: Leighton Chen <lechen@microsoft.com>
Co-authored-by: alrex <aboten@lightstep.com>
This commit ports the OpenTracing testbed[1] to check that the ot-shim is
working as expected using different frameworks.
Gevent doesn't support context vars yet[2], so those tests are not compatible
with opentelemetry and were not ported.
[1] https://github.com/opentracing/opentracing-python/tree/master/testbed
[2] https://github.com/gevent/gevent/issues/1407
Co-authored-by: Mauricio Vásquez <mauricio@kinvolk.io>
Co-authored-by: alrex <aboten@lightstep.com>
renaming otcollector to opencensus, as it's using opencensus under the hood. This was originally intended to be replaced by otlp, by a new package can be created for that instead.
Co-authored-by: alrex <alrex.boten@gmail.com>
Some build time improvements:
- split lint/docker-tests/docs into their own steps. Since lint is usually the thing that fails anyways, it's good to have it run first. We could make the build depend on this step to prevent slowing other builds waiting in the pipeline (since we only have 5 workers)
- move all pip install commands into a single line per test environment. this reduces the overhead of calling the pip command separately multiple times per environment.
- removed pip upgrade command for pypy3 and py38
There are some examples that are duplicated in the getting started guide and in
the examples folder itself. This commit removes the duplicated examples and
updates the getting started guide to include then from real source files that
are passed through the linter and have tests.
Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
Co-authored-by: alrex <aboten@lightstep.com>
The CI is not able to catch many documentation problems because we are ignoring
warnings. This commit fixes most of the warnings, ignores the rest and enables
a flag to treat them as errors.
Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
Add an exporter to Datadog. This implementation makes use of ddtrace to handle the creation of Datadog traces and writing them to the Datadog agent.
Co-Authored-By: Mauricio Vásquez <mauricio@kinvolk.io>
Implement to helper methods to allow users to enable / disable instrumentation
in a single connection object.
The current integrations based on dbapi allow to patch the connect function on those libraries to return an instrumented connection, however it's not possible to enable instrumentation on a connection previously created or to disable instrumentation in an instrumented connection.
This only implements the logic in PyMySQL, it can be easily done in other instrumentations once we think it's worth to be done.
Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
Co-authored-by: Yusuke Tsutsumi <yusuke@tsutsumi.io>
Implement to helper methods to allow users to enable / disable instrumentation
in a single connection object.
Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
Co-authored-by: alrex <alrex.boten@gmail.com>
Adding initial aiohttp client.
This module is only supported on Python3.5, which is the oldest supported by
aiohttp.
Co-authored-by: Yusuke Tsutsumi <yusuke@tsutsumi.io>
The requests integration is named http-requests because at the time it was created there were some problems with pylint.
other integrations are using opentelemetry.ext.integration without problems, tests are passing without issue, even renamed.
Currently builds take roughly 15 minutes, as the longest job (pypy3) isn't
kicked off until one of the other jobs is finished running (max 5 concurrent
jobs). Prioritizing the longer jobs first should reduce the build time by about
5 minutes.
The current Pymongo integration uses the monitoring.register() [1] to hook
the different internal calls of Pymongo. This integration doesn't allow to
unregister a monitor. This commit workaround that limitation by adding an
enable flag to the CommandTracer class and adds a logic to disable the
integration. This solution is not perfect becasue there will be some overhead
even when the instrumentation is disabled, but that's what we can do with
the current approach.
[1] https://api.mongodb.com/python/current/api/pymongo/monitoring.html#pymongo.monitoring.register
Co-authored-by: Alex Boten <aboten@lightstep.com>
Implement the BaseInstrumentor interface to make this library compatible with the opentelemetry-auto-instr command.
There is an issue about getting the span when the global tracer provider hasn't been configured, this should be changed in the future once we extend the opentelemetry-auto-instr command to also configure the SDK.
Porting the existing redis instrumentation from the contrib repo to using the OpenTelemetry API and the OpenTelemetry Auto-instrumentation Instrumentor interface.
Similiar to the sqlalchemy PR, the main thing that will need updating is to remove the patch/unpatch methods once the instrumentor interface changes have been merged.
This is replacing open-telemetry/opentelemetry-python-contrib#21
Co-authored-by: Mauricio Vásquez <mauricio@kinvolk.io>
Co-authored-by: Leighton Chen <lechen@microsoft.com>
Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
Co-authored-by: Chris Kleinknecht <libc@google.com>
Fixes#613
some packages depend on the newest dev version of dbapi, which isn't published yet
when a package in a virtualenv is installed, it will attempt to install those dependencies, which searches on pypi
Installing the local package ensures that 0.7 is installed, so pip sees that and skips trying to resolve against pypi (when it won't find the version).
Integration for PyMySQL.
Fixes some documentation as well for other db integrations. Leverages dbapi.
Co-authored-by: Mauricio Vásquez <mauricio@kinvolk.io>
Update tests to use TestBase as described on #303.
Co-authored-by: Yusuke Tsutsumi <yusuke@tsutsumi.io>
Co-authored-by: Chris Kleinknecht <libc@google.com>
Adding a TestBase class which wraps a tracer provider that is configured with a memory span
exporter. This class inherits from unitest.TestCase, hence other test classes
can inherit from it to get access to the underlying memory span exporter and
tracer provider.
Adding a mock propagator that could be used for testing propagation in different packages.
It was implemented in the opentracing-shim and this commit moves it to a generic
place.
Adding disable_session(), which can be used to disable the instrumentation on a single
requests' session object.
opentelemetry-ext-testutil is a package with shared test classes used by ext packages (right now only opentelemetry-ext-flask). We don't release this package, just import it in other tests.
Right now, on each release, we build everything in ext/. This means whoever does the release has to remember to exclude this package when they push the others to PyPI.
This moves the files and package:
Move files ext/opentelemetry-ext-testutil -> tests/util
Move package opentelemetry.ext.testutil -> opentelemetry.test
This makes maintainers' lives easier, but it does mean that other packages that use testutils will have to install install the opentelemetry.test package from source. But this is already the case since we don't publish opentelemetry-ext-testutil.
we move shared test code back into the main repo until we move a package that depends on it into a separate repo, at which point we'll have to put this code in its own top-level package.