Skip to content

Commit

Permalink
Merge branch 'main' into asgi-traceresponse
Browse files Browse the repository at this point in the history
  • Loading branch information
phillipuniverse committed Dec 21, 2021
2 parents 9c40351 + 30d0c2e commit 6c9afa6
Show file tree
Hide file tree
Showing 90 changed files with 311 additions and 211 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- 'release/*'
pull_request:
env:
CORE_REPO_SHA: 82a40052d2a49615b745fcbc890c9aabd6f88140
CORE_REPO_SHA: f0d559f5a8c40185e4cada6ed1914642b937f256

jobs:
build:
Expand Down
13 changes: 12 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,15 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased](https://github.com/open-telemetry/opentelemetry-python/compare/v1.7.0-0.26b0...HEAD)
## [Unreleased](https://github.com/open-telemetry/opentelemetry-python/compare/v1.8.0-0.27b0...HEAD)

## [1.8.0-0.27b0](https://github.com/open-telemetry/opentelemetry-python/releases/tag/v1.8.0-0.27b0) - 2021-12-17



### Added

- `opentelemetry-instrumentation-aws-lambda` Adds support for configurable flush timeout via `OTEL_INSTRUMENTATION_AWS_LAMBDA_FLUSH_TIMEOUT` property. ([#825](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/825))

### Added

Expand All @@ -19,6 +27,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- `opentelemetry-instrumentation-tornado` Add support instrumentation for Tornado 5.1.1
([#812](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/812))

- `opentelemetry-instrumentation-flask` Flask: Conditionally create SERVER spans
([#828](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/828))

## [1.7.1-0.26b1](https://github.com/open-telemetry/opentelemetry-python/releases/tag/v1.7.0-0.26b0) - 2021-11-11

Expand Down
2 changes: 1 addition & 1 deletion _template/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.

__version__ = "0.26b1"
__version__ = "0.27b0"
4 changes: 2 additions & 2 deletions eachdist.ini
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ sortfirst=
ext/*

[stable]
version=1.7.1
version=1.8.0

packages=
opentelemetry-sdk
Expand All @@ -34,7 +34,7 @@ packages=
opentelemetry-api

[prerelease]
version=0.26b1
version=0.27b0

packages=
all
Expand Down
2 changes: 1 addition & 1 deletion exporter/opentelemetry-exporter-datadog/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ install_requires =
ddtrace>=0.34.0,<0.47.0
opentelemetry-api ~= 1.3
opentelemetry-sdk ~= 1.3
opentelemetry-semantic-conventions == 0.26b1
opentelemetry-semantic-conventions == 0.27b0

[options.packages.find]
where = src
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.

__version__ = "0.26b1"
__version__ = "0.27b0"
2 changes: 1 addition & 1 deletion exporter/opentelemetry-exporter-richconsole/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ install_requires =
rich>=10.0.0
opentelemetry-api ~= 1.3
opentelemetry-sdk ~= 1.3
opentelemetry-semantic-conventions == 0.26b1
opentelemetry-semantic-conventions == 0.27b0

[options.packages.find]
where = src
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.

__version__ = "0.26b1"
__version__ = "0.27b0"
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ package_dir=
packages=find_namespace:
install_requires =
opentelemetry-api ~= 1.3
opentelemetry-semantic-conventions == 0.26b1
opentelemetry-instrumentation == 0.26b1
opentelemetry-util-http == 0.26b1
opentelemetry-semantic-conventions == 0.27b0
opentelemetry-instrumentation == 0.27b0
opentelemetry-util-http == 0.27b0
wrapt >= 1.0.0, < 2.0.0

[options.packages.find]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.

__version__ = "0.26b1"
__version__ = "0.27b0"
8 changes: 4 additions & 4 deletions instrumentation/opentelemetry-instrumentation-aiopg/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ package_dir=
packages=find_namespace:
install_requires =
opentelemetry-api ~= 1.3
opentelemetry-instrumentation-dbapi == 0.26b1
opentelemetry-instrumentation == 0.26b1
opentelemetry-instrumentation-dbapi == 0.27b0
opentelemetry-instrumentation == 0.27b0
wrapt >= 1.0.0, < 2.0.0

[options.extras_require]
test =
opentelemetry-test-utils == 0.26b1
opentelemetry-semantic-conventions == 0.26b1
opentelemetry-test-utils == 0.27b0
opentelemetry-semantic-conventions == 0.27b0

[options.packages.find]
where = src
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.

__version__ = "0.26b1"
__version__ = "0.27b0"
8 changes: 4 additions & 4 deletions instrumentation/opentelemetry-instrumentation-asgi/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ package_dir=
packages=find_namespace:
install_requires =
opentelemetry-api ~= 1.3
opentelemetry-semantic-conventions == 0.26b1
opentelemetry-instrumentation == 0.26b1
opentelemetry-util-http == 0.26b1
opentelemetry-semantic-conventions == 0.27b0
opentelemetry-instrumentation == 0.27b0
opentelemetry-util-http == 0.27b0
asgiref ~= 3.0

[options.extras_require]
test =
opentelemetry-test-utils == 0.26b1
opentelemetry-test-utils == 0.27b0

[options.packages.find]
where = src
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.

__version__ = "0.26b1"
__version__ = "0.27b0"
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ package_dir=
packages=find_namespace:
install_requires =
opentelemetry-api ~= 1.3
opentelemetry-semantic-conventions == 0.26b1
opentelemetry-instrumentation == 0.26b1
opentelemetry-semantic-conventions == 0.27b0
opentelemetry-instrumentation == 0.27b0

[options.extras_require]
test =
opentelemetry-test-utils == 0.26b1
opentelemetry-test-utils == 0.27b0

[options.packages.find]
where = src
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.

__version__ = "0.26b1"
__version__ = "0.27b0"
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ package_dir=
=src
packages=find_namespace:
install_requires =
opentelemetry-instrumentation == 0.26b1
opentelemetry-instrumentation == 0.27b0
opentelemetry-propagator-aws-xray == 1.0.1
opentelemetry-semantic-conventions == 0.26b1
opentelemetry-semantic-conventions == 0.27b0

[options.extras_require]
test =
opentelemetry-test-utils == 0.26b1
opentelemetry-test-utils == 0.27b0

[options.packages.find]
where = src
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ def custom_event_context_extractor(lambda_event):
_HANDLER = "_HANDLER"
_X_AMZN_TRACE_ID = "_X_AMZN_TRACE_ID"
ORIG_HANDLER = "ORIG_HANDLER"
OTEL_INSTRUMENTATION_AWS_LAMBDA_FLUSH_TIMEOUT = (
"OTEL_INSTRUMENTATION_AWS_LAMBDA_FLUSH_TIMEOUT"
)


def _default_event_context_extractor(lambda_event: Any) -> Context:
Expand Down Expand Up @@ -167,6 +170,7 @@ def _determine_parent_context(
def _instrument(
wrapped_module_name,
wrapped_function_name,
flush_timeout,
event_context_extractor: Callable[[Any], Context],
tracer_provider: TracerProvider = None,
):
Expand Down Expand Up @@ -222,7 +226,7 @@ def _instrumented_lambda_handler_call(
# NOTE: `force_flush` before function quit in case of Lambda freeze.
# Assumes we are using the OpenTelemetry SDK implementation of the
# `TracerProvider`.
_tracer_provider.force_flush()
_tracer_provider.force_flush(flush_timeout)
except Exception: # pylint: disable=broad-except
logger.error(
"TracerProvider was missing `force_flush` method. This is necessary in case of a Lambda freeze and would exist in the OTel SDK implementation."
Expand Down Expand Up @@ -262,9 +266,22 @@ def _instrument(self, **kwargs):
self._wrapped_function_name,
) = lambda_handler.rsplit(".", 1)

flush_timeout_env = os.environ.get(
OTEL_INSTRUMENTATION_AWS_LAMBDA_FLUSH_TIMEOUT, ""
)
flush_timeout = 30000
try:
flush_timeout = int(flush_timeout_env)
except ValueError:
logger.warning(
"Could not convert OTEL_INSTRUMENTATION_AWS_LAMBDA_FLUSH_TIMEOUT value %s to int",
flush_timeout_env,
)

_instrument(
self._wrapped_module_name,
self._wrapped_function_name,
flush_timeout,
event_context_extractor=kwargs.get(
"event_context_extractor", _default_event_context_extractor
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.

__version__ = "0.26b1"
__version__ = "0.27b0"
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from opentelemetry.instrumentation.aws_lambda import (
_HANDLER,
_X_AMZN_TRACE_ID,
OTEL_INSTRUMENTATION_AWS_LAMBDA_FLUSH_TIMEOUT,
AwsLambdaInstrumentor,
)
from opentelemetry.propagate import get_global_textmap
Expand Down Expand Up @@ -246,3 +247,30 @@ def custom_event_context_extractor(lambda_event):
self.assertTrue(parent_context.is_remote)

test_env_patch.stop()

def test_lambda_no_error_with_invalid_flush_timeout(self):

test_env_patch = mock.patch.dict(
"os.environ",
{
**os.environ,
# NOT Active Tracing
_X_AMZN_TRACE_ID: MOCK_XRAY_TRACE_CONTEXT_NOT_SAMPLED,
# NOT using the X-Ray Propagator
OTEL_PROPAGATORS: "tracecontext",
OTEL_INSTRUMENTATION_AWS_LAMBDA_FLUSH_TIMEOUT: "invalid-timeout-string",
},
)
test_env_patch.start()

AwsLambdaInstrumentor().instrument()

mock_execute_lambda()

spans = self.memory_exporter.get_finished_spans()

assert spans

self.assertEqual(len(spans), 1)

test_env_patch.stop()
6 changes: 3 additions & 3 deletions instrumentation/opentelemetry-instrumentation-boto/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ package_dir=
packages=find_namespace:
install_requires =
opentelemetry-api ~= 1.3
opentelemetry-semantic-conventions == 0.26b1
opentelemetry-instrumentation == 0.26b1
opentelemetry-semantic-conventions == 0.27b0
opentelemetry-instrumentation == 0.27b0

[options.extras_require]
test =
moto~=2.0
opentelemetry-test-utils == 0.26b1
opentelemetry-test-utils == 0.27b0

[options.packages.find]
where = src
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.

__version__ = "0.26b1"
__version__ = "0.27b0"
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ package_dir=
packages=find_namespace:
install_requires =
opentelemetry-api ~= 1.3
opentelemetry-semantic-conventions == 0.26b1
opentelemetry-instrumentation == 0.26b1
opentelemetry-semantic-conventions == 0.27b0
opentelemetry-instrumentation == 0.27b0

[options.extras_require]
test =
moto[all] ~= 2.2.6
opentelemetry-test-utils == 0.26b1
opentelemetry-test-utils == 0.27b0

[options.packages.find]
where = src
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.

__version__ = "0.26b1"
__version__ = "0.27b0"
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ package_dir=
packages=find_namespace:
install_requires =
opentelemetry-api ~= 1.3
opentelemetry-semantic-conventions == 0.26b1
opentelemetry-instrumentation == 0.26b1
opentelemetry-semantic-conventions == 0.27b0
opentelemetry-instrumentation == 0.27b0

[options.extras_require]
test =
pytest
opentelemetry-test-utils == 0.26b1
opentelemetry-test-utils == 0.27b0

[options.packages.find]
where = src
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.

__version__ = "0.26b1"
__version__ = "0.27b0"
6 changes: 3 additions & 3 deletions instrumentation/opentelemetry-instrumentation-dbapi/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ package_dir=
packages=find_namespace:
install_requires =
opentelemetry-api ~= 1.3
opentelemetry-semantic-conventions == 0.26b1
opentelemetry-instrumentation == 0.26b1
opentelemetry-semantic-conventions == 0.27b0
opentelemetry-instrumentation == 0.27b0
wrapt >= 1.0.0, < 2.0.0

[options.extras_require]
test =
opentelemetry-test-utils == 0.26b1
opentelemetry-test-utils == 0.27b0

[options.packages.find]
where = src
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

__version__ = "0.26b1"
__version__ = "0.27b0"

_instruments = tuple()
Loading

0 comments on commit 6c9afa6

Please sign in to comment.