Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Falcon 3 support #644

Merged
merged 32 commits into from
Sep 27, 2021
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
21bdf4c
Enable compatibility w/ Falcon 3
adriangb Sep 1, 2021
beb8bc5
add Falcon 3 to tox.ini
adriangb Sep 1, 2021
b630585
changelog
adriangb Sep 1, 2021
4e00693
run generate because why not make this more complicated and convolute…
adriangb Sep 1, 2021
af1075f
manually apply formatting because everything has to be broken
adriangb Sep 1, 2021
b2a09fe
use single attribute
adriangb Sep 1, 2021
9ad8d43
update installs:
adriangb Sep 1, 2021
189f6f5
Update tox.ini
adriangb Sep 1, 2021
34887a4
Update tox.ini
adriangb Sep 1, 2021
7e76de3
Update tox.ini
adriangb Sep 1, 2021
a7e82d5
run black manually
adriangb Sep 1, 2021
7cd3d1d
Merge branch 'main' into falcon-3-redux
adriangb Sep 1, 2021
a1ec1bc
Merge branch 'falcon-3-redux' of https://github.com/adriangb/opentele…
adriangb Sep 1, 2021
6bf85a3
Merge branch 'main' into falcon-3-redux
owais Sep 2, 2021
afac5c9
Use falcon.App for Falcon 3, inject remote_adr since Falcon 3 does no…
adriangb Sep 2, 2021
139ccbd
Just missing exception info now
adriangb Sep 2, 2021
1e18658
Merge branch 'main' into falcon-3-redux
adriangb Sep 16, 2021
cc99277
Get exc_info from _handle_exception
adriangb Sep 16, 2021
b6ef52d
run tox generate
adriangb Sep 16, 2021
5e14752
ignore pylint error
adriangb Sep 16, 2021
16f91cf
Use the same method everywhere
adriangb Sep 16, 2021
89d1c23
check for exc
adriangb Sep 16, 2021
9b2e8c5
Now always add attributes in middleware
adriangb Sep 16, 2021
26f5d32
update generated code
adriangb Sep 16, 2021
8eda7b6
add status.description assertions
adriangb Sep 16, 2021
f3ce4f9
tox -e generate again
adriangb Sep 16, 2021
3d9ad0a
Merge branch 'main' into falcon-3-redux
adriangb Sep 16, 2021
5dafc13
Merge branch 'main' into falcon-3-redux
adriangb Sep 17, 2021
6b73d23
Merge branch 'main' into falcon-3-redux
adriangb Sep 21, 2021
3266b8f
Merge branch 'main' into falcon-3-redux
ocelotl Sep 24, 2021
18d4b53
Merge branch 'main' into falcon-3-redux
adriangb Sep 27, 2021
bff338f
Merge branch 'main' into falcon-3-redux
lzchen Sep 27, 2021
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased](https://github.com/open-telemetry/opentelemetry-python/compare/v1.5.0-0.24b0...HEAD)

### Changed
- Tests for Falcon 3 support
([#644](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/644))

## [1.5.0-0.24b0](https://github.com/open-telemetry/opentelemetry-python/releases/tag/v1.5.0-0.24b0) - 2021-08-26

### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ OpenTelemetry Falcon Tracing
This library builds on the OpenTelemetry WSGI middleware to track web requests
in Falcon applications.

Currently, only Falcon v2 is supported.

Installation
------------

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,25 @@ def instrumentation_dependencies(self) -> Collection[str]:
return _instruments

def _instrument(self, **kwargs):
self._original_falcon_api = falcon.API
falcon.API = partial(_InstrumentedFalconAPI, **kwargs)
self._original_falcon_api = None
if hasattr(falcon, "App"):
# Falcon 3
falcon.App = partial(
_InstrumentedFalconAPI, **kwargs
)
self._original_falcon_api = falcon.API
else:
# Falcon 2
self._original_falcon_api = falcon.API
falcon.API = partial(_InstrumentedFalconAPI, **kwargs)

def _uninstrument(self, **kwargs):
falcon.API = self._original_falcon_api

if hasattr(falcon, "App"):
# Falcon 3
falcon.App = self._original_falcon_api
else:
# Falcon 2
falcon.API = self._original_falcon_api

class _InstrumentedFalconAPI(falcon.API):
def __init__(self, *args, **kwargs):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# limitations under the License.


_instruments = ("falcon ~= 2.0",)
_instruments = ("falcon >= 2.0.0, < 4.0.0",)
12 changes: 7 additions & 5 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ envlist =
pypy3-test-instrumentation-elasticsearch{2,5,6}

; opentelemetry-instrumentation-falcon
py3{4,5,6,7,8,9}-test-instrumentation-falcon
pypy3-test-instrumentation-falcon
py3{4,5,6,7,8,9}-test-instrumentation-falcon{2,3}
pypy3-test-instrumentation-falcon{2,3}

; opentelemetry-instrumentation-fastapi
; fastapi only supports 3.6 and above.
Expand Down Expand Up @@ -174,6 +174,8 @@ deps =
; FIXME: Elasticsearch >=7 causes CI workflow tests to hang, see open-telemetry/opentelemetry-python-contrib#620
; elasticsearch7: elasticsearch-dsl>=7.0,<8.0
; elasticsearch7: elasticsearch>=7.0,<8.0
falcon2: falcon >=2.0.0,<=3.0.0
adriangb marked this conversation as resolved.
Show resolved Hide resolved
falcon2: falcon >=3.0.0,<=4.0.0
adriangb marked this conversation as resolved.
Show resolved Hide resolved
sqlalchemy11: sqlalchemy>=1.1,<1.2
sqlalchemy14: aiosqlite
sqlalchemy14: sqlalchemy~=1.4
Expand All @@ -192,7 +194,7 @@ changedir =
test-instrumentation-dbapi: instrumentation/opentelemetry-instrumentation-dbapi/tests
test-instrumentation-django: instrumentation/opentelemetry-instrumentation-django/tests
test-instrumentation-elasticsearch{2,5,6}: instrumentation/opentelemetry-instrumentation-elasticsearch/tests
test-instrumentation-falcon: instrumentation/opentelemetry-instrumentation-falcon/tests
test-instrumentation-falcon{2,3}: instrumentation/opentelemetry-instrumentation-falcon/tests
test-instrumentation-fastapi: instrumentation/opentelemetry-instrumentation-fastapi/tests
test-instrumentation-flask: instrumentation/opentelemetry-instrumentation-flask/tests
test-instrumentation-urllib: instrumentation/opentelemetry-instrumentation-urllib/tests
Expand Down Expand Up @@ -236,15 +238,15 @@ commands_pre =
grpc: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-grpc[test]

falcon,flask,django,pyramid,tornado,starlette,fastapi,aiohttp,asgi,requests,urllib,wsgi: pip install {toxinidir}/util/opentelemetry-util-http[test]
wsgi,falcon,flask,django,pyramid: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-wsgi[test]
wsgi,falcon{2,3},flask,django,pyramid: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-wsgi[test]
asgi,starlette,fastapi: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-asgi[test]

asyncpg: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-asyncpg[test]

boto: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-botocore[test]
boto: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-boto[test]

falcon: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-falcon[test]
falcon{2,3}: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-falcon[test]

flask: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-flask[test]

Expand Down