diff --git a/.github/workflows/public-api-check.yml b/.github/workflows/public-api-check.yml index eead4fa3681..46432af0b54 100644 --- a/.github/workflows/public-api-check.yml +++ b/.github/workflows/public-api-check.yml @@ -31,7 +31,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v2 with: - python-version: 3.9 + python-version: '3.10' - name: Install tox run: pip install tox==3.27.1 -U tox-factor diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e0951b7afd0..5ee26e52471 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,7 +10,7 @@ env: # Otherwise, set variable to the commit of your branch on # opentelemetry-python-contrib which is compatible with these Core repo # changes. - CONTRIB_REPO_SHA: 1f0dda9865b3c83e6dea2f2b127a2b0971853543 + CONTRIB_REPO_SHA: ca2c23fd3b91c48f2b6515658993480f634cf1b2 # This is needed because we do not clone the core repo in contrib builds anymore. # When running contrib builds as part of core builds, we use actions/checkout@v2 which # does not set an environment variable (simply just runs tox), which is different when @@ -101,7 +101,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v2 with: - python-version: 3.9 + python-version: '3.10' architecture: 'x64' - name: Install tox run: pip install tox==3.27.1 diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e0f6525920..5760da2be42 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,14 @@ 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 +- PeriodicExportingMetricReader will continue if collection times out + ([#3100](https://github.com/open-telemetry/opentelemetry-python/pull/3100)) +- Fix formatting of ConsoleMetricExporter. + ([#3197](https://github.com/open-telemetry/opentelemetry-python/pull/3197)) + +## Version 1.16.0/0.37b0 (2023-02-17) +- Change ``__all__`` to be statically defined. + ([#3143](https://github.com/open-telemetry/opentelemetry-python/pull/3143)) - Remove the ability to set a global metric prefix for Prometheus exporter ([#3137](https://github.com/open-telemetry/opentelemetry-python/pull/3137)) - Adds environment variables for log exporter @@ -29,6 +37,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fix use of built-in samplers in SDK configuration ([#3176](https://github.com/open-telemetry/opentelemetry-python/pull/3176)) + ## Version 1.15.0/0.36b0 (2022-12-09) - PeriodicExportingMetricsReader with +Inf interval diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e97e9daff22..daef82f90a6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,12 +1,9 @@ # Contributing to opentelemetry-python -The Python special interest group (SIG) meets regularly. See the OpenTelemetry -[community](https://github.com/open-telemetry/community#python-sdk) repo for -information on this and other language SIGs. +The Python special interest group (SIG) meets weekly on Thursdays at 9AM PST. Check the [OpenTelemetry community calendar](https://calendar.google.com/calendar/embed?src=google.com_b79e3e90j7bbsa2n2p5an5lf60%40group.calendar.google.com) for specific dates and Zoom meeting links. See the [public meeting notes](https://docs.google.com/document/d/1CIMGoIOZ-c3-igzbd6_Pnxx1SjAkjwqoYSUWxPY8XIs/edit) -for a summary description of past meetings. To request edit access, join the -meeting or get in touch on [Slack](https://cloud-native.slack.com/archives/C01PD4HUVBL). +for a summary description of past meetings. See to the [community membership document](https://github.com/open-telemetry/community/blob/main/community-membership.md) on how to become a [**Member**](https://github.com/open-telemetry/community/blob/main/community-membership.md#member), @@ -19,13 +16,7 @@ This is the main repo for OpenTelemetry Python. Nevertheless, there are other re Please take a look at this list first, your contributions may belong in one of these repos better: 1. [OpenTelemetry Contrib](https://github.com/open-telemetry/opentelemetry-python-contrib): Instrumentations for third-party - libraries and frameworks. There is an ongoing effort to migrate into the OpenTelemetry Contrib repo some of the existing - programmatic instrumentations that are now in the `ext` directory in the main OpenTelemetry repo. Please ask in the Slack - channel (see below) for guidance if you want to contribute with these instrumentations. - -# Find the right branch - -The default branch for this repo is `main`. All feature work is accomplished on branches from `main`. + libraries and frameworks. ## Find a Buddy and get Started Quickly! @@ -75,8 +66,8 @@ An easier way to do so is: We try to keep the amount of _public symbols_ in our code minimal. A public symbol is any Python identifier that does not start with an underscore. Every public symbol is something that has to be kept in order to maintain backwards compatibility, so we try to have as few as possible. -To check if your PR is adding public symbols, run `tox -e public-symbols-check`. This will always fail if public symbols are being added. The idea -behind this is that every PR that adds public symbols fails in CI, forcing reviewers to check the symbols to make sure they are strictly necessary. +To check if your PR is adding public symbols, run `tox -e public-symbols-check`. This will always fail if public symbols are being added/removed. The idea +behind this is that every PR that adds/removes public symbols fails in CI, forcing reviewers to check the symbols to make sure they are strictly necessary. If after checking them, it is considered that they are indeed necessary, the PR will be labeled with `Skip Public API check` so that this check is not run. @@ -95,7 +86,7 @@ CONTRIB_REPO_SHA=dde62cebffe519c35875af6d06fae053b3be65ec tox ``` The continuation integration overrides that environment variable with as per the configuration -[here](https://github.com/open-telemetry/opentelemetry-python/blob/9020b0baaeb41b7137badca988bb5c2d562cddee/.github/workflows/test.yml#L13). +[here](https://github.com/open-telemetry/opentelemetry-python/blob/main/.github/workflows/test.yml#L13). ### Benchmarks @@ -196,7 +187,7 @@ updating the GitHub workflow to reference a PR in the Contrib repo * Trivial change (typo, cosmetic, doc, etc.) doesn't have to wait for one day. * Urgent fix can take exception as long as it has been actively communicated. -Any Approver / Maintainer can merge the PR once it is **ready to merge**. +One of the maintainers will merge the PR once it is **ready to merge**. ## Design Choices diff --git a/README.md b/README.md index 03fcdf73b0b..1cad936e57c 100644 --- a/README.md +++ b/README.md @@ -1,50 +1,47 @@ -## OpenTelemetry Python ---- -<p align="center"> - <strong> - <a href="https://opentelemetry.io/docs/instrumentation/python/getting-started/">Getting Started<a/> - • - <a href="https://opentelemetry-python.readthedocs.io/">API Documentation<a/> - • - <a href="https://github.com/open-telemetry/opentelemetry-python/discussions">Getting In Touch (GitHub Discussions)<a/> - </strong> -</p> - -<p align="center"> - <a href="https://github.com/open-telemetry/opentelemetry-python/releases"> - <img alt="GitHub release (latest by date including pre-releases)" src="https://img.shields.io/github/v/release/open-telemetry/opentelemetry-python?include_prereleases&style=for-the-badge"> - </a> - <a href="https://codecov.io/gh/open-telemetry/opentelemetry-python/branch/main/"> - <img alt="Codecov Status" src="https://img.shields.io/codecov/c/github/open-telemetry/opentelemetry-python?style=for-the-badge"> - </a> - <a href="https://github.com/open-telemetry/opentelemetry-python/blob/main/LICENSE"> - <img alt="license" src="https://img.shields.io/badge/license-Apache_2.0-green.svg?style=for-the-badge"> - </a> - <br/> - <a href="https://github.com/open-telemetry/opentelemetry-python/actions?query=workflow%3ATest+branch%3Amaster"> - <img alt="Build Status" src="https://github.com/open-telemetry/opentelemetry-python/workflows/Test/badge.svg"> - </a> - <img alt="Beta" src="https://img.shields.io/badge/status-beta-informational?logo=data:image/png;base64,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"> -</p> - -<p align="center"> - <strong> - <a href="CONTRIBUTING.md">Contributing<a/> - • - <a href="https://opentelemetry-python.readthedocs.io/en/stable/#examples">Examples<a/> - </strong> -</p> - ---- - -This page describes the Python [OpenTelemetry](https://opentelemetry.io/) implementation. OpenTelemetry is an observability framework for cloud-native software. - -## Requirements -Unless otherwise noted, all published artifacts support Python 3.7 or higher. See CONTRIBUTING.md for additional instructions for building this project for development. +# OpenTelemetry Python +[![Slack](https://img.shields.io/badge/slack-@cncf/otel/python-brightgreen.svg?logo=slack)](https://cloud-native.slack.com/archives/C01PD4HUVBL) +[![Build Status](https://github.com/open-telemetry/opentelemetry-python/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/open-telemetry/opentelemetry-python/actions) +[![Minimum Python Version](https://img.shields.io/badge/python-3.7+-blue.svg)](https://www.python.org/downloads/) +[![Release](https://img.shields.io/github/v/release/open-telemetry/opentelemetry-python?include_prereleases&style=)](https://github.com/open-telemetry/opentelemetry-python/releases/) +[![Read the Docs](https://readthedocs.org/projects/opentelemetry-python/badge/?version=latest)](https://opentelemetry-python.readthedocs.io/en/latest/) + +## Project Status + +See the [OpenTelemetry Instrumentation for Python](https://opentelemetry.io/docs/instrumentation/python/#status-and-releases). + +| Signal | Status | Project | +| ------- | ------------ | ------- | +| Traces | Stable | N/A | +| Metrics | Stable | N/A | +| Logs | Experimental | N/A | + +Project versioning information and stability guarantees can be found [here](./rationale.md#versioning-and-releasing). ## Getting started -The goal of OpenTelemetry is to provide a single set of APIs to capture distributed traces and metrics from your application and send them to an observability platform. This project lets you do just that for applications written in Python. +You can find the getting started guide for OpenTelemetry Python [here](https://opentelemetry.io/docs/instrumentation/python/getting-started/). + +If you are looking for **examples** on how to use the OpenTelemetry API to +instrument your code manually, or how to set up the OpenTelemetry +Python SDK, see https://opentelemetry.io/docs/instrumentation/python/manual/. + +## Python Version Support + +This project ensures compatibility with the current supported versions of the Python. As new Python versions are released, support for them is added and +as old Python versions reach their end of life, support for them is removed. + +We add support for new Python versions no later than 3 months after they become stable. + +We remove support for old Python versions 6 months after they reach their [end of life](https://devguide.python.org/devcycle/#end-of-life-branches). + + +## Documentation + +The online documentation is available at https://opentelemetry-python.readthedocs.io/. +To access the latest version of the documentation, see +https://opentelemetry-python.readthedocs.io/en/latest/. + +## Install This repository includes multiple installable packages. The `opentelemetry-api` package includes abstract classes and no-op implementations that comprise the OpenTelemetry API following the @@ -91,60 +88,27 @@ pip install -e ./instrumentation/opentelemetry-instrumentation-{instrumentation} For additional exporter and instrumentation packages, see the [`opentelemetry-python-contrib`](https://github.com/open-telemetry/opentelemetry-python-contrib) repository. -## Running Performance Tests - -This section provides details on how to reproduce performance tests results on your own -machine. - -### Resource Usage Tests - -1. Install scalene using the following command - -```sh -pip install scalene -``` - -2. Run the `scalene` tests on any of the example Python programs - -```sh -scalene opentelemetry-<PACKAGE>/tests/performance/resource-usage/<PATH_TO_TEST>/profile_resource_usage_<NAME_OF_TEST>.py -``` - -## Python Version Support Addition and Removal - -This project supports the latest Python versions. As new Python versions are released, support for them is added and -as old Python versions reach their end of life, support for them is removed. - -We add support for new Python versions no later than 3 months after they become stable. - -We remove support for old Python versions 6 months after they reach their [end of life](https://devguide.python.org/devcycle/#end-of-life-branches). - -## Documentation - -The online documentation is available at https://opentelemetry-python.readthedocs.io/. -To access the latest version of the documentation, see -https://opentelemetry-python.readthedocs.io/en/latest/. - ## Contributing For information about contributing to OpenTelemetry Python, see [CONTRIBUTING.md](CONTRIBUTING.md). We meet weekly on Thursdays at 9AM PST. The meeting is subject to change depending on contributors' availability. Check the [OpenTelemetry community calendar](https://calendar.google.com/calendar/embed?src=google.com_b79e3e90j7bbsa2n2p5an5lf60%40group.calendar.google.com) for specific dates and Zoom meeting links. -Meeting notes are available as a public [Google doc](https://docs.google.com/document/d/1CIMGoIOZ-c3-igzbd6_Pnxx1SjAkjwqoYSUWxPY8XIs/edit). For edit access, get in touch on [GitHub Discussions](https://github.com/open-telemetry/opentelemetry-python/discussions). +Meeting notes are available as a public [Google doc](https://docs.google.com/document/d/1CIMGoIOZ-c3-igzbd6_Pnxx1SjAkjwqoYSUWxPY8XIs/edit). Approvers ([@open-telemetry/python-approvers](https://github.com/orgs/open-telemetry/teams/python-approvers)): - [Aaron Abbott](https://github.com/aabmass), Google -- [Owais Lone](https://github.com/owais), Splunk -- [Nathaniel Ruiz Nowell](https://github.com/NathanielRN), AWS +- [Sanket Mehta](https://github.com/sanketmehta28), Cisco Emeritus Approvers +- [Ashutosh Goel](https://github.com/ashu658), Cisco - [Carlos Alberto Cortez](https://github.com/carlosalberto), Lightstep - [Christian Neumüller](https://github.com/Oberon00), Dynatrace - [Hector Hernandez](https://github.com/hectorhdzg), Microsoft - [Mauricio Vásquez](https://github.com/mauriciovasquezbernal), Kinvolk +- [Nathaniel Ruiz Nowell](https://github.com/NathanielRN), AWS - [Tahir H. Butt](https://github.com/majorgreys) DataDog *For more information about the approver role, see the [community repository](https://github.com/open-telemetry/community/blob/main/community-membership.md#approver).* @@ -159,6 +123,7 @@ Emeritus Maintainers: - [Alex Boten](https://github.com/codeboten), Lightstep - [Chris Kleinknecht](https://github.com/c24t), Google +- [Owais Lone](https://github.com/owais), Splunk - [Reiley Yang](https://github.com/reyang), Microsoft - [Yusuke Tsutsumi](https://github.com/toumorokoshi), Google @@ -169,12 +134,3 @@ Emeritus Maintainers: <a href="https://github.com/open-telemetry/opentelemetry-python/graphs/contributors"> <img src="https://contributors-img.web.app/image?repo=open-telemetry/opentelemetry-python" /> </a> - -## Project Status - -For project boards and milestones, see the following links: -- [Project boards](https://github.com/open-telemetry/opentelemetry-python/projects) -- [Milestones](https://github.com/open-telemetry/opentelemetry-python/milestones) - -We try to keep these links accurate, so they're the best place to go for questions about project status. The dates and features described in the issues -and milestones are estimates and subject to change. diff --git a/docs/examples/fork-process-model/flask-gunicorn/requirements.txt b/docs/examples/fork-process-model/flask-gunicorn/requirements.txt index 86b654a95dc..3f9f6f6454a 100644 --- a/docs/examples/fork-process-model/flask-gunicorn/requirements.txt +++ b/docs/examples/fork-process-model/flask-gunicorn/requirements.txt @@ -16,5 +16,5 @@ protobuf==3.18.3 six==1.15.0 thrift==0.13.0 uWSGI==2.0.19.1 -Werkzeug==1.0.1 +Werkzeug==2.2.3 wrapt==1.12.1 diff --git a/docs/examples/fork-process-model/flask-uwsgi/requirements.txt b/docs/examples/fork-process-model/flask-uwsgi/requirements.txt index 86b654a95dc..3f9f6f6454a 100644 --- a/docs/examples/fork-process-model/flask-uwsgi/requirements.txt +++ b/docs/examples/fork-process-model/flask-uwsgi/requirements.txt @@ -16,5 +16,5 @@ protobuf==3.18.3 six==1.15.0 thrift==0.13.0 uWSGI==2.0.19.1 -Werkzeug==1.0.1 +Werkzeug==2.2.3 wrapt==1.12.1 diff --git a/eachdist.ini b/eachdist.ini index 6606776ecb4..164faad3d17 100644 --- a/eachdist.ini +++ b/eachdist.ini @@ -11,7 +11,7 @@ sortfirst= exporter/* [stable] -version=1.16.0.dev +version=1.17.0.dev packages= opentelemetry-sdk @@ -30,7 +30,7 @@ packages= opentelemetry-api [prerelease] -version=0.37b0.dev +version=0.38b0.dev packages= opentelemetry-opentracing-shim diff --git a/exporter/opentelemetry-exporter-jaeger-proto-grpc/src/opentelemetry/exporter/jaeger/proto/grpc/version.py b/exporter/opentelemetry-exporter-jaeger-proto-grpc/src/opentelemetry/exporter/jaeger/proto/grpc/version.py index 4209aaad38f..f90e55e55a1 100644 --- a/exporter/opentelemetry-exporter-jaeger-proto-grpc/src/opentelemetry/exporter/jaeger/proto/grpc/version.py +++ b/exporter/opentelemetry-exporter-jaeger-proto-grpc/src/opentelemetry/exporter/jaeger/proto/grpc/version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "1.16.0.dev" +__version__ = "1.17.0.dev" diff --git a/exporter/opentelemetry-exporter-jaeger-thrift/src/opentelemetry/exporter/jaeger/thrift/version.py b/exporter/opentelemetry-exporter-jaeger-thrift/src/opentelemetry/exporter/jaeger/thrift/version.py index 4209aaad38f..f90e55e55a1 100644 --- a/exporter/opentelemetry-exporter-jaeger-thrift/src/opentelemetry/exporter/jaeger/thrift/version.py +++ b/exporter/opentelemetry-exporter-jaeger-thrift/src/opentelemetry/exporter/jaeger/thrift/version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "1.16.0.dev" +__version__ = "1.17.0.dev" diff --git a/exporter/opentelemetry-exporter-jaeger/pyproject.toml b/exporter/opentelemetry-exporter-jaeger/pyproject.toml index c595f817f3b..5c64b989be7 100644 --- a/exporter/opentelemetry-exporter-jaeger/pyproject.toml +++ b/exporter/opentelemetry-exporter-jaeger/pyproject.toml @@ -26,8 +26,8 @@ classifiers = [ "Typing :: Typed", ] dependencies = [ - "opentelemetry-exporter-jaeger-proto-grpc == 1.16.0.dev", - "opentelemetry-exporter-jaeger-thrift == 1.16.0.dev", + "opentelemetry-exporter-jaeger-proto-grpc == 1.17.0.dev", + "opentelemetry-exporter-jaeger-thrift == 1.17.0.dev", ] [project.optional-dependencies] diff --git a/exporter/opentelemetry-exporter-jaeger/src/opentelemetry/exporter/jaeger/version.py b/exporter/opentelemetry-exporter-jaeger/src/opentelemetry/exporter/jaeger/version.py index 4209aaad38f..f90e55e55a1 100644 --- a/exporter/opentelemetry-exporter-jaeger/src/opentelemetry/exporter/jaeger/version.py +++ b/exporter/opentelemetry-exporter-jaeger/src/opentelemetry/exporter/jaeger/version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "1.16.0.dev" +__version__ = "1.17.0.dev" diff --git a/exporter/opentelemetry-exporter-opencensus/pyproject.toml b/exporter/opentelemetry-exporter-opencensus/pyproject.toml index 81d4546dd0c..8e359f5d4d5 100644 --- a/exporter/opentelemetry-exporter-opencensus/pyproject.toml +++ b/exporter/opentelemetry-exporter-opencensus/pyproject.toml @@ -28,7 +28,7 @@ classifiers = [ dependencies = [ "grpcio >= 1.0.0, < 2.0.0", "opencensus-proto >= 0.1.0, < 1.0.0", - "opentelemetry-api >= 1.16.0.dev", + "opentelemetry-api >= 1.17.0.dev", "opentelemetry-sdk >= 1.15", "protobuf ~= 3.13", "setuptools >= 16.0", diff --git a/exporter/opentelemetry-exporter-opencensus/src/opentelemetry/exporter/opencensus/version.py b/exporter/opentelemetry-exporter-opencensus/src/opentelemetry/exporter/opencensus/version.py index 0a47df4f5a0..8778b43b174 100644 --- a/exporter/opentelemetry-exporter-opencensus/src/opentelemetry/exporter/opencensus/version.py +++ b/exporter/opentelemetry-exporter-opencensus/src/opentelemetry/exporter/opencensus/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "0.37b0.dev" +__version__ = "0.38b0.dev" diff --git a/exporter/opentelemetry-exporter-otlp-proto-grpc/pyproject.toml b/exporter/opentelemetry-exporter-otlp-proto-grpc/pyproject.toml index 36401ac1069..aa369caf00b 100644 --- a/exporter/opentelemetry-exporter-otlp-proto-grpc/pyproject.toml +++ b/exporter/opentelemetry-exporter-otlp-proto-grpc/pyproject.toml @@ -30,8 +30,8 @@ dependencies = [ "googleapis-common-protos ~= 1.52", "grpcio >= 1.0.0, < 2.0.0", "opentelemetry-api ~= 1.15", - "opentelemetry-proto == 1.16.0.dev", - "opentelemetry-sdk ~= 1.16.0.dev", + "opentelemetry-proto == 1.17.0.dev", + "opentelemetry-sdk ~= 1.17.0.dev", ] [project.optional-dependencies] diff --git a/exporter/opentelemetry-exporter-otlp-proto-grpc/src/opentelemetry/exporter/otlp/proto/grpc/version.py b/exporter/opentelemetry-exporter-otlp-proto-grpc/src/opentelemetry/exporter/otlp/proto/grpc/version.py index 0b4a18e0a24..904e2b48efe 100644 --- a/exporter/opentelemetry-exporter-otlp-proto-grpc/src/opentelemetry/exporter/otlp/proto/grpc/version.py +++ b/exporter/opentelemetry-exporter-otlp-proto-grpc/src/opentelemetry/exporter/otlp/proto/grpc/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "1.16.0.dev" +__version__ = "1.17.0.dev" diff --git a/exporter/opentelemetry-exporter-otlp-proto-http/pyproject.toml b/exporter/opentelemetry-exporter-otlp-proto-http/pyproject.toml index b3a12fc91d1..9675d1d9826 100644 --- a/exporter/opentelemetry-exporter-otlp-proto-http/pyproject.toml +++ b/exporter/opentelemetry-exporter-otlp-proto-http/pyproject.toml @@ -29,8 +29,8 @@ dependencies = [ "backoff >= 1.10.0, < 3.0.0; python_version>='3.7'", "googleapis-common-protos ~= 1.52", "opentelemetry-api ~= 1.15", - "opentelemetry-proto == 1.16.0.dev", - "opentelemetry-sdk ~= 1.16.0.dev", + "opentelemetry-proto == 1.17.0.dev", + "opentelemetry-sdk ~= 1.17.0.dev", "requests ~= 2.7", ] diff --git a/exporter/opentelemetry-exporter-otlp-proto-http/src/opentelemetry/exporter/otlp/proto/http/version.py b/exporter/opentelemetry-exporter-otlp-proto-http/src/opentelemetry/exporter/otlp/proto/http/version.py index 0b4a18e0a24..904e2b48efe 100644 --- a/exporter/opentelemetry-exporter-otlp-proto-http/src/opentelemetry/exporter/otlp/proto/http/version.py +++ b/exporter/opentelemetry-exporter-otlp-proto-http/src/opentelemetry/exporter/otlp/proto/http/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "1.16.0.dev" +__version__ = "1.17.0.dev" diff --git a/exporter/opentelemetry-exporter-otlp/pyproject.toml b/exporter/opentelemetry-exporter-otlp/pyproject.toml index ab605eb3e9d..6de1ff977b6 100644 --- a/exporter/opentelemetry-exporter-otlp/pyproject.toml +++ b/exporter/opentelemetry-exporter-otlp/pyproject.toml @@ -26,8 +26,8 @@ classifiers = [ "Typing :: Typed", ] dependencies = [ - "opentelemetry-exporter-otlp-proto-grpc == 1.16.0.dev", - "opentelemetry-exporter-otlp-proto-http == 1.16.0.dev", + "opentelemetry-exporter-otlp-proto-grpc == 1.17.0.dev", + "opentelemetry-exporter-otlp-proto-http == 1.17.0.dev", ] [project.entry-points.opentelemetry_logs_exporter] diff --git a/exporter/opentelemetry-exporter-otlp/src/opentelemetry/exporter/otlp/version.py b/exporter/opentelemetry-exporter-otlp/src/opentelemetry/exporter/otlp/version.py index 0b4a18e0a24..904e2b48efe 100644 --- a/exporter/opentelemetry-exporter-otlp/src/opentelemetry/exporter/otlp/version.py +++ b/exporter/opentelemetry-exporter-otlp/src/opentelemetry/exporter/otlp/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "1.16.0.dev" +__version__ = "1.17.0.dev" diff --git a/exporter/opentelemetry-exporter-prometheus/src/opentelemetry/exporter/prometheus/version.py b/exporter/opentelemetry-exporter-prometheus/src/opentelemetry/exporter/prometheus/version.py index 0a47df4f5a0..8778b43b174 100644 --- a/exporter/opentelemetry-exporter-prometheus/src/opentelemetry/exporter/prometheus/version.py +++ b/exporter/opentelemetry-exporter-prometheus/src/opentelemetry/exporter/prometheus/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "0.37b0.dev" +__version__ = "0.38b0.dev" diff --git a/exporter/opentelemetry-exporter-zipkin-json/src/opentelemetry/exporter/zipkin/json/version.py b/exporter/opentelemetry-exporter-zipkin-json/src/opentelemetry/exporter/zipkin/json/version.py index 0b4a18e0a24..904e2b48efe 100644 --- a/exporter/opentelemetry-exporter-zipkin-json/src/opentelemetry/exporter/zipkin/json/version.py +++ b/exporter/opentelemetry-exporter-zipkin-json/src/opentelemetry/exporter/zipkin/json/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "1.16.0.dev" +__version__ = "1.17.0.dev" diff --git a/exporter/opentelemetry-exporter-zipkin-proto-http/pyproject.toml b/exporter/opentelemetry-exporter-zipkin-proto-http/pyproject.toml index 1c4137c9292..c6fe12e0ca4 100644 --- a/exporter/opentelemetry-exporter-zipkin-proto-http/pyproject.toml +++ b/exporter/opentelemetry-exporter-zipkin-proto-http/pyproject.toml @@ -27,7 +27,7 @@ classifiers = [ ] dependencies = [ "opentelemetry-api ~= 1.3", - "opentelemetry-exporter-zipkin-json == 1.16.0.dev", + "opentelemetry-exporter-zipkin-json == 1.17.0.dev", "opentelemetry-sdk ~= 1.11", "protobuf ~= 3.12", "requests ~= 2.7", diff --git a/exporter/opentelemetry-exporter-zipkin-proto-http/src/opentelemetry/exporter/zipkin/proto/http/version.py b/exporter/opentelemetry-exporter-zipkin-proto-http/src/opentelemetry/exporter/zipkin/proto/http/version.py index 0b4a18e0a24..904e2b48efe 100644 --- a/exporter/opentelemetry-exporter-zipkin-proto-http/src/opentelemetry/exporter/zipkin/proto/http/version.py +++ b/exporter/opentelemetry-exporter-zipkin-proto-http/src/opentelemetry/exporter/zipkin/proto/http/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "1.16.0.dev" +__version__ = "1.17.0.dev" diff --git a/exporter/opentelemetry-exporter-zipkin/pyproject.toml b/exporter/opentelemetry-exporter-zipkin/pyproject.toml index d982aaf896e..50ec818a09d 100644 --- a/exporter/opentelemetry-exporter-zipkin/pyproject.toml +++ b/exporter/opentelemetry-exporter-zipkin/pyproject.toml @@ -26,8 +26,8 @@ classifiers = [ "Typing :: Typed", ] dependencies = [ - "opentelemetry-exporter-zipkin-json == 1.16.0.dev", - "opentelemetry-exporter-zipkin-proto-http == 1.16.0.dev", + "opentelemetry-exporter-zipkin-json == 1.17.0.dev", + "opentelemetry-exporter-zipkin-proto-http == 1.17.0.dev", ] [project.optional-dependencies] diff --git a/exporter/opentelemetry-exporter-zipkin/src/opentelemetry/exporter/zipkin/version.py b/exporter/opentelemetry-exporter-zipkin/src/opentelemetry/exporter/zipkin/version.py index 0b4a18e0a24..904e2b48efe 100644 --- a/exporter/opentelemetry-exporter-zipkin/src/opentelemetry/exporter/zipkin/version.py +++ b/exporter/opentelemetry-exporter-zipkin/src/opentelemetry/exporter/zipkin/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "1.16.0.dev" +__version__ = "1.17.0.dev" diff --git a/opentelemetry-api/src/opentelemetry/_logs/__init__.py b/opentelemetry-api/src/opentelemetry/_logs/__init__.py index d9677a5f220..a01d1b14ee5 100644 --- a/opentelemetry-api/src/opentelemetry/_logs/__init__.py +++ b/opentelemetry-api/src/opentelemetry/_logs/__init__.py @@ -34,9 +34,7 @@ .. versionadded:: 1.15.0 """ -# pylint: disable=unused-import - -from opentelemetry._logs._internal import ( # noqa: F401 +from opentelemetry._logs._internal import ( Logger, LoggerProvider, LogRecord, @@ -46,13 +44,17 @@ get_logger_provider, set_logger_provider, ) -from opentelemetry._logs.severity import ( # noqa: F401 - SeverityNumber, - std_to_otel, -) - -__all__ = [] -for key, value in globals().copy().items(): # type: ignore - if not key.startswith("_"): - value.__module__ = __name__ # type: ignore - __all__.append(key) +from opentelemetry._logs.severity import SeverityNumber, std_to_otel + +__all__ = [ + "Logger", + "LoggerProvider", + "LogRecord", + "NoOpLogger", + "NoOpLoggerProvider", + "get_logger", + "get_logger_provider", + "set_logger_provider", + "SeverityNumber", + "std_to_otel", +] diff --git a/opentelemetry-api/src/opentelemetry/version.py b/opentelemetry-api/src/opentelemetry/version.py index 0b4a18e0a24..904e2b48efe 100644 --- a/opentelemetry-api/src/opentelemetry/version.py +++ b/opentelemetry-api/src/opentelemetry/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "1.16.0.dev" +__version__ = "1.17.0.dev" diff --git a/opentelemetry-proto/src/opentelemetry/proto/version.py b/opentelemetry-proto/src/opentelemetry/proto/version.py index 0b4a18e0a24..904e2b48efe 100644 --- a/opentelemetry-proto/src/opentelemetry/proto/version.py +++ b/opentelemetry-proto/src/opentelemetry/proto/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "1.16.0.dev" +__version__ = "1.17.0.dev" diff --git a/opentelemetry-sdk/pyproject.toml b/opentelemetry-sdk/pyproject.toml index 4798f4fbc65..bffc677fd00 100644 --- a/opentelemetry-sdk/pyproject.toml +++ b/opentelemetry-sdk/pyproject.toml @@ -26,8 +26,8 @@ classifiers = [ "Typing :: Typed", ] dependencies = [ - "opentelemetry-api == 1.16.0.dev", - "opentelemetry-semantic-conventions == 0.37b0.dev", + "opentelemetry-api == 1.17.0.dev", + "opentelemetry-semantic-conventions == 0.38b0.dev", "setuptools >= 16.0", "typing-extensions >= 3.7.4", ] diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/_logs/__init__.py b/opentelemetry-sdk/src/opentelemetry/sdk/_logs/__init__.py index a548ef3793b..a86fbaee0f1 100644 --- a/opentelemetry-sdk/src/opentelemetry/sdk/_logs/__init__.py +++ b/opentelemetry-sdk/src/opentelemetry/sdk/_logs/__init__.py @@ -12,9 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -# pylint: disable=unused-import -from opentelemetry.sdk._logs._internal import ( # noqa: F401 +from opentelemetry.sdk._logs._internal import ( LogData, Logger, LoggerProvider, @@ -23,8 +22,11 @@ LogRecordProcessor, ) -__all__ = [] -for key, value in globals().copy().items(): - if not key.startswith("_"): - value.__module__ = __name__ - __all__.append(key) +__all__ = [ + "LogData", + "Logger", + "LoggerProvider", + "LoggingHandler", + "LogRecord", + "LogRecordProcessor", +] diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/_logs/export/__init__.py b/opentelemetry-sdk/src/opentelemetry/sdk/_logs/export/__init__.py index 10402886671..37a9eca7a08 100644 --- a/opentelemetry-sdk/src/opentelemetry/sdk/_logs/export/__init__.py +++ b/opentelemetry-sdk/src/opentelemetry/sdk/_logs/export/__init__.py @@ -12,9 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -# pylint: disable=unused-import - -from opentelemetry.sdk._logs._internal.export import ( # noqa: F401 +from opentelemetry.sdk._logs._internal.export import ( BatchLogRecordProcessor, ConsoleLogExporter, LogExporter, @@ -23,12 +21,15 @@ ) # The point module is not in the export directory to avoid a circular import. -from opentelemetry.sdk._logs._internal.export.in_memory_log_exporter import ( # noqa: F401 +from opentelemetry.sdk._logs._internal.export.in_memory_log_exporter import ( InMemoryLogExporter, ) -__all__ = [] -for key, value in globals().copy().items(): - if not key.startswith("_"): - value.__module__ = __name__ - __all__.append(key) +__all__ = [ + "BatchLogRecordProcessor", + "ConsoleLogExporter", + "LogExporter", + "LogExportResult", + "SimpleLogRecordProcessor", + "InMemoryLogExporter", +] diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/metrics/__init__.py b/opentelemetry-sdk/src/opentelemetry/sdk/metrics/__init__.py index 2219bc35c52..1ca14283cf6 100644 --- a/opentelemetry-sdk/src/opentelemetry/sdk/metrics/__init__.py +++ b/opentelemetry-sdk/src/opentelemetry/sdk/metrics/__init__.py @@ -12,16 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -# pylint: disable=unused-import -from opentelemetry.sdk.metrics._internal import ( # noqa: F401 - Meter, - MeterProvider, -) -from opentelemetry.sdk.metrics._internal.exceptions import ( # noqa: F401 - MetricsTimeoutError, -) -from opentelemetry.sdk.metrics._internal.instrument import ( # noqa: F401 +from opentelemetry.sdk.metrics._internal import Meter, MeterProvider +from opentelemetry.sdk.metrics._internal.exceptions import MetricsTimeoutError +from opentelemetry.sdk.metrics._internal.instrument import ( Counter, Histogram, ObservableCounter, @@ -30,8 +24,14 @@ UpDownCounter, ) -__all__ = [] -for key, value in globals().copy().items(): - if not key.startswith("_"): - value.__module__ = __name__ - __all__.append(key) +__all__ = [ + "Meter", + "MeterProvider", + "MetricsTimeoutError", + "Counter", + "Histogram", + "ObservableCounter", + "ObservableGauge", + "ObservableUpDownCounter", + "UpDownCounter", +] diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/export/__init__.py b/opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/export/__init__.py index 836bb8eecef..5bd94d5aacc 100644 --- a/opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/export/__init__.py +++ b/opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/export/__init__.py @@ -41,6 +41,7 @@ AggregationTemporality, DefaultAggregation, ) +from opentelemetry.sdk.metrics._internal.exceptions import MetricsTimeoutError from opentelemetry.sdk.metrics._internal.instrument import ( Counter, Histogram, @@ -497,7 +498,14 @@ def _at_fork_reinit(self): def _ticker(self) -> None: interval_secs = self._export_interval_millis / 1e3 while not self._shutdown_event.wait(interval_secs): - self.collect(timeout_millis=self._export_timeout_millis) + try: + self.collect(timeout_millis=self._export_timeout_millis) + except MetricsTimeoutError: + _logger.warning( + "Metric collection timed out. Will try again after %s seconds", + interval_secs, + exc_info=True, + ) # one last collection below before shutting down completely self.collect(timeout_millis=self._export_interval_millis) diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/point.py b/opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/point.py index b4d813accaf..410c7754d88 100644 --- a/opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/point.py +++ b/opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/point.py @@ -211,5 +211,6 @@ def to_json(self, indent=4) -> str: loads(resource_metrics.to_json(indent=indent)) for resource_metrics in self.resource_metrics ] - } + }, + indent=indent, ) diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/metrics/export/__init__.py b/opentelemetry-sdk/src/opentelemetry/sdk/metrics/export/__init__.py index 76021bd576d..a87beadce56 100644 --- a/opentelemetry-sdk/src/opentelemetry/sdk/metrics/export/__init__.py +++ b/opentelemetry-sdk/src/opentelemetry/sdk/metrics/export/__init__.py @@ -12,9 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -# pylint: disable=unused-import -from opentelemetry.sdk.metrics._internal.export import ( # noqa: F401 +from opentelemetry.sdk.metrics._internal.export import ( AggregationTemporality, ConsoleMetricExporter, InMemoryMetricReader, @@ -25,7 +24,7 @@ ) # The point module is not in the export directory to avoid a circular import. -from opentelemetry.sdk.metrics._internal.point import ( # noqa: F401 +from opentelemetry.sdk.metrics._internal.point import ( DataPointT, DataT, Gauge, @@ -39,8 +38,23 @@ Sum, ) -__all__ = [] -for key, value in globals().copy().items(): - if not key.startswith("_"): - value.__module__ = __name__ - __all__.append(key) +__all__ = [ + "AggregationTemporality", + "ConsoleMetricExporter", + "InMemoryMetricReader", + "MetricExporter", + "MetricExportResult", + "MetricReader", + "PeriodicExportingMetricReader", + "DataPointT", + "DataT", + "Gauge", + "Histogram", + "HistogramDataPoint", + "Metric", + "MetricsData", + "NumberDataPoint", + "ResourceMetrics", + "ScopeMetrics", + "Sum", +] diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/metrics/view/__init__.py b/opentelemetry-sdk/src/opentelemetry/sdk/metrics/view/__init__.py index b20053d876d..f6e4dcb3aae 100644 --- a/opentelemetry-sdk/src/opentelemetry/sdk/metrics/view/__init__.py +++ b/opentelemetry-sdk/src/opentelemetry/sdk/metrics/view/__init__.py @@ -12,9 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -# pylint: disable=unused-import - -from opentelemetry.sdk.metrics._internal.aggregation import ( # noqa: F401 +from opentelemetry.sdk.metrics._internal.aggregation import ( Aggregation, DefaultAggregation, DropAggregation, @@ -22,10 +20,14 @@ LastValueAggregation, SumAggregation, ) -from opentelemetry.sdk.metrics._internal.view import View # noqa: F401 +from opentelemetry.sdk.metrics._internal.view import View -__all__ = [] -for key, value in globals().copy().items(): - if not key.startswith("_"): - value.__module__ = __name__ - __all__.append(key) +__all__ = [ + "Aggregation", + "DefaultAggregation", + "DropAggregation", + "ExplicitBucketHistogramAggregation", + "LastValueAggregation", + "SumAggregation", + "View", +] diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/version.py b/opentelemetry-sdk/src/opentelemetry/sdk/version.py index 0b4a18e0a24..904e2b48efe 100644 --- a/opentelemetry-sdk/src/opentelemetry/sdk/version.py +++ b/opentelemetry-sdk/src/opentelemetry/sdk/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "1.16.0.dev" +__version__ = "1.17.0.dev" diff --git a/opentelemetry-sdk/tests/metrics/integration_test/test_console_exporter.py b/opentelemetry-sdk/tests/metrics/integration_test/test_console_exporter.py index 59f026661c5..60c4227c3b2 100644 --- a/opentelemetry-sdk/tests/metrics/integration_test/test_console_exporter.py +++ b/opentelemetry-sdk/tests/metrics/integration_test/test_console_exporter.py @@ -49,7 +49,7 @@ def test_console_exporter(self): provider.shutdown() output.seek(0) - result_0 = loads(output.readlines()[0]) + result_0 = loads("".join(output.readlines())) self.assertGreater(len(result_0), 0) diff --git a/opentelemetry-sdk/tests/metrics/test_periodic_exporting_metric_reader.py b/opentelemetry-sdk/tests/metrics/test_periodic_exporting_metric_reader.py index 532f25b9e7f..aa0eed285d7 100644 --- a/opentelemetry-sdk/tests/metrics/test_periodic_exporting_metric_reader.py +++ b/opentelemetry-sdk/tests/metrics/test_periodic_exporting_metric_reader.py @@ -14,12 +14,12 @@ import math from time import sleep, time_ns -from typing import Sequence +from typing import Optional, Sequence from unittest.mock import Mock from flaky import flaky -from opentelemetry.sdk.metrics import Counter +from opentelemetry.sdk.metrics import Counter, MetricsTimeoutError from opentelemetry.sdk.metrics._internal import _Counter from opentelemetry.sdk.metrics.export import ( AggregationTemporality, @@ -67,6 +67,25 @@ def force_flush(self, timeout_millis: float = 10_000) -> bool: return True +class ExceptionAtCollectionPeriodicExportingMetricReader( + PeriodicExportingMetricReader +): + def __init__( + self, + exporter: MetricExporter, + exception: Exception, + export_interval_millis: Optional[float] = None, + export_timeout_millis: Optional[float] = None, + ) -> None: + super().__init__( + exporter, export_interval_millis, export_timeout_millis + ) + self._collect_exception = exception + + def collect(self, timeout_millis: float = 10_000) -> None: + raise self._collect_exception + + metrics_list = [ Metric( name="sum_name", @@ -111,11 +130,13 @@ def test_defaults(self): pmr.shutdown() def _create_periodic_reader( - self, metrics, exporter, collect_wait=0, interval=60000 + self, metrics, exporter, collect_wait=0, interval=60000, timeout=30000 ): pmr = PeriodicExportingMetricReader( - exporter, export_interval_millis=interval + exporter, + export_interval_millis=interval, + export_timeout_millis=timeout, ) def _collect(reader, timeout_millis): @@ -219,3 +240,15 @@ def test_exporter_aggregation_preference(self): self.assertTrue(isinstance(value, DefaultAggregation)) else: self.assertTrue(isinstance(value, LastValueAggregation)) + + def test_metric_timeout_does_not_kill_worker_thread(self): + exporter = FakeMetricsExporter() + pmr = ExceptionAtCollectionPeriodicExportingMetricReader( + exporter, + MetricsTimeoutError("test timeout"), + export_timeout_millis=1, + ) + + sleep(0.1) + self.assertTrue(pmr._daemon_thread.is_alive()) + pmr.shutdown() diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/version.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/version.py index 0a47df4f5a0..8778b43b174 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/version.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "0.37b0.dev" +__version__ = "0.38b0.dev" diff --git a/propagator/opentelemetry-propagator-b3/src/opentelemetry/propagators/b3/version.py b/propagator/opentelemetry-propagator-b3/src/opentelemetry/propagators/b3/version.py index 0b4a18e0a24..904e2b48efe 100644 --- a/propagator/opentelemetry-propagator-b3/src/opentelemetry/propagators/b3/version.py +++ b/propagator/opentelemetry-propagator-b3/src/opentelemetry/propagators/b3/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "1.16.0.dev" +__version__ = "1.17.0.dev" diff --git a/propagator/opentelemetry-propagator-jaeger/src/opentelemetry/propagators/jaeger/version.py b/propagator/opentelemetry-propagator-jaeger/src/opentelemetry/propagators/jaeger/version.py index 0b4a18e0a24..904e2b48efe 100644 --- a/propagator/opentelemetry-propagator-jaeger/src/opentelemetry/propagators/jaeger/version.py +++ b/propagator/opentelemetry-propagator-jaeger/src/opentelemetry/propagators/jaeger/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "1.16.0.dev" +__version__ = "1.17.0.dev" diff --git a/rationale.md b/rationale.md index 8ff92e902c7..4f1dd3ab82e 100644 --- a/rationale.md +++ b/rationale.md @@ -40,7 +40,7 @@ Pre-release packages are denoted by appending identifiers such as -Alpha, -Beta, ### Immature or experimental signals -Modules for experimental signals will be released in a separate versions that will be marked as pre-releases, and must be installed manually. Modules will remain at version v0.x.y to make it abundantly clear that depending on them is at your own risk. For example, the `opentelemetry-api` v0.x.y-b0 module will provide experimental access to the latest features in development, which will include the experimental metrics signals. Notice the `b0` suffix which indicates that the release is still in beta, and therefore deemed to be in pre-release. NO STABILITY GUARANTEES ARE MADE. +Modules for experimental signals will be released in the same packages as the core components, but prefixed with `_` to indicate that they are unstable and subject to change. NO STABILITY GUARANTEES ARE MADE. ## Examples @@ -53,13 +53,6 @@ Purely for illustration purposes, not intended to represent actual releases: - `opentelemetry-sdk` 1.0.0 - Contains SDK components for tracing, baggage, propagators, and context -##### Contains the following experimental packages - -- `opentelemetry-api` 1.x.y-b0 - - Contains the EXPERIMENTAL API for metrics plus other unstable features. There are no stability guarantees. -- `opentelemetry-sdk` 1.x.y-b0 - - Contains the EXPERIMENTAL SDK for metrics plus other unstable features. There are no stability guarantees. - #### V1.15.0 Release (with metrics) - `opentelemetry-api` 1.15.0 @@ -67,9 +60,9 @@ Purely for illustration purposes, not intended to represent actual releases: - `opentelemetry-sdk` 1.15.0 - Contains SDK components for tracing, baggage, propagators, context and metrics -##### Contains the following experimental packages +##### Contains the following pre-release packages -- `opentelemetry-api` 1.x.y-b0 - - Contains the EXPERIMENTAL API for logging plus other unstable features. There are no stability guarantees. -- `opentelemetry-sdk` 1.x.y-b0 - - Contains the EXPERIMENTAL SDK for logging plus other unstable features. There are no stability guarantees. +- `opentelemetry-api` 1.x.yrc1 + - Contains the experimental public API for logging plus other unstable features. There are no stability guarantees. +- `opentelemetry-sdk` 1.x.yrc1 + - Contains the experimental public SDK for logging plus other unstable features. There are no stability guarantees. diff --git a/scripts/public_symbols_checker.py b/scripts/public_symbols_checker.py index ac8ca060ba9..c485c4740e9 100644 --- a/scripts/public_symbols_checker.py +++ b/scripts/public_symbols_checker.py @@ -76,9 +76,11 @@ def get_symbols(change_type, diff_lines_getter, prefix): def a_diff_lines_getter(diff_lines): return diff_lines.b_blob.data_stream.read().decode("utf-8").split("\n") + def d_diff_lines_getter(diff_lines): return diff_lines.a_blob.data_stream.read().decode("utf-8").split("\n") + def m_diff_lines_getter(diff_lines): return unified_diff( diff_lines.a_blob.data_stream.read().decode("utf-8").split("\n"), @@ -91,6 +93,7 @@ def m_diff_lines_getter(diff_lines): get_symbols("M", m_diff_lines_getter, r"\+") get_symbols("M", m_diff_lines_getter, r"\-") + def remove_common_symbols(): # For each file, we remove the symbols that are added and removed in the # same commit. @@ -115,6 +118,7 @@ def remove_common_symbols(): if not removed_symbols[file_path]: del removed_symbols[file_path] + if added_symbols or removed_symbols: # If a symbol is added and removed in the same commit, we consider it @@ -122,10 +126,10 @@ def remove_common_symbols(): remove_common_symbols() print("The code in this branch adds the following public symbols:") print() - for file_path, symbols in added_symbols.items(): - print(f"- {file_path}") - for symbol in symbols: - print(f"\t{symbol}") + for file_path_, symbols_ in added_symbols.items(): + print(f"- {file_path_}") + for symbol_ in symbols_: + print(f"\t{symbol_}") print() print( @@ -137,10 +141,10 @@ def remove_common_symbols(): print() print("The code in this branch removes the following public symbols:") print() - for file_path, symbols in removed_symbols.items(): - print(f"- {file_path}") - for symbol in symbols: - print(f"\t{symbol}") + for file_path_, symbols_ in removed_symbols.items(): + print(f"- {file_path_}") + for symbol_ in symbols_: + print(f"\t{symbol_}") print() print( diff --git a/shim/opentelemetry-opentracing-shim/pyproject.toml b/shim/opentelemetry-opentracing-shim/pyproject.toml index d831379655d..742eabd2f49 100644 --- a/shim/opentelemetry-opentracing-shim/pyproject.toml +++ b/shim/opentelemetry-opentracing-shim/pyproject.toml @@ -33,7 +33,7 @@ dependencies = [ [project.optional-dependencies] test = [ - "opentelemetry-test-utils == 0.37b0.dev", + "opentelemetry-test-utils == 0.38b0.dev", "opentracing ~= 2.2.0", ] diff --git a/shim/opentelemetry-opentracing-shim/src/opentelemetry/shim/opentracing_shim/version.py b/shim/opentelemetry-opentracing-shim/src/opentelemetry/shim/opentracing_shim/version.py index 0a47df4f5a0..8778b43b174 100644 --- a/shim/opentelemetry-opentracing-shim/src/opentelemetry/shim/opentracing_shim/version.py +++ b/shim/opentelemetry-opentracing-shim/src/opentelemetry/shim/opentracing_shim/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "0.37b0.dev" +__version__ = "0.38b0.dev" diff --git a/tests/opentelemetry-test-utils/pyproject.toml b/tests/opentelemetry-test-utils/pyproject.toml index b9f84602a2a..7db7c0145e6 100644 --- a/tests/opentelemetry-test-utils/pyproject.toml +++ b/tests/opentelemetry-test-utils/pyproject.toml @@ -25,8 +25,8 @@ classifiers = [ ] dependencies = [ "asgiref ~= 3.0", - "opentelemetry-api == 1.16.0.dev", - "opentelemetry-sdk == 1.16.0.dev", + "opentelemetry-api == 1.17.0.dev", + "opentelemetry-sdk == 1.17.0.dev", ] [project.optional-dependencies] diff --git a/tests/opentelemetry-test-utils/src/opentelemetry/test/test_base.py b/tests/opentelemetry-test-utils/src/opentelemetry/test/test_base.py index 0d81fcb4f53..f7451f0d3c6 100644 --- a/tests/opentelemetry-test-utils/src/opentelemetry/test/test_base.py +++ b/tests/opentelemetry-test-utils/src/opentelemetry/test/test_base.py @@ -15,12 +15,19 @@ import logging import unittest from contextlib import contextmanager -from typing import Tuple +from typing import Optional, Sequence, Tuple from opentelemetry import metrics as metrics_api from opentelemetry import trace as trace_api from opentelemetry.sdk.metrics import MeterProvider -from opentelemetry.sdk.metrics.export import InMemoryMetricReader, MetricReader +from opentelemetry.sdk.metrics._internal.point import Metric +from opentelemetry.sdk.metrics.export import ( + DataPointT, + HistogramDataPoint, + InMemoryMetricReader, + MetricReader, + NumberDataPoint, +) from opentelemetry.sdk.trace import TracerProvider, export from opentelemetry.sdk.trace.export.in_memory_span_exporter import ( InMemorySpanExporter, @@ -130,6 +137,117 @@ def disable_logging(highest_level=logging.CRITICAL): finally: logging.disable(logging.NOTSET) + def get_sorted_metrics(self): + resource_metrics = ( + self.memory_metrics_reader.get_metrics_data().resource_metrics + ) + + all_metrics = [] + for metrics in resource_metrics: + for scope_metrics in metrics.scope_metrics: + all_metrics.extend(scope_metrics.metrics) + + return self.sorted_metrics(all_metrics) + + @staticmethod + def sorted_metrics(metrics): + """ + Sorts metrics by metric name. + """ + return sorted( + metrics, + key=lambda m: m.name, + ) + + def assert_metric_expected( + self, + metric: Metric, + expected_data_points: Sequence[DataPointT], + est_value_delta: Optional[float] = 0, + ): + self.assertEqual( + len(expected_data_points), len(metric.data.data_points) + ) + for expected_data_point in expected_data_points: + self.assert_data_point_expected( + expected_data_point, metric.data.data_points, est_value_delta + ) + + # pylint: disable=unidiomatic-typecheck + @staticmethod + def is_data_points_equal( + expected_data_point: DataPointT, + data_point: DataPointT, + est_value_delta: Optional[float] = 0, + ): + if type(expected_data_point) != type(data_point) or not isinstance( + expected_data_point, (HistogramDataPoint, NumberDataPoint) + ): + return False + + values_diff = None + if isinstance(data_point, NumberDataPoint): + values_diff = abs(expected_data_point.value - data_point.value) + elif isinstance(data_point, HistogramDataPoint): + values_diff = abs(expected_data_point.sum - data_point.sum) + if expected_data_point.count != data_point.count or ( + est_value_delta == 0 + and ( + expected_data_point.min != data_point.min + or expected_data_point.max != data_point.max + ) + ): + return False + + return ( + values_diff <= est_value_delta + and expected_data_point.attributes == dict(data_point.attributes) + ) + + def assert_data_point_expected( + self, + expected_data_point: DataPointT, + data_points: Sequence[DataPointT], + est_value_delta: Optional[float] = 0, + ): + is_data_point_exist = False + for data_point in data_points: + if self.is_data_points_equal( + expected_data_point, data_point, est_value_delta + ): + is_data_point_exist = True + break + + self.assertTrue( + is_data_point_exist, + msg=f"Data point {expected_data_point} does not exist", + ) + + @staticmethod + def create_number_data_point(value, attributes): + return NumberDataPoint( + value=value, + attributes=attributes, + start_time_unix_nano=0, + time_unix_nano=0, + ) + + @staticmethod + def create_histogram_data_point( + sum_data_point, count, max_data_point, min_data_point, attributes + ): + return HistogramDataPoint( + count=count, + sum=sum_data_point, + min=min_data_point, + max=max_data_point, + attributes=attributes, + start_time_unix_nano=0, + time_unix_nano=0, + bucket_counts=[], + explicit_bounds=[], + ) + class FinishedTestSpans(list): def __init__(self, test, spans): diff --git a/tests/opentelemetry-test-utils/src/opentelemetry/test/version.py b/tests/opentelemetry-test-utils/src/opentelemetry/test/version.py index 6b7ff9a9463..9d323a2a659 100644 --- a/tests/opentelemetry-test-utils/src/opentelemetry/test/version.py +++ b/tests/opentelemetry-test-utils/src/opentelemetry/test/version.py @@ -1 +1 @@ -__version__ = "0.37b0.dev" +__version__ = "0.38b0.dev" diff --git a/tox.ini b/tox.ini index fd357987a61..a757f2dd022 100644 --- a/tox.ini +++ b/tox.ini @@ -189,7 +189,7 @@ commands = mypyinstalled: mypy --install-types --non-interactive --namespace-packages opentelemetry-api/tests/mypysmoke.py --strict [testenv:spellcheck] -basepython: python3.9 +basepython: python3.10 recreate = True deps = codespell @@ -254,7 +254,7 @@ commands = sphinx-build -E -a -W -b html -T . _build/html [testenv:tracecontext] -basepython: python3.9 +basepython: python3.10 deps = # needed for tracecontext aiohttp~=3.6 @@ -312,7 +312,7 @@ commands_post = docker-compose down -v [testenv:public-symbols-check] -basepython: python3.9 +basepython: python3.10 recreate = True deps = GitPython