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

Expand allowed versions for jinja2 instrumentation #712

Merged
merged 20 commits into from
Oct 12, 2021
Merged
Show file tree
Hide file tree
Changes from 7 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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `opentelemetry-sdk-extension-aws` Release AWS Python SDK Extension as 1.0.0
([#667](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/667))

### Changed
- `opentelemetry-instrumentation-jinja2` Allow instrumentation of newer Jinja2 versions.

### Added
- `opentelemetry-instrumentation-elasticsearch` Added `response_hook` and `request_hook` callbacks
([#670](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/670))
Expand Down
138 changes: 138 additions & 0 deletions bootstrap_gen.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
# Copyright The OpenTelemetry Authors
andrew-matteson marked this conversation as resolved.
Show resolved Hide resolved
#
# 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.

# DO NOT EDIT. THIS FILE WAS AUTOGENERATED FROM INSTRUMENTATION PACKAGES.
# RUN `python scripts/generate_instrumentation_bootstrap.py` TO REGENERATE.

libraries = {
"aiohttp": {
"library": "aiohttp ~= 3.0",
"instrumentation": "opentelemetry-instrumentation-aiohttp-client==0.24b0",
},
"aiopg": {
"library": "aiopg >= 0.13.0, < 1.3.0",
"instrumentation": "opentelemetry-instrumentation-aiopg==0.24b0",
},
"asgiref": {
"library": "asgiref ~= 3.0",
"instrumentation": "opentelemetry-instrumentation-asgi==0.24b0",
},
"asyncpg": {
"library": "asyncpg >= 0.12.0",
"instrumentation": "opentelemetry-instrumentation-asyncpg==0.24b0",
},
"boto": {
"library": "boto~=2.0",
"instrumentation": "opentelemetry-instrumentation-boto==0.24b0",
},
"botocore": {
"library": "botocore ~= 1.0",
"instrumentation": "opentelemetry-instrumentation-botocore==0.24b0",
},
"celery": {
"library": "celery >= 4.0, < 6.0",
"instrumentation": "opentelemetry-instrumentation-celery==0.24b0",
},
"django": {
"library": "django >= 1.10",
"instrumentation": "opentelemetry-instrumentation-django==0.24b0",
},
"elasticsearch": {
"library": "elasticsearch >= 2.0",
"instrumentation": "opentelemetry-instrumentation-elasticsearch==0.24b0",
},
"falcon": {
"library": "falcon >= 2.0.0, < 4.0.0",
"instrumentation": "opentelemetry-instrumentation-falcon==0.24b0",
},
"fastapi": {
"library": "fastapi ~= 0.58",
"instrumentation": "opentelemetry-instrumentation-fastapi==0.24b0",
},
"flask": {
"library": "flask >= 1.0, < 3.0",
"instrumentation": "opentelemetry-instrumentation-flask==0.24b0",
},
"grpcio": {
"library": "grpcio ~= 1.27",
"instrumentation": "opentelemetry-instrumentation-grpc==0.24b0",
},
"httpx": {
"library": "httpx >= 0.18.0, < 0.19.0",
"instrumentation": "opentelemetry-instrumentation-httpx==0.24b0",
},
"jinja2": {
"library": "jinja2>=2.7,<4.0",
"instrumentation": "opentelemetry-instrumentation-jinja2==0.24b0",
},
"mysql-connector-python": {
"library": "mysql-connector-python ~= 8.0",
"instrumentation": "opentelemetry-instrumentation-mysql==0.24b0",
},
"psycopg2": {
"library": "psycopg2 >= 2.7.3.1",
"instrumentation": "opentelemetry-instrumentation-psycopg2==0.24b0",
},
"pymemcache": {
"library": "pymemcache ~= 1.3",
"instrumentation": "opentelemetry-instrumentation-pymemcache==0.24b0",
},
"pymongo": {
"library": "pymongo ~= 3.1",
"instrumentation": "opentelemetry-instrumentation-pymongo==0.24b0",
},
"PyMySQL": {
"library": "PyMySQL ~= 0.10.1",
"instrumentation": "opentelemetry-instrumentation-pymysql==0.24b0",
},
"pyramid": {
"library": "pyramid >= 1.7",
"instrumentation": "opentelemetry-instrumentation-pyramid==0.24b0",
},
"redis": {
"library": "redis >= 2.6",
"instrumentation": "opentelemetry-instrumentation-redis==0.24b0",
},
"requests": {
"library": "requests ~= 2.0",
"instrumentation": "opentelemetry-instrumentation-requests==0.24b0",
},
"scikit-learn": {
"library": "scikit-learn ~= 0.24.0",
"instrumentation": "opentelemetry-instrumentation-sklearn==0.24b0",
},
"sqlalchemy": {
"library": "sqlalchemy",
"instrumentation": "opentelemetry-instrumentation-sqlalchemy==0.24b0",
},
"starlette": {
"library": "starlette ~= 0.13.0",
"instrumentation": "opentelemetry-instrumentation-starlette==0.24b0",
},
"tornado": {
"library": "tornado >= 6.0",
"instrumentation": "opentelemetry-instrumentation-tornado==0.24b0",
},
"urllib3": {
"library": "urllib3 >= 1.0.0, < 2.0.0",
"instrumentation": "opentelemetry-instrumentation-urllib3==0.24b0",
},
}
default_instrumentations = [
"opentelemetry-instrumentation-dbapi==0.24b0",
"opentelemetry-instrumentation-logging==0.24b0",
"opentelemetry-instrumentation-sqlite3==0.24b0",
"opentelemetry-instrumentation-urllib==0.24b0",
"opentelemetry-instrumentation-wsgi==0.24b0",
]
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# limitations under the License.


_instruments = ("jinja2~=2.7",)
_instruments = ("jinja2>=2.7,<4.0",)
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from packaging import version
import os
from unittest import mock

Expand All @@ -31,8 +32,13 @@ def setUp(self):
super().setUp()
Jinja2Instrumentor().instrument()
# prevent cache effects when using Template('code...')
# pylint: disable=protected-access
jinja2.environment._spontaneous_environments.clear()
if version.parse(jinja2.__version__) >= version.parse('3.0.0'):
# by clearing functools.lru_cache
jinja2.environment.get_spontaneous_environment.clear()
else:
# by clearing jinja2.utils.LRUCache
jinja2.environment._spontaneous_environments.clear()

self.tracer = get_tracer(__name__)

def tearDown(self):
Expand Down