Skip to content

Commit

Permalink
Merge branch 'main' into mg-use-request-id-instead-of-thread-id
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewgrossman committed Apr 7, 2023
2 parents 282da72 + a7a4f71 commit 3e1711c
Show file tree
Hide file tree
Showing 140 changed files with 1,526 additions and 857 deletions.
3 changes: 3 additions & 0 deletions .github/component_owners.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,6 @@ components:

instrumentation/opentelemetry-instrumentation-urllib3:
- shalevr

instrumentation/opentelemetry-instrumentation-sqlalchemy:
- shalevr
File renamed without changes.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ jobs:
--title "Version ${STABLE_VERSION}/${UNSTABLE_VERSION}" \
--notes-file /tmp/release-notes.txt \
--discussion-category announcements \
v$STABLE_VERSION
v$UNSTABLE_VERSION
- uses: actions/checkout@v3
with:
Expand Down
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: d0bb12b34b0c487198c935001636b6163485a50f
CORE_REPO_SHA: 2387b4465d930b020df79692a8097e1d54b66ec1

jobs:
build:
Expand Down
34 changes: 34 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,49 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

- `opentelemetry-instrumentation-system-metrics` Add `process.` prefix to `runtime.memory`, `runtime.cpu.time`, and `runtime.gc_count`. Change `runtime.memory` from count to UpDownCounter. ([#1735](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1735))

### Added

- Add `excluded_urls` functionality to `urllib` and `urllib3` instrumentations
([#1733](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1733))
- Make Django request span attributes available for `start_span`.
([#1730](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1730))

### Fixed

- Fix `AttributeError` when AWS Lambda handler receives a list event
([#1738](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1738))


## Version 1.17.0/0.38b0 (2023-03-22)

### Added

- Add connection attributes to sqlalchemy connect span
([#1608](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1608))
- Add support for enabling Redis sanitization from environment variable
([#1690](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1690))
- Add metrics instrumentation for sqlalchemy
([#1645](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1645))

### Fixed

- Fix Flask instrumentation to only close the span if it was created by the same thread.
([#1654](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1654))
- Fix confluent-kafka instrumentation by allowing Producer headers to be dict or list
([#1655](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1655))
- `opentelemetry-instrumentation-system-metrics` Fix initialization of the instrumentation class when configuration is provided
([#1438](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1439))
- Fix exception in Urllib3 when dealing with filelike body.
([#1399](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1399))
- Fix httpx resource warnings
([#1695](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1695))

### Changed

- `opentelemetry-instrumentation-requests` Replace `name_callback` and `span_callback` with standard `response_hook` and `request_hook` callbacks
([#670](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/670))

## Version 1.16.0/0.37b0 (2023-02-17)

Expand Down
14 changes: 7 additions & 7 deletions RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Preparing a new major or minor release

* Run the [Prepare release branch workflow](https://github.com/open-telemetry/opentelemetry-python/actions/workflows/prepare-release-branch.yml).
* Run the [Prepare release branch workflow](https://github.com/open-telemetry/opentelemetry-python-contrib/actions/workflows/prepare-release-branch.yml).
* Press the "Run workflow" button, and leave the default branch `main` selected.
* If making a pre-release of stable components (e.g. release candidate),
enter the pre-release version number, e.g. `1.9.0rc2`.
Expand All @@ -13,21 +13,21 @@
## Preparing a new patch release

* Backport pull request(s) to the release branch.
* Run the [Backport workflow](https://github.com/open-telemetry/opentelemetry-python/actions/workflows/backport.yml).
* Run the [Backport workflow](https://github.com/open-telemetry/opentelemetry-python-contrib/actions/workflows/backport.yml).
* Press the "Run workflow" button, then select the release branch from the dropdown list,
e.g. `release/v1.9.x`, then enter the pull request number that you want to backport,
then click the "Run workflow" button below that.
* Review and merge the backport pull request that it generates.
* Merge a pull request to the release branch updating the `CHANGELOG.md`.
* The heading for the unreleased entries should be `## Unreleased`.
* Run the [Prepare patch release workflow](https://github.com/open-telemetry/opentelemetry-python/actions/workflows/prepare-patch-release.yml).
* Run the [Prepare patch release workflow](https://github.com/open-telemetry/opentelemetry-python-contrib/actions/workflows/prepare-patch-release.yml).
* Press the "Run workflow" button, then select the release branch from the dropdown list,
e.g. `release/v1.9.x`, and click the "Run workflow" button below that.
* Review and merge the pull request that it creates for updating the version.

## Making the release

* Run the [Release workflow](https://github.com/open-telemetry/opentelemetry-python/actions/workflows/release.yml).
* Run the [Release workflow](https://github.com/open-telemetry/opentelemetry-python-contrib/actions/workflows/release.yml).
* Press the "Run workflow" button, then select the release branch from the dropdown list,
e.g. `release/v1.9.x`, and click the "Run workflow" button below that.
* This workflow will publish the artifacts and publish a GitHub release with release notes based on the change log.
Expand Down Expand Up @@ -69,9 +69,9 @@
## After the release

* Check PyPI
* This should be handled automatically on release by the [publish action](https://github.com/open-telemetry/opentelemetry-python/blob/main/.github/workflows/publish.yml).
* Check the [action logs](https://github.com/open-telemetry/opentelemetry-python/actions?query=workflow%3APublish) to make sure packages have been uploaded to PyPI
* Check the release history (e.g. https://pypi.org/project/opentelemetry-api/#history) on PyPI
* This should be handled automatically on release by the [publish action](https://github.com/open-telemetry/opentelemetry-python-contrib/blob/main/.github/workflows/release.yml).
* Check the [action logs](https://github.com/open-telemetry/opentelemetry-python-contrib/actions/workflows/release.yml) to make sure packages have been uploaded to PyPI
* Check the release history (e.g. https://pypi.org/project/opentelemetry-instrumentation/#history) on PyPI
* If for some reason the action failed, see [Publish failed](#publish-failed) below
* Move stable tag
* Run the following (TODO automate):
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.38b0.dev"
__version__ = "0.39b0.dev"
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.17.0.dev
version=1.18.0.dev

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

[prerelease]
version=0.38b0.dev
version=0.39b0.dev

packages=
all
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ WORKDIR /code
COPY . .

RUN pip install -e .
RUN pip install -r ./examples/requirements.txt
RUN pip install -r ./example/requirements.txt

CMD ["python", "./examples/sampleapp.py"]
CMD ["python", "./example/sampleapp.py"]
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ data
*Users do not need to install Python as the app will be run in the Docker Container*

## Instructions
1. Run `docker-compose up -d` in the the `examples/` directory
1. Run `docker-compose up -d` in the the `example/` directory

The `-d` flag causes all services to run in detached mode and frees up your
terminal session. This also causes no logs to show up. Users can attach themselves to the service's logs manually using `docker logs ${CONTAINER_ID} --follow`
Expand All @@ -39,4 +39,4 @@ terminal session. This also causes no logs to show up. Users can attach themselv
* Click the refresh button and data should show up on the graph

6. Shutdown the services when finished
* Run `docker-compose down` in the examples directory
* Run `docker-compose down` in the example directory
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ services:
sample_app:
build:
context: ../
dockerfile: ./examples/Dockerfile
dockerfile: ./example/Dockerfile
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.38b0.dev"
__version__ = "0.39b0.dev"
2 changes: 1 addition & 1 deletion exporter/opentelemetry-exporter-richconsole/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ classifiers = [
dependencies = [
"opentelemetry-api ~= 1.12",
"opentelemetry-sdk ~= 1.12",
"opentelemetry-semantic-conventions == 0.38b0.dev",
"opentelemetry-semantic-conventions == 0.39b0.dev",
"rich>=10.0.0",
]

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.38b0.dev"
__version__ = "0.39b0.dev"
4 changes: 2 additions & 2 deletions instrumentation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
| [opentelemetry-instrumentation-django](./opentelemetry-instrumentation-django) | django >= 1.10 | Yes
| [opentelemetry-instrumentation-elasticsearch](./opentelemetry-instrumentation-elasticsearch) | elasticsearch >= 2.0 | No
| [opentelemetry-instrumentation-falcon](./opentelemetry-instrumentation-falcon) | falcon >= 1.4.1, < 4.0.0 | Yes
| [opentelemetry-instrumentation-fastapi](./opentelemetry-instrumentation-fastapi) | fastapi <= 0.90.1 | Yes
| [opentelemetry-instrumentation-fastapi](./opentelemetry-instrumentation-fastapi) | fastapi ~= 0.58 | Yes
| [opentelemetry-instrumentation-flask](./opentelemetry-instrumentation-flask) | flask >= 1.0, < 3.0 | Yes
| [opentelemetry-instrumentation-grpc](./opentelemetry-instrumentation-grpc) | grpcio ~= 1.27 | No
| [opentelemetry-instrumentation-httpx](./opentelemetry-instrumentation-httpx) | httpx >= 0.18.0 | No
Expand All @@ -34,7 +34,7 @@
| [opentelemetry-instrumentation-remoulade](./opentelemetry-instrumentation-remoulade) | remoulade >= 0.50 | No
| [opentelemetry-instrumentation-requests](./opentelemetry-instrumentation-requests) | requests ~= 2.0 | Yes
| [opentelemetry-instrumentation-sklearn](./opentelemetry-instrumentation-sklearn) | scikit-learn ~= 0.24.0 | No
| [opentelemetry-instrumentation-sqlalchemy](./opentelemetry-instrumentation-sqlalchemy) | sqlalchemy | No
| [opentelemetry-instrumentation-sqlalchemy](./opentelemetry-instrumentation-sqlalchemy) | sqlalchemy | Yes
| [opentelemetry-instrumentation-sqlite3](./opentelemetry-instrumentation-sqlite3) | sqlite3 | No
| [opentelemetry-instrumentation-starlette](./opentelemetry-instrumentation-starlette) | starlette ~= 0.13.0 | Yes
| [opentelemetry-instrumentation-system-metrics](./opentelemetry-instrumentation-system-metrics) | psutil >= 5 | No
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ instruments = [
]
test = [
"opentelemetry-instrumentation-aio-pika[instruments]",
"opentelemetry-test-utils == 0.38b0.dev",
"opentelemetry-test-utils == 0.39b0.dev",
"pytest",
"wrapt >= 1.0.0, < 2.0.0",
]
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.38b0.dev"
__version__ = "0.39b0.dev"
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ classifiers = [
]
dependencies = [
"opentelemetry-api ~= 1.12",
"opentelemetry-instrumentation == 0.38b0.dev",
"opentelemetry-semantic-conventions == 0.38b0.dev",
"opentelemetry-util-http == 0.38b0.dev",
"opentelemetry-instrumentation == 0.39b0.dev",
"opentelemetry-semantic-conventions == 0.39b0.dev",
"opentelemetry-util-http == 0.39b0.dev",
"wrapt >= 1.0.0, < 2.0.0",
]

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.38b0.dev"
__version__ = "0.39b0.dev"
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ classifiers = [
]
dependencies = [
"opentelemetry-api ~= 1.12",
"opentelemetry-instrumentation == 0.38b0.dev",
"opentelemetry-instrumentation-dbapi == 0.38b0.dev",
"opentelemetry-instrumentation == 0.39b0.dev",
"opentelemetry-instrumentation-dbapi == 0.39b0.dev",
"wrapt >= 1.0.0, < 2.0.0",
]

Expand All @@ -37,8 +37,8 @@ instruments = [
]
test = [
"opentelemetry-instrumentation-aiopg[instruments]",
"opentelemetry-semantic-conventions == 0.38b0.dev",
"opentelemetry-test-utils == 0.38b0.dev",
"opentelemetry-semantic-conventions == 0.39b0.dev",
"opentelemetry-test-utils == 0.39b0.dev",
]

[project.entry-points.opentelemetry_instrumentor]
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.38b0.dev"
__version__ = "0.39b0.dev"
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ classifiers = [
dependencies = [
"asgiref ~= 3.0",
"opentelemetry-api ~= 1.12",
"opentelemetry-instrumentation == 0.38b0.dev",
"opentelemetry-semantic-conventions == 0.38b0.dev",
"opentelemetry-util-http == 0.38b0.dev",
"opentelemetry-instrumentation == 0.39b0.dev",
"opentelemetry-semantic-conventions == 0.39b0.dev",
"opentelemetry-util-http == 0.39b0.dev",
]

[project.optional-dependencies]
Expand All @@ -38,7 +38,7 @@ instruments = [
]
test = [
"opentelemetry-instrumentation-asgi[instruments]",
"opentelemetry-test-utils == 0.38b0.dev",
"opentelemetry-test-utils == 0.39b0.dev",
]

[project.urls]
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.38b0.dev"
__version__ = "0.39b0.dev"
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ classifiers = [
]
dependencies = [
"opentelemetry-api ~= 1.12",
"opentelemetry-instrumentation == 0.38b0.dev",
"opentelemetry-semantic-conventions == 0.38b0.dev",
"opentelemetry-instrumentation == 0.39b0.dev",
"opentelemetry-semantic-conventions == 0.39b0.dev",
]

[project.optional-dependencies]
Expand All @@ -36,7 +36,7 @@ instruments = [
]
test = [
"opentelemetry-instrumentation-asyncpg[instruments]",
"opentelemetry-test-utils == 0.38b0.dev",
"opentelemetry-test-utils == 0.39b0.dev",
]

[project.entry-points.opentelemetry_instrumentor]
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.38b0.dev"
__version__ = "0.39b0.dev"
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ classifiers = [
"Programming Language :: Python :: 3.8",
]
dependencies = [
"opentelemetry-instrumentation == 0.38b0.dev",
"opentelemetry-instrumentation == 0.39b0.dev",
"opentelemetry-propagator-aws-xray == 1.0.1",
"opentelemetry-semantic-conventions == 0.38b0.dev",
"opentelemetry-semantic-conventions == 0.39b0.dev",
]

[project.optional-dependencies]
instruments = []
test = [
"opentelemetry-test-utils == 0.38b0.dev",
"opentelemetry-test-utils == 0.39b0.dev",
]

[project.urls]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
# Copy this snippet into an AWS Lambda function
import boto3
from opentelemetry.instrumentation.botocore import AwsBotocoreInstrumentor
from opentelemetry.instrumentation.botocore import BotocoreInstrumentor
from opentelemetry.instrumentation.aws_lambda import AwsLambdaInstrumentor
# Enable instrumentation
AwsBotocoreInstrumentor().instrument()
BotocoreInstrumentor().instrument()
AwsLambdaInstrumentor().instrument()
# Lambda function
Expand Down Expand Up @@ -342,7 +342,9 @@ def _instrumented_lambda_handler_call( # noqa pylint: disable=too-many-branches
# If the request came from an API Gateway, extract http attributes from the event
# https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/instrumentation/aws-lambda.md#api-gateway
# https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/http.md#http-server-semantic-conventions
if lambda_event and lambda_event.get("requestContext"):
if isinstance(lambda_event, dict) and lambda_event.get(
"requestContext"
):
span.set_attribute(SpanAttributes.FAAS_TRIGGER, "http")

if lambda_event.get("version") == "2.0":
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.38b0.dev"
__version__ = "0.39b0.dev"
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,15 @@ def test_api_gateway_http_api_proxy_event_sets_attributes(self):
},
)

def test_lambda_handles_list_event(self):
AwsLambdaInstrumentor().instrument()

mock_execute_lambda([{"message": "test"}])

spans = self.memory_exporter.get_finished_spans()

assert spans

def test_uninstrument(self):
AwsLambdaInstrumentor().instrument()

Expand Down
Loading

0 comments on commit 3e1711c

Please sign in to comment.