The InMemorySpanExporter provides a friendly interface to retrieving span information, reducing the need for mocking in unit tests.
Signed-off-by: Alex Boten <aboten@lightstep.com>
The primary purpose of LabelSets are to have an optimal way of re-using handles
with the same label values. We achieve this by having the keys and values of
the labels encoded and stored in each LabelSet instance, so we can have an easy
lookup to the corresponding handle for each metric instrument.
The flask integration has (only) two advantages over the plain WSGI middleware
approach:
- It can use the endpoint as span name (which is lower cardinality than the
route; cf #270)
- It can set the http.route attribute.
In addition, it also has an easier syntax to enable (you don't have to know
about Flask.wsgi_app).
Verifying that our tracecontext is compliant with the w3c
tracecontext reference is valuable. Adding a tox command
to verify that the TraceContext propagator adheres to the
w3c spec.
The tracecontexthttptextformat is now completely compliant with the w3c
tracecontext test suite.
In particular, the following errors are fixed in this commit:
* Don't return False in __exit__
Returning a literal causes a mypy error when combined with the
`typing.Optional[bool]` type hint. Furthermore, exception handling is
the same when returning `False` and when returning `None` (the
exception is re-raised). Therefore, it's simpler to remove the return
statement and change the type hint to `None`.
* Correctly initialize nested tuple
Tuples of length 1 should be initialized with a trailing comma to be
properly interpreted.
* Pass correct type to use_context() in test
* Add type annotations for test helper functions
Since we have `disallow_untyped_calls = True` in our mypy config for
tests, we must add type annotations to any function that is called
from a test.
Addditionally, bump minimal mypy version to 0.740 to consistently reproduce these errors.
* Ensure that type info is picked up from installed package.
This required moving all top-level modules to a sub-package, to not
create collisions with py.typed marker files.
See https://www.python.org/dev/peps/pep-0561/#packaging-type-information
* Add MANIFEST.in for SDK package.
* Fix setup for ext packages.
Previously the wheels would contain the metadata but not the actual
code.
* Check that all packages install properly in test.
* Document why we don't use -e.
Adds requests integration. Two commits that might be of special interest (see #94):
* c66af2faa100b0f41afafdb6e4de9f4de4cc62bc requests test: Use actual Response object.
Co-Authored-By: Allan Feldman <6374032+a-feld@users.noreply.github.com>
* 1b90a0ddc286c936f7256b14e14ef36fd3c6a24f More tests, rename to http-requests to work around pylint bug (?)
See previous CI failure for pylint issue:
************* Module ext/opentelemetry-ext-requests/src/__init__.py
ext/opentelemetry-ext-requests/src/__init__.py:1:0: F0001: No module named ext/opentelemetry-ext-requests/src/__init__.py (fatal)
It seems that pylint gets confused when there is more than one "requests" module??
I believe it would be nice to have
tests on CI not only for Python 3.7,
but for all supported Python versions.
These changes:
- fix compatibility with Python 3.5 and 3.4
- add tests for various Python versions on CI
- allow running tests for any branches