diff --git a/.flake8 b/.flake8 index 83786a686a7..8e17b0ab21a 100644 --- a/.flake8 +++ b/.flake8 @@ -12,6 +12,10 @@ ignore = # allow whitespace before ':' (https://github.com/psf/black#slices) E203 + # conflicts with black + E701 + E704 + exclude = .bzr .git diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000000..6819e1e393a --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,18 @@ +# Keep GitHub Actions up to date with GitHub's Dependabot... +# https://docs.github.com/en/code-security/dependabot/working-with-dependabot/keeping-your-actions-up-to-date-with-dependabot +# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#package-ecosystem +version: 2 +updates: + - package-ecosystem: github-actions + directory: .github + groups: + github-actions: + patterns: + - "*" # Group all Actions updates into a single larger pull request + schedule: + interval: daily + + - package-ecosystem: pip + directory: / + schedule: + interval: daily diff --git a/.github/workflows/backport.yml b/.github/workflows/backport.yml index 9510b88fc83..26789093f25 100644 --- a/.github/workflows/backport.yml +++ b/.github/workflows/backport.yml @@ -16,7 +16,7 @@ jobs: exit 1 fi - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: # history is needed to run git cherry-pick below fetch-depth: 0 diff --git a/.github/workflows/benchmarks.yml b/.github/workflows/benchmarks.yml index 1191c2d0da3..aa909250ad8 100644 --- a/.github/workflows/benchmarks.yml +++ b/.github/workflows/benchmarks.yml @@ -18,9 +18,9 @@ jobs: os: [ubuntu-20.04, windows-2019] steps: - name: Checkout Core Repo @ SHA - ${{ github.sha }} - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Set up Python ${{ env[matrix.python-version] }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: ${{ env[matrix.python-version] }} architecture: 'x64' @@ -28,7 +28,7 @@ jobs: run: pip install tox - name: Cache tox environment # Preserves .tox directory between runs for faster installs - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: | .tox diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml index 5238e01c4b5..491ddd27fae 100644 --- a/.github/workflows/changelog.yml +++ b/.github/workflows/changelog.yml @@ -18,7 +18,7 @@ jobs: && github.actor != 'opentelemetrybot' steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Check for CHANGELOG changes run: | @@ -33,4 +33,4 @@ jobs: echo "No CHANGELOG was modified." echo "Please add a CHANGELOG entry, or add the \"Skip Changelog\" label if not required." false - fi \ No newline at end of file + fi diff --git a/.github/workflows/check-links.yml b/.github/workflows/check-links.yml index f298f6d2919..d9d1514076b 100644 --- a/.github/workflows/check-links.yml +++ b/.github/workflows/check-links.yml @@ -13,7 +13,7 @@ jobs: md: ${{ steps.changes.outputs.md }} steps: - name: Checkout Repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 - name: Get changed files @@ -26,7 +26,7 @@ jobs: if: ${{needs.changedfiles.outputs.md}} steps: - name: Checkout Repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 @@ -39,4 +39,4 @@ jobs: --verbose \ --config .github/workflows/check_links_config.json \ ${{needs.changedfiles.outputs.md}} \ - || { echo "Check that anchor links are lowercase"; exit 1; } \ No newline at end of file + || { echo "Check that anchor links are lowercase"; exit 1; } diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index b979a3121ba..8ef01d21cb2 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -20,16 +20,16 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v4 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v1 + uses: github/codeql-action/init@v3 with: languages: python - name: Autobuild - uses: github/codeql-action/autobuild@v1 + uses: github/codeql-action/autobuild@v3 - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 \ No newline at end of file + uses: github/codeql-action/analyze@v3 diff --git a/.github/workflows/prepare-patch-release.yml b/.github/workflows/prepare-patch-release.yml index 30fa2d15ad0..90aa911d2f3 100644 --- a/.github/workflows/prepare-patch-release.yml +++ b/.github/workflows/prepare-patch-release.yml @@ -6,7 +6,7 @@ jobs: prepare-patch-release: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - run: | if [[ ! $GITHUB_REF_NAME =~ ^release/v[0-9]+\.[0-9]+\.x-0\.[0-9]+bx$ ]]; then diff --git a/.github/workflows/prepare-release-branch.yml b/.github/workflows/prepare-release-branch.yml index 59c86b62de8..936a41f5e77 100644 --- a/.github/workflows/prepare-release-branch.yml +++ b/.github/workflows/prepare-release-branch.yml @@ -10,7 +10,7 @@ jobs: prereqs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Verify prerequisites env: @@ -39,7 +39,7 @@ jobs: runs-on: ubuntu-latest needs: prereqs steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Create release branch env: @@ -103,7 +103,7 @@ jobs: runs-on: ubuntu-latest needs: prereqs steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set environment variables env: diff --git a/.github/workflows/public-api-check.yml b/.github/workflows/public-api-check.yml index 67dcb798310..00c59f94bed 100644 --- a/.github/workflows/public-api-check.yml +++ b/.github/workflows/public-api-check.yml @@ -15,7 +15,7 @@ jobs: steps: - name: Checkout the repo - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: fetch-depth: 0 @@ -29,7 +29,7 @@ jobs: run: git checkout ${{ github.event.pull_request.head.sha }} - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: '3.10' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 39bc3fe993c..b45ff25e719 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,7 +12,7 @@ jobs: exit 1 fi - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set environment variables run: | @@ -56,15 +56,15 @@ jobs: # check out main branch to verify there won't be problems with merging the change log # at the end of this workflow - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: ref: main # back to the release branch - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 # next few steps publish to pypi - - uses: actions/setup-python@v1 + - uses: actions/setup-python@v5 with: python-version: '3.8' @@ -127,7 +127,7 @@ jobs: --discussion-category announcements \ v$STABLE_VERSION - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: # the step below is creating a pull request against main ref: main diff --git a/.github/workflows/shellcheck.yml b/.github/workflows/shellcheck.yml new file mode 100644 index 00000000000..68d12b805fe --- /dev/null +++ b/.github/workflows/shellcheck.yml @@ -0,0 +1,19 @@ +name: Shellcheck + +on: + push: + branches-ignore: + - 'release/*' + pull_request: + +jobs: + shellcheck: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Install shellcheck + run: sudo apt update && sudo apt install --assume-yes shellcheck + + - name: Run shellcheck + run: find . -name \*.sh | xargs shellcheck --severity=warning diff --git a/.github/workflows/sigstore.yml b/.github/workflows/sigstore.yml new file mode 100644 index 00000000000..f479e46d027 --- /dev/null +++ b/.github/workflows/sigstore.yml @@ -0,0 +1,49 @@ +name: Sigstore + +on: + release: + types: [published] + +jobs: + sign-pyproject: + runs-on: ubuntu-latest + permissions: + id-token: write + steps: + - name: Check out repo + uses: actions/checkout@v4 + + - name: Sign pyproject.toml + uses: sigstore/gh-action-sigstore-python@v2.1.1 + with: + inputs: opentelemetry-api/pyproject.toml + + - name: Zip the signed file + run: zip pyproject_sigstore.zip opentelemetry-api/pyproject.toml.sigstore + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: PYPROJECT_SIGSTORE.zip + path: pyproject_sigstore.zip + + add-signed-file: + needs: sign-pyproject + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Download artifact + uses: actions/download-artifact@v4 + with: + name: PYPROJECT_SIGSTORE.zip + + - name: Upload release asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: ./pyproject_sigstore.zip + asset_name: PYPROJECT_SIGSTORE.zip + asset_content_type: application/zip diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2dacdd6b059..ea99698faaa 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,9 +10,9 @@ 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: 9a7c2f7ba16669d00be273aa9e988af0df7aba4c + CONTRIB_REPO_SHA: 9ce1c26d2732dfbdadbb492fc38c562dcd08ed2e # 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 + # When running contrib builds as part of core builds, we use actions/checkout@v4 which # does not set an environment variable (simply just runs tox), which is different when # contrib builds are run directly from contrib (since test.yml is executed, which sets CORE_REPO_SHA) # The solution is to include CORE_REPO_SHA as part of THIS environment so it can be accessed @@ -67,9 +67,9 @@ jobs: steps: - name: Checkout Core Repo @ SHA - ${{ github.sha }} - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Set up Python ${{ env[matrix.python-version] }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: ${{ env[matrix.python-version] }} architecture: 'x64' @@ -77,7 +77,7 @@ jobs: run: pip install tox - name: Cache tox environment # Preserves .tox directory between runs for faster installs - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: | .tox @@ -100,9 +100,9 @@ jobs: runs-on: ubuntu-20.04 steps: - name: Checkout Core Repo @ SHA - ${{ github.sha }} - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: '3.10' architecture: 'x64' @@ -110,7 +110,7 @@ jobs: run: pip install tox - name: Cache tox environment # Preserves .tox directory between runs for faster installs - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: | .tox @@ -176,24 +176,24 @@ jobs: - "tornado" - "tortoiseorm" - "urllib" - - "urllib3v" + - "urllib3" - "wsgi" - "prometheus-remote-write" - "richconsole" os: [ubuntu-20.04] steps: - name: Checkout Contrib Repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: repository: open-telemetry/opentelemetry-python-contrib ref: ${{ env.CONTRIB_REPO_SHA }} - name: Checkout Core Repo @ SHA ${{ github.sha }} - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: repository: open-telemetry/opentelemetry-python path: opentelemetry-python-core - name: Set up Python ${{ env[matrix.python-version] }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: ${{ env[matrix.python-version] }} architecture: 'x64' @@ -201,7 +201,7 @@ jobs: run: pip install tox - name: Cache tox environment # Preserves .tox directory between runs for faster installs - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: | .tox diff --git a/.readthedocs.yml b/.readthedocs.yml index 3dcf0e5cf62..2a3c920b45d 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -6,9 +6,10 @@ sphinx: configuration: docs/conf.py build: - image: latest + os: "ubuntu-22.04" + tools: + python: "3.8" python: - version: 3.8 install: - requirements: docs-requirements.txt diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d4a7add3c6..23077ff4b64 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased +- Update proto version to v1.2.0 + ([#3844](https://github.com/open-telemetry/opentelemetry-python/pull/3844)) +- Add to_json method to ExponentialHistogram + ([#3780](https://github.com/open-telemetry/opentelemetry-python/pull/3780)) +- Bump mypy to 1.9.0 + ([#3795](https://github.com/open-telemetry/opentelemetry-python/pull/3795)) +- Fix exponential histograms + ([#3798](https://github.com/open-telemetry/opentelemetry-python/pull/3798)) +- Fix otlp exporter to export log_record.observed_timestamp + ([#3785](https://github.com/open-telemetry/opentelemetry-python/pull/3785)) +- Add capture the fully qualified type name for raised exceptions in spans + ([#3837](https://github.com/open-telemetry/opentelemetry-python/pull/3837)) +- Prometheus exporter sort label keys to prevent duplicate metrics when user input changes order + ([#3698](https://github.com/open-telemetry/opentelemetry-python/pull/3698)) + +## Version 1.24.0/0.45b0 (2024-03-28) + +- Make create_gauge non-abstract method + ([#3817](https://github.com/open-telemetry/opentelemetry-python/pull/3817)) - Make `tracer.start_as_current_span()` decorator work with async functions ([#3633](https://github.com/open-telemetry/opentelemetry-python/pull/3633)) - Fix python 3.12 deprecation warning @@ -17,6 +36,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ([#3648](https://github.com/open-telemetry/opentelemetry-python/pull/3648)) - Fix ValueError message for PeriodicExportingMetricsReader ([#3769](https://github.com/open-telemetry/opentelemetry-python/pull/3769)) +- Use `BaseException` instead of `Exception` in `record_exception` + ([#3354](https://github.com/open-telemetry/opentelemetry-python/pull/3354)) - Make span.record_exception more robust ([#3778](https://github.com/open-telemetry/opentelemetry-python/pull/3778)) - Fix license field in pyproject.toml files @@ -1496,3 +1517,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Remove dependency on 'backoff' library ([#3679](https://github.com/open-telemetry/opentelemetry-python/pull/3679)) + +- Make create_gauge non-abstract method + ([#3817](https://github.com/open-telemetry/opentelemetry-python/pull/3817)) +- Make `tracer.start_as_current_span()` decorator work with async functions + ([#3633](https://github.com/open-telemetry/opentelemetry-python/pull/3633)) +- Fix python 3.12 deprecation warning + ([#3751](https://github.com/open-telemetry/opentelemetry-python/pull/3751)) +- bump mypy to 0.982 + ([#3776](https://github.com/open-telemetry/opentelemetry-python/pull/3776)) +- Add support for OTEL_SDK_DISABLED environment variable + ([#3648](https://github.com/open-telemetry/opentelemetry-python/pull/3648)) +- Fix ValueError message for PeriodicExportingMetricsReader + ([#3769](https://github.com/open-telemetry/opentelemetry-python/pull/3769)) +- Use `BaseException` instead of `Exception` in `record_exception` + ([#3354](https://github.com/open-telemetry/opentelemetry-python/pull/3354)) +- Make span.record_exception more robust + ([#3778](https://github.com/open-telemetry/opentelemetry-python/pull/3778)) +- Fix license field in pyproject.toml files + ([#3803](https://github.com/open-telemetry/opentelemetry-python/pull/3803)) + diff --git a/LICENSE b/LICENSE index 1ef7dad2c5c..261eeb9e9f8 100644 --- a/LICENSE +++ b/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright The OpenTelemetry Authors + Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/README.md b/README.md index c36a64062c9..588b7ccb399 100644 --- a/README.md +++ b/README.md @@ -100,8 +100,12 @@ Approvers ([@open-telemetry/python-approvers](https://github.com/orgs/open-telem - [Aaron Abbott](https://github.com/aabmass), Google - [Jeremy Voss](https://github.com/jeremydvoss), Microsoft -- [Sanket Mehta](https://github.com/sanketmehta28), Cisco +- [Owais Lone](https://github.com/owais), Splunk +- [Pablo Collins](https://github.com/pmcollins), Splunk +- [Riccardo Magliocchetti](https://github.com/xrmx), Elastic - [Shalev Roda](https://github.com/shalevr), Cisco +- [Srikanth Chekuri](https://github.com/srikanthccv), signoz.io +- [Tammy Baylis](https://github.com/tammy-baylis-swi), SolarWinds Emeritus Approvers @@ -111,6 +115,8 @@ Emeritus Approvers - [Héctor Hernández](https://github.com/hectorhdzg), Microsoft - [Mauricio Vásquez](https://github.com/mauriciovasquezbernal), Kinvolk - [Nathaniel Ruiz Nowell](https://github.com/NathanielRN), AWS +- [Nikolay Sokolik](https://github.com/oxeye-nikolay), Oxeye +- [Sanket Mehta](https://github.com/sanketmehta28), Cisco - [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).* diff --git a/dev-requirements.txt b/dev-requirements similarity index 93% rename from dev-requirements.txt rename to dev-requirements index 15462dea502..90385cc6fab 100644 --- a/dev-requirements.txt +++ b/dev-requirements @@ -1,9 +1,9 @@ pylint==3.0.2 flake8==6.1.0 isort==5.12.0 -black==22.3.0 +black==24.3.0 httpretty==1.1.4 -mypy==0.982 +mypy==1.9.0 sphinx==7.1.2 sphinx-rtd-theme==2.0.0rc4 sphinx-autodoc-typehints==1.25.2 diff --git a/docs-requirements.txt b/docs-requirements similarity index 100% rename from docs-requirements.txt rename to docs-requirements diff --git a/docs/examples/fork-process-model/flask-gunicorn/requirements.txt b/docs/examples/fork-process-model/flask-gunicorn/requirements similarity index 89% rename from docs/examples/fork-process-model/flask-gunicorn/requirements.txt rename to docs/examples/fork-process-model/flask-gunicorn/requirements index ad166e35901..1a0c4b6cea8 100644 --- a/docs/examples/fork-process-model/flask-gunicorn/requirements.txt +++ b/docs/examples/fork-process-model/flask-gunicorn/requirements @@ -2,9 +2,9 @@ click==8.1.7 Flask==2.3.3 googleapis-common-protos==1.52.0 grpcio==1.56.0 -gunicorn==20.0.4 +gunicorn==22.0.0 itsdangerous==2.1.2 -Jinja2==3.1.2 +Jinja2==3.1.3 MarkupSafe==2.1.3 opentelemetry-api==1.20.0 opentelemetry-exporter-otlp==1.20.0 @@ -12,7 +12,7 @@ opentelemetry-instrumentation==0.41b0 opentelemetry-instrumentation-flask==0.41b0 opentelemetry-instrumentation-wsgi==0.41b0 opentelemetry-sdk==1.20.0 -protobuf==3.19.5 +protobuf==3.20.3 six==1.15.0 thrift==0.13.0 uWSGI==2.0.22 diff --git a/docs/examples/fork-process-model/flask-uwsgi/requirements.txt b/docs/examples/fork-process-model/flask-uwsgi/requirements similarity index 89% rename from docs/examples/fork-process-model/flask-uwsgi/requirements.txt rename to docs/examples/fork-process-model/flask-uwsgi/requirements index ad166e35901..1a0c4b6cea8 100644 --- a/docs/examples/fork-process-model/flask-uwsgi/requirements.txt +++ b/docs/examples/fork-process-model/flask-uwsgi/requirements @@ -2,9 +2,9 @@ click==8.1.7 Flask==2.3.3 googleapis-common-protos==1.52.0 grpcio==1.56.0 -gunicorn==20.0.4 +gunicorn==22.0.0 itsdangerous==2.1.2 -Jinja2==3.1.2 +Jinja2==3.1.3 MarkupSafe==2.1.3 opentelemetry-api==1.20.0 opentelemetry-exporter-otlp==1.20.0 @@ -12,7 +12,7 @@ opentelemetry-instrumentation==0.41b0 opentelemetry-instrumentation-flask==0.41b0 opentelemetry-instrumentation-wsgi==0.41b0 opentelemetry-sdk==1.20.0 -protobuf==3.19.5 +protobuf==3.20.3 six==1.15.0 thrift==0.13.0 uWSGI==2.0.22 diff --git a/docs/examples/metrics/prometheus-grafana/requirements.txt b/docs/examples/metrics/prometheus-grafana/requirements similarity index 100% rename from docs/examples/metrics/prometheus-grafana/requirements.txt rename to docs/examples/metrics/prometheus-grafana/requirements diff --git a/docs/examples/metrics/reader/requirements.txt b/docs/examples/metrics/reader/requirements similarity index 100% rename from docs/examples/metrics/reader/requirements.txt rename to docs/examples/metrics/reader/requirements diff --git a/docs/examples/metrics/views/requirements.txt b/docs/examples/metrics/views/requirements similarity index 100% rename from docs/examples/metrics/views/requirements.txt rename to docs/examples/metrics/views/requirements diff --git a/docs/examples/opencensus-shim/requirements.txt b/docs/examples/opencensus-shim/requirements similarity index 100% rename from docs/examples/opencensus-shim/requirements.txt rename to docs/examples/opencensus-shim/requirements diff --git a/docs/examples/opentracing/requirements.txt b/docs/examples/opentracing/requirements similarity index 100% rename from docs/examples/opentracing/requirements.txt rename to docs/examples/opentracing/requirements diff --git a/docs/getting_started/tests/requirements.txt b/docs/getting_started/tests/requirements similarity index 97% rename from docs/getting_started/tests/requirements.txt rename to docs/getting_started/tests/requirements index 79444476a25..89911f30c0f 100644 --- a/docs/getting_started/tests/requirements.txt +++ b/docs/getting_started/tests/requirements @@ -6,7 +6,7 @@ click==8.1.7 Deprecated==1.2.14 flaky==3.7.0 Flask==2.3.3 -idna==3.4 +idna==3.7 importlib-metadata==6.8.0 iniconfig==2.0.0 itsdangerous==2.1.2 diff --git a/eachdist.ini b/eachdist.ini index 7749b33a842..b7d73f192aa 100644 --- a/eachdist.ini +++ b/eachdist.ini @@ -11,7 +11,7 @@ sortfirst= exporter/* [stable] -version=1.24.0.dev +version=1.25.0.dev packages= opentelemetry-sdk @@ -27,7 +27,7 @@ packages= opentelemetry-api [prerelease] -version=0.45b0.dev +version=0.46b0.dev packages= opentelemetry-opentracing-shim diff --git a/exporter/opentelemetry-exporter-opencensus/LICENSE b/exporter/opentelemetry-exporter-opencensus/LICENSE index 1ef7dad2c5c..261eeb9e9f8 100644 --- a/exporter/opentelemetry-exporter-opencensus/LICENSE +++ b/exporter/opentelemetry-exporter-opencensus/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright The OpenTelemetry Authors + Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/exporter/opentelemetry-exporter-opencensus/pyproject.toml b/exporter/opentelemetry-exporter-opencensus/pyproject.toml index fc2a8f2c2cf..44ba08ebcb0 100644 --- a/exporter/opentelemetry-exporter-opencensus/pyproject.toml +++ b/exporter/opentelemetry-exporter-opencensus/pyproject.toml @@ -27,7 +27,7 @@ classifiers = [ dependencies = [ "grpcio >= 1.0.0, < 2.0.0", "opencensus-proto >= 0.1.0, < 1.0.0", - "opentelemetry-api >= 1.24.0.dev", + "opentelemetry-api >= 1.25.0.dev", "opentelemetry-sdk >= 1.15", "protobuf ~= 3.13", "setuptools >= 16.0", diff --git a/exporter/opentelemetry-exporter-opencensus/src/opentelemetry/exporter/opencensus/trace_exporter/__init__.py b/exporter/opentelemetry-exporter-opencensus/src/opentelemetry/exporter/opencensus/trace_exporter/__init__.py index b855728cad5..e5d7e6239a8 100644 --- a/exporter/opentelemetry-exporter-opencensus/src/opentelemetry/exporter/opencensus/trace_exporter/__init__.py +++ b/exporter/opentelemetry-exporter-opencensus/src/opentelemetry/exporter/opencensus/trace_exporter/__init__.py @@ -133,11 +133,11 @@ def translate_to_collector(spans: Sequence[ReadableSpan]): collector_span.parent_span_id = parent_id.to_bytes(8, "big") if span.context.trace_state is not None: - for (key, value) in span.context.trace_state.items(): + for key, value in span.context.trace_state.items(): collector_span.tracestate.entries.add(key=key, value=value) if span.attributes: - for (key, value) in span.attributes.items(): + for key, value in span.attributes.items(): utils.add_proto_attribute_value( collector_span.attributes, key, value ) @@ -150,7 +150,7 @@ def translate_to_collector(spans: Sequence[ReadableSpan]): ) if event.attributes: - for (key, value) in event.attributes.items(): + for key, value in event.attributes.items(): utils.add_proto_attribute_value( collector_annotation.attributes, key, value ) @@ -183,7 +183,7 @@ def translate_to_collector(spans: Sequence[ReadableSpan]): ) if link.attributes: - for (key, value) in link.attributes.items(): + for key, value in link.attributes.items(): utils.add_proto_attribute_value( collector_span_link.attributes, key, value ) diff --git a/exporter/opentelemetry-exporter-opencensus/src/opentelemetry/exporter/opencensus/util.py b/exporter/opentelemetry-exporter-opencensus/src/opentelemetry/exporter/opencensus/util.py index 694e8dc6a10..77eed6ffd17 100644 --- a/exporter/opentelemetry-exporter-opencensus/src/opentelemetry/exporter/opencensus/util.py +++ b/exporter/opentelemetry-exporter-opencensus/src/opentelemetry/exporter/opencensus/util.py @@ -17,7 +17,9 @@ from time import time # pylint: disable=wrong-import-position -from google.protobuf.timestamp_pb2 import Timestamp +from google.protobuf.timestamp_pb2 import ( # pylint: disable=no-name-in-module + Timestamp, +) from opencensus.proto.agent.common.v1 import common_pb2 from opencensus.proto.trace.v1 import trace_pb2 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 2b23bc49941..ff4933b20b8 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.45b0.dev" +__version__ = "0.46b0.dev" diff --git a/exporter/opentelemetry-exporter-opencensus/test-requirements.txt b/exporter/opentelemetry-exporter-opencensus/test-requirements similarity index 100% rename from exporter/opentelemetry-exporter-opencensus/test-requirements.txt rename to exporter/opentelemetry-exporter-opencensus/test-requirements diff --git a/exporter/opentelemetry-exporter-opencensus/tests/test_otcollector_trace_exporter.py b/exporter/opentelemetry-exporter-opencensus/tests/test_otcollector_trace_exporter.py index fa546cde7a2..75340da192c 100644 --- a/exporter/opentelemetry-exporter-opencensus/tests/test_otcollector_trace_exporter.py +++ b/exporter/opentelemetry-exporter-opencensus/tests/test_otcollector_trace_exporter.py @@ -16,7 +16,9 @@ from unittest import mock import grpc -from google.protobuf.timestamp_pb2 import Timestamp +from google.protobuf.timestamp_pb2 import ( # pylint: disable=no-name-in-module + Timestamp, +) from opencensus.proto.trace.v1 import trace_pb2 import opentelemetry.exporter.opencensus.util as utils diff --git a/exporter/opentelemetry-exporter-otlp-proto-common/LICENSE b/exporter/opentelemetry-exporter-otlp-proto-common/LICENSE index 1ef7dad2c5c..261eeb9e9f8 100644 --- a/exporter/opentelemetry-exporter-otlp-proto-common/LICENSE +++ b/exporter/opentelemetry-exporter-otlp-proto-common/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright The OpenTelemetry Authors + Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/exporter/opentelemetry-exporter-otlp-proto-common/pyproject.toml b/exporter/opentelemetry-exporter-otlp-proto-common/pyproject.toml index 3963d60c949..64e1b02c7a5 100644 --- a/exporter/opentelemetry-exporter-otlp-proto-common/pyproject.toml +++ b/exporter/opentelemetry-exporter-otlp-proto-common/pyproject.toml @@ -24,7 +24,7 @@ classifiers = [ "Programming Language :: Python :: 3.11", ] dependencies = [ - "opentelemetry-proto == 1.24.0.dev", + "opentelemetry-proto == 1.25.0.dev", ] [project.urls] diff --git a/exporter/opentelemetry-exporter-otlp-proto-common/src/opentelemetry/exporter/otlp/proto/common/_internal/_log_encoder/__init__.py b/exporter/opentelemetry-exporter-otlp-proto-common/src/opentelemetry/exporter/otlp/proto/common/_internal/_log_encoder/__init__.py index c664e3ba883..4252ab7f139 100644 --- a/exporter/opentelemetry-exporter-otlp-proto-common/src/opentelemetry/exporter/otlp/proto/common/_internal/_log_encoder/__init__.py +++ b/exporter/opentelemetry-exporter-otlp-proto-common/src/opentelemetry/exporter/otlp/proto/common/_internal/_log_encoder/__init__.py @@ -41,6 +41,7 @@ def encode_logs(batch: Sequence[LogData]) -> ExportLogsServiceRequest: def _encode_log(log_data: LogData) -> PB2LogRecord: return PB2LogRecord( time_unix_nano=log_data.log_record.timestamp, + observed_time_unix_nano=log_data.log_record.observed_timestamp, span_id=_encode_span_id(log_data.log_record.span_id), trace_id=_encode_trace_id(log_data.log_record.trace_id), flags=int(log_data.log_record.trace_flags), diff --git a/exporter/opentelemetry-exporter-otlp-proto-common/src/opentelemetry/exporter/otlp/proto/common/version.py b/exporter/opentelemetry-exporter-otlp-proto-common/src/opentelemetry/exporter/otlp/proto/common/version.py index 8c35630f0e1..e8b404f0501 100644 --- a/exporter/opentelemetry-exporter-otlp-proto-common/src/opentelemetry/exporter/otlp/proto/common/version.py +++ b/exporter/opentelemetry-exporter-otlp-proto-common/src/opentelemetry/exporter/otlp/proto/common/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "1.24.0.dev" +__version__ = "1.25.0.dev" diff --git a/exporter/opentelemetry-exporter-otlp-proto-common/test-requirements-0 b/exporter/opentelemetry-exporter-otlp-proto-common/test-requirements-0 new file mode 100644 index 00000000000..a692923fc42 --- /dev/null +++ b/exporter/opentelemetry-exporter-otlp-proto-common/test-requirements-0 @@ -0,0 +1,19 @@ +asgiref==3.7.2 +attrs==23.2.0 +Deprecated==1.2.14 +flaky==3.7.0 +importlib-metadata==6.11.0 +iniconfig==2.0.0 +packaging==23.2 +pluggy==1.4.0 +protobuf==3.20.3 +py==1.11.0 +py-cpuinfo==9.0.0 +pytest==7.1.3 +pytest-benchmark==4.0.0 +tomli==2.0.1 +typing_extensions==4.10.0 +wrapt==1.16.0 +zipp==3.17.0 +-e opentelemetry-proto +-e exporter/opentelemetry-exporter-otlp-proto-common diff --git a/exporter/opentelemetry-exporter-otlp-proto-common/test-requirements.txt b/exporter/opentelemetry-exporter-otlp-proto-common/test-requirements-1 similarity index 100% rename from exporter/opentelemetry-exporter-otlp-proto-common/test-requirements.txt rename to exporter/opentelemetry-exporter-otlp-proto-common/test-requirements-1 diff --git a/exporter/opentelemetry-exporter-otlp-proto-common/tests/test_log_encoder.py b/exporter/opentelemetry-exporter-otlp-proto-common/tests/test_log_encoder.py index 0731bc5125d..58620b963ea 100644 --- a/exporter/opentelemetry-exporter-otlp-proto-common/tests/test_log_encoder.py +++ b/exporter/opentelemetry-exporter-otlp-proto-common/tests/test_log_encoder.py @@ -69,6 +69,7 @@ def _get_sdk_log_data() -> List[LogData]: log1 = LogData( log_record=SDKLogRecord( timestamp=1644650195189786880, + observed_timestamp=1644650195189786881, trace_id=89564621134313219400156819398935297684, span_id=1312458408527513268, trace_flags=TraceFlags(0x01), @@ -89,6 +90,7 @@ def _get_sdk_log_data() -> List[LogData]: log2 = LogData( log_record=SDKLogRecord( timestamp=1644650249738562048, + observed_timestamp=1644650249738562049, trace_id=0, span_id=0, trace_flags=TraceFlags.DEFAULT, @@ -106,6 +108,7 @@ def _get_sdk_log_data() -> List[LogData]: log3 = LogData( log_record=SDKLogRecord( timestamp=1644650427658989056, + observed_timestamp=1644650427658989057, trace_id=271615924622795969659406376515024083555, span_id=4242561578944770265, trace_flags=TraceFlags(0x01), @@ -121,6 +124,7 @@ def _get_sdk_log_data() -> List[LogData]: log4 = LogData( log_record=SDKLogRecord( timestamp=1644650584292683008, + observed_timestamp=1644650584292683009, trace_id=212592107417388365804938480559624925555, span_id=6077757853989569223, trace_flags=TraceFlags(0x01), @@ -164,6 +168,7 @@ def get_test_logs( log_records=[ PB2LogRecord( time_unix_nano=1644650195189786880, + observed_time_unix_nano=1644650195189786881, trace_id=_encode_trace_id( 89564621134313219400156819398935297684 ), @@ -190,6 +195,7 @@ def get_test_logs( log_records=[ PB2LogRecord( time_unix_nano=1644650584292683008, + observed_time_unix_nano=1644650584292683009, trace_id=_encode_trace_id( 212592107417388365804938480559624925555 ), @@ -232,6 +238,7 @@ def get_test_logs( log_records=[ PB2LogRecord( time_unix_nano=1644650249738562048, + observed_time_unix_nano=1644650249738562049, trace_id=_encode_trace_id(0), span_id=_encode_span_id(0), flags=int(TraceFlags.DEFAULT), @@ -249,6 +256,7 @@ def get_test_logs( log_records=[ PB2LogRecord( time_unix_nano=1644650427658989056, + observed_time_unix_nano=1644650427658989057, trace_id=_encode_trace_id( 271615924622795969659406376515024083555 ), diff --git a/exporter/opentelemetry-exporter-otlp-proto-grpc/LICENSE b/exporter/opentelemetry-exporter-otlp-proto-grpc/LICENSE index 1ef7dad2c5c..261eeb9e9f8 100644 --- a/exporter/opentelemetry-exporter-otlp-proto-grpc/LICENSE +++ b/exporter/opentelemetry-exporter-otlp-proto-grpc/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright The OpenTelemetry Authors + Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/exporter/opentelemetry-exporter-otlp-proto-grpc/pyproject.toml b/exporter/opentelemetry-exporter-otlp-proto-grpc/pyproject.toml index a54c1e86e38..9b29e13a12b 100644 --- a/exporter/opentelemetry-exporter-otlp-proto-grpc/pyproject.toml +++ b/exporter/opentelemetry-exporter-otlp-proto-grpc/pyproject.toml @@ -28,14 +28,9 @@ dependencies = [ "googleapis-common-protos ~= 1.52", "grpcio >= 1.0.0, < 2.0.0", "opentelemetry-api ~= 1.15", - "opentelemetry-proto == 1.24.0.dev", - "opentelemetry-sdk ~= 1.24.0.dev", - "opentelemetry-exporter-otlp-proto-common == 1.24.0.dev", -] - -[project.optional-dependencies] -test = [ - "pytest-grpc", + "opentelemetry-proto == 1.25.0.dev", + "opentelemetry-sdk ~= 1.25.0.dev", + "opentelemetry-exporter-otlp-proto-common == 1.25.0.dev", ] [project.entry-points.opentelemetry_logs_exporter] 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 8c35630f0e1..e8b404f0501 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.24.0.dev" +__version__ = "1.25.0.dev" diff --git a/exporter/opentelemetry-exporter-otlp-proto-grpc/test-requirements-0 b/exporter/opentelemetry-exporter-otlp-proto-grpc/test-requirements-0 new file mode 100644 index 00000000000..c1ef1b74296 --- /dev/null +++ b/exporter/opentelemetry-exporter-otlp-proto-grpc/test-requirements-0 @@ -0,0 +1,25 @@ +asgiref==3.7.2 +attrs==23.2.0 +Deprecated==1.2.14 +flaky==3.7.0 +googleapis-common-protos==1.62.0 +grpcio==1.62.0 +importlib-metadata==6.11.0 +iniconfig==2.0.0 +packaging==23.2 +pluggy==1.4.0 +protobuf==3.20.3 +py==1.11.0 +py-cpuinfo==9.0.0 +pytest==7.1.3 +pytest-benchmark==4.0.0 +tomli==2.0.1 +typing_extensions==4.10.0 +wrapt==1.16.0 +zipp==3.17.0 +-e opentelemetry-api +-e exporter/opentelemetry-exporter-otlp-proto-common +-e opentelemetry-proto +-e opentelemetry-sdk +-e opentelemetry-semantic-conventions +-e exporter/opentelemetry-exporter-otlp-proto-grpc diff --git a/exporter/opentelemetry-exporter-otlp-proto-grpc/test-requirements-1 b/exporter/opentelemetry-exporter-otlp-proto-grpc/test-requirements-1 new file mode 100644 index 00000000000..5fd39ca5761 --- /dev/null +++ b/exporter/opentelemetry-exporter-otlp-proto-grpc/test-requirements-1 @@ -0,0 +1,25 @@ +asgiref==3.7.2 +attrs==23.2.0 +Deprecated==1.2.14 +flaky==3.7.0 +googleapis-common-protos==1.62.0 +grpcio==1.62.0 +importlib-metadata==6.11.0 +iniconfig==2.0.0 +packaging==23.2 +pluggy==1.4.0 +protobuf==4.25.3 +py==1.11.0 +py-cpuinfo==9.0.0 +pytest==7.1.3 +pytest-benchmark==4.0.0 +tomli==2.0.1 +typing_extensions==4.10.0 +wrapt==1.16.0 +zipp==3.17.0 +-e opentelemetry-api +-e exporter/opentelemetry-exporter-otlp-proto-common +-e opentelemetry-proto +-e opentelemetry-sdk +-e opentelemetry-semantic-conventions +-e exporter/opentelemetry-exporter-otlp-proto-grpc diff --git a/exporter/opentelemetry-exporter-otlp-proto-grpc/tests/logs/test_otlp_logs_exporter.py b/exporter/opentelemetry-exporter-otlp-proto-grpc/tests/logs/test_otlp_logs_exporter.py index a6479a14741..da66f830c2f 100644 --- a/exporter/opentelemetry-exporter-otlp-proto-grpc/tests/logs/test_otlp_logs_exporter.py +++ b/exporter/opentelemetry-exporter-otlp-proto-grpc/tests/logs/test_otlp_logs_exporter.py @@ -18,7 +18,9 @@ from unittest import TestCase from unittest.mock import patch -from google.protobuf.duration_pb2 import Duration +from google.protobuf.duration_pb2 import ( # pylint: disable=no-name-in-module + Duration, +) from google.rpc.error_details_pb2 import RetryInfo from grpc import ChannelCredentials, Compression, StatusCode, server @@ -361,6 +363,7 @@ def test_translate_log_data(self): PB2LogRecord( # pylint: disable=no-member time_unix_nano=self.log_data_1.log_record.timestamp, + observed_time_unix_nano=self.log_data_1.log_record.observed_timestamp, severity_number=self.log_data_1.log_record.severity_number.value, severity_text="WARNING", span_id=int.to_bytes( @@ -420,6 +423,7 @@ def test_translate_multiple_logs(self): PB2LogRecord( # pylint: disable=no-member time_unix_nano=self.log_data_1.log_record.timestamp, + observed_time_unix_nano=self.log_data_1.log_record.observed_timestamp, severity_number=self.log_data_1.log_record.severity_number.value, severity_text="WARNING", span_id=int.to_bytes( @@ -457,6 +461,7 @@ def test_translate_multiple_logs(self): PB2LogRecord( # pylint: disable=no-member time_unix_nano=self.log_data_2.log_record.timestamp, + observed_time_unix_nano=self.log_data_2.log_record.observed_timestamp, severity_number=self.log_data_2.log_record.severity_number.value, severity_text="INFO", span_id=int.to_bytes( @@ -502,6 +507,7 @@ def test_translate_multiple_logs(self): PB2LogRecord( # pylint: disable=no-member time_unix_nano=self.log_data_3.log_record.timestamp, + observed_time_unix_nano=self.log_data_3.log_record.observed_timestamp, severity_number=self.log_data_3.log_record.severity_number.value, severity_text="ERROR", span_id=int.to_bytes( diff --git a/exporter/opentelemetry-exporter-otlp-proto-grpc/tests/test_otlp_exporter_mixin.py b/exporter/opentelemetry-exporter-otlp-proto-grpc/tests/test_otlp_exporter_mixin.py index 4dfed3e1541..c5e1ed76e70 100644 --- a/exporter/opentelemetry-exporter-otlp-proto-grpc/tests/test_otlp_exporter_mixin.py +++ b/exporter/opentelemetry-exporter-otlp-proto-grpc/tests/test_otlp_exporter_mixin.py @@ -20,7 +20,9 @@ from unittest import TestCase from unittest.mock import Mock, patch -from google.protobuf.duration_pb2 import Duration +from google.protobuf.duration_pb2 import ( # pylint: disable=no-name-in-module + Duration, +) from google.rpc.error_details_pb2 import RetryInfo from grpc import Compression diff --git a/exporter/opentelemetry-exporter-otlp-proto-grpc/tests/test_otlp_metrics_exporter.py b/exporter/opentelemetry-exporter-otlp-proto-grpc/tests/test_otlp_metrics_exporter.py index 95733b917bf..c52e94a00ea 100644 --- a/exporter/opentelemetry-exporter-otlp-proto-grpc/tests/test_otlp_metrics_exporter.py +++ b/exporter/opentelemetry-exporter-otlp-proto-grpc/tests/test_otlp_metrics_exporter.py @@ -24,7 +24,9 @@ from unittest import TestCase from unittest.mock import patch -from google.protobuf.duration_pb2 import Duration +from google.protobuf.duration_pb2 import ( # pylint: disable=no-name-in-module + Duration, +) from google.rpc.error_details_pb2 import RetryInfo from grpc import ChannelCredentials, Compression, StatusCode, server diff --git a/exporter/opentelemetry-exporter-otlp-proto-grpc/tests/test_otlp_trace_exporter.py b/exporter/opentelemetry-exporter-otlp-proto-grpc/tests/test_otlp_trace_exporter.py index bb17e35b7b7..3424d2c0898 100644 --- a/exporter/opentelemetry-exporter-otlp-proto-grpc/tests/test_otlp_trace_exporter.py +++ b/exporter/opentelemetry-exporter-otlp-proto-grpc/tests/test_otlp_trace_exporter.py @@ -20,7 +20,9 @@ from unittest import TestCase from unittest.mock import Mock, PropertyMock, patch -from google.protobuf.duration_pb2 import Duration +from google.protobuf.duration_pb2 import ( # pylint: disable=no-name-in-module + Duration, +) from google.rpc.error_details_pb2 import RetryInfo from grpc import ChannelCredentials, Compression, StatusCode, server diff --git a/exporter/opentelemetry-exporter-otlp-proto-http/LICENSE b/exporter/opentelemetry-exporter-otlp-proto-http/LICENSE index 1ef7dad2c5c..261eeb9e9f8 100644 --- a/exporter/opentelemetry-exporter-otlp-proto-http/LICENSE +++ b/exporter/opentelemetry-exporter-otlp-proto-http/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright The OpenTelemetry Authors + Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/exporter/opentelemetry-exporter-otlp-proto-http/pyproject.toml b/exporter/opentelemetry-exporter-otlp-proto-http/pyproject.toml index f1c88db5c91..1e170528518 100644 --- a/exporter/opentelemetry-exporter-otlp-proto-http/pyproject.toml +++ b/exporter/opentelemetry-exporter-otlp-proto-http/pyproject.toml @@ -27,9 +27,9 @@ dependencies = [ "Deprecated >= 1.2.6", "googleapis-common-protos ~= 1.52", "opentelemetry-api ~= 1.15", - "opentelemetry-proto == 1.24.0.dev", - "opentelemetry-sdk ~= 1.24.0.dev", - "opentelemetry-exporter-otlp-proto-common == 1.24.0.dev", + "opentelemetry-proto == 1.25.0.dev", + "opentelemetry-sdk ~= 1.25.0.dev", + "opentelemetry-exporter-otlp-proto-common == 1.25.0.dev", "requests ~= 2.7", ] diff --git a/exporter/opentelemetry-exporter-otlp-proto-http/src/opentelemetry/exporter/otlp/proto/http/trace_exporter/__init__.py b/exporter/opentelemetry-exporter-otlp-proto-http/src/opentelemetry/exporter/otlp/proto/http/trace_exporter/__init__.py index c624dfe476b..ea21cc664bc 100644 --- a/exporter/opentelemetry-exporter-otlp-proto-http/src/opentelemetry/exporter/otlp/proto/http/trace_exporter/__init__.py +++ b/exporter/opentelemetry-exporter-otlp-proto-http/src/opentelemetry/exporter/otlp/proto/http/trace_exporter/__init__.py @@ -126,19 +126,13 @@ def _retryable(resp: requests.Response) -> bool: return True return False - def export(self, spans) -> SpanExportResult: - # After the call to Shutdown subsequent calls to Export are - # not allowed and should return a Failure result. - if self._shutdown: - _logger.warning("Exporter already shutdown, ignoring batch") - return SpanExportResult.FAILURE - - serialized_data = encode_spans(spans).SerializeToString() + def _serialize_spans(self, spans): + return encode_spans(spans).SerializePartialToString() + def _export_serialized_spans(self, serialized_data): for delay in _create_exp_backoff_generator( max_value=self._MAX_RETRY_TIMEOUT ): - if delay == self._MAX_RETRY_TIMEOUT: return SpanExportResult.FAILURE @@ -163,6 +157,17 @@ def export(self, spans) -> SpanExportResult: return SpanExportResult.FAILURE return SpanExportResult.FAILURE + def export(self, spans) -> SpanExportResult: + # After the call to Shutdown subsequent calls to Export are + # not allowed and should return a Failure result. + if self._shutdown: + _logger.warning("Exporter already shutdown, ignoring batch") + return SpanExportResult.FAILURE + + serialized_data = self._serialize_spans(spans) + + return self._export_serialized_spans(serialized_data) + def shutdown(self): if self._shutdown: _logger.warning("Exporter already shutdown, ignoring call") 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 8c35630f0e1..e8b404f0501 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.24.0.dev" +__version__ = "1.25.0.dev" diff --git a/exporter/opentelemetry-exporter-otlp-proto-http/test-requirements-0.txt b/exporter/opentelemetry-exporter-otlp-proto-http/test-requirements-0 similarity index 97% rename from exporter/opentelemetry-exporter-otlp-proto-http/test-requirements-0.txt rename to exporter/opentelemetry-exporter-otlp-proto-http/test-requirements-0 index 0faf2626687..cad177da7b5 100644 --- a/exporter/opentelemetry-exporter-otlp-proto-http/test-requirements-0.txt +++ b/exporter/opentelemetry-exporter-otlp-proto-http/test-requirements-0 @@ -10,7 +10,7 @@ importlib-metadata==6.11.0 iniconfig==2.0.0 packaging==23.2 pluggy==1.4.0 -protobuf==3.19.6 +protobuf==3.20.3 py==1.11.0 py-cpuinfo==9.0.0 pytest==7.1.3 diff --git a/exporter/opentelemetry-exporter-otlp-proto-http/test-requirements-1.txt b/exporter/opentelemetry-exporter-otlp-proto-http/test-requirements-1 similarity index 100% rename from exporter/opentelemetry-exporter-otlp-proto-http/test-requirements-1.txt rename to exporter/opentelemetry-exporter-otlp-proto-http/test-requirements-1 diff --git a/exporter/opentelemetry-exporter-otlp/LICENSE b/exporter/opentelemetry-exporter-otlp/LICENSE index 1ef7dad2c5c..261eeb9e9f8 100644 --- a/exporter/opentelemetry-exporter-otlp/LICENSE +++ b/exporter/opentelemetry-exporter-otlp/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright The OpenTelemetry Authors + Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/exporter/opentelemetry-exporter-otlp/pyproject.toml b/exporter/opentelemetry-exporter-otlp/pyproject.toml index 7750cfda590..d6aa3aa4cd8 100644 --- a/exporter/opentelemetry-exporter-otlp/pyproject.toml +++ b/exporter/opentelemetry-exporter-otlp/pyproject.toml @@ -25,8 +25,8 @@ classifiers = [ "Typing :: Typed", ] dependencies = [ - "opentelemetry-exporter-otlp-proto-grpc == 1.24.0.dev", - "opentelemetry-exporter-otlp-proto-http == 1.24.0.dev", + "opentelemetry-exporter-otlp-proto-grpc == 1.25.0.dev", + "opentelemetry-exporter-otlp-proto-http == 1.25.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 8c35630f0e1..e8b404f0501 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.24.0.dev" +__version__ = "1.25.0.dev" diff --git a/exporter/opentelemetry-exporter-otlp/test-requirements.txt b/exporter/opentelemetry-exporter-otlp/test-requirements similarity index 100% rename from exporter/opentelemetry-exporter-otlp/test-requirements.txt rename to exporter/opentelemetry-exporter-otlp/test-requirements diff --git a/exporter/opentelemetry-exporter-prometheus/LICENSE b/exporter/opentelemetry-exporter-prometheus/LICENSE index 1ef7dad2c5c..261eeb9e9f8 100644 --- a/exporter/opentelemetry-exporter-prometheus/LICENSE +++ b/exporter/opentelemetry-exporter-prometheus/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright The OpenTelemetry Authors + Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/exporter/opentelemetry-exporter-prometheus/pyproject.toml b/exporter/opentelemetry-exporter-prometheus/pyproject.toml index 1c3c9e89dd9..6fdb327124f 100644 --- a/exporter/opentelemetry-exporter-prometheus/pyproject.toml +++ b/exporter/opentelemetry-exporter-prometheus/pyproject.toml @@ -26,7 +26,7 @@ classifiers = [ dependencies = [ "opentelemetry-api ~= 1.12", # DONOTMERGE: confirm that this will becomes ~= 1.21 in the next release - "opentelemetry-sdk ~= 1.24.0.dev", + "opentelemetry-sdk ~= 1.25.0.dev", "prometheus_client >= 0.5.0, < 1.0.0", ] diff --git a/exporter/opentelemetry-exporter-prometheus/src/opentelemetry/exporter/prometheus/__init__.py b/exporter/opentelemetry-exporter-prometheus/src/opentelemetry/exporter/prometheus/__init__.py index b1a8d668c46..a84e21214d7 100644 --- a/exporter/opentelemetry-exporter-prometheus/src/opentelemetry/exporter/prometheus/__init__.py +++ b/exporter/opentelemetry-exporter-prometheus/src/opentelemetry/exporter/prometheus/__init__.py @@ -196,9 +196,9 @@ def collect(self) -> None: self._target_info = self._create_info_metric( _TARGET_INFO_NAME, _TARGET_INFO_DESCRIPTION, attributes ) - metric_family_id_metric_family[ - _TARGET_INFO_NAME - ] = self._target_info + metric_family_id_metric_family[_TARGET_INFO_NAME] = ( + self._target_info + ) while self._metrics_datas: self._translate_to_prometheus( @@ -237,7 +237,7 @@ def _translate_to_prometheus( label_keys = [] label_values = [] - for key, value in number_data_point.attributes.items(): + for key, value in sorted(number_data_point.attributes.items()): label_keys.append(self._sanitize(key)) label_values.append(self._check_value(value)) @@ -294,13 +294,13 @@ def _translate_to_prometheus( ) if metric_family_id not in metric_family_id_metric_family: - metric_family_id_metric_family[ - metric_family_id - ] = CounterMetricFamily( - name=metric_name, - documentation=metric_description, - labels=label_keys, - unit=metric.unit, + metric_family_id_metric_family[metric_family_id] = ( + CounterMetricFamily( + name=metric_name, + documentation=metric_description, + labels=label_keys, + unit=metric.unit, + ) ) metric_family_id_metric_family[ metric_family_id @@ -318,13 +318,13 @@ def _translate_to_prometheus( metric_family_id not in metric_family_id_metric_family.keys() ): - metric_family_id_metric_family[ - metric_family_id - ] = GaugeMetricFamily( - name=metric_name, - documentation=metric_description, - labels=label_keys, - unit=metric.unit, + metric_family_id_metric_family[metric_family_id] = ( + GaugeMetricFamily( + name=metric_name, + documentation=metric_description, + labels=label_keys, + unit=metric.unit, + ) ) metric_family_id_metric_family[ metric_family_id @@ -339,13 +339,13 @@ def _translate_to_prometheus( metric_family_id not in metric_family_id_metric_family.keys() ): - metric_family_id_metric_family[ - metric_family_id - ] = HistogramMetricFamily( - name=metric_name, - documentation=metric_description, - labels=label_keys, - unit=metric.unit, + metric_family_id_metric_family[metric_family_id] = ( + HistogramMetricFamily( + name=metric_name, + documentation=metric_description, + labels=label_keys, + unit=metric.unit, + ) ) metric_family_id_metric_family[ metric_family_id 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 2b23bc49941..ff4933b20b8 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.45b0.dev" +__version__ = "0.46b0.dev" diff --git a/exporter/opentelemetry-exporter-prometheus/test-requirements.txt b/exporter/opentelemetry-exporter-prometheus/test-requirements similarity index 100% rename from exporter/opentelemetry-exporter-prometheus/test-requirements.txt rename to exporter/opentelemetry-exporter-prometheus/test-requirements diff --git a/exporter/opentelemetry-exporter-prometheus/tests/test_prometheus_exporter.py b/exporter/opentelemetry-exporter-prometheus/tests/test_prometheus_exporter.py index 6d9126c815f..7f0cbaaaeeb 100644 --- a/exporter/opentelemetry-exporter-prometheus/tests/test_prometheus_exporter.py +++ b/exporter/opentelemetry-exporter-prometheus/tests/test_prometheus_exporter.py @@ -436,3 +436,24 @@ def test_target_info_sanitize(self): prometheus_metric.samples[0].labels["ratio"], "0.1", ) + + def test_label_order_does_not_matter(self): + metric_reader = PrometheusMetricReader() + provider = MeterProvider(metric_readers=[metric_reader]) + meter = provider.get_meter("getting-started", "0.1.2") + counter = meter.create_counter("counter") + + counter.add(1, {"cause": "cause1", "reason": "reason1"}) + counter.add(1, {"reason": "reason2", "cause": "cause2"}) + + prometheus_output = generate_latest().decode() + + # All labels are mapped correctly + self.assertIn('cause="cause1"', prometheus_output) + self.assertIn('cause="cause2"', prometheus_output) + self.assertIn('reason="reason1"', prometheus_output) + self.assertIn('reason="reason2"', prometheus_output) + + # Only one metric is generated + metric_count = prometheus_output.count("# HELP counter_total") + self.assertEqual(metric_count, 1) diff --git a/exporter/opentelemetry-exporter-zipkin-json/LICENSE b/exporter/opentelemetry-exporter-zipkin-json/LICENSE index 1ef7dad2c5c..261eeb9e9f8 100644 --- a/exporter/opentelemetry-exporter-zipkin-json/LICENSE +++ b/exporter/opentelemetry-exporter-zipkin-json/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright The OpenTelemetry Authors + Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. 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 8c35630f0e1..e8b404f0501 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.24.0.dev" +__version__ = "1.25.0.dev" diff --git a/exporter/opentelemetry-exporter-zipkin-json/test-requirements.txt b/exporter/opentelemetry-exporter-zipkin-json/test-requirements similarity index 100% rename from exporter/opentelemetry-exporter-zipkin-json/test-requirements.txt rename to exporter/opentelemetry-exporter-zipkin-json/test-requirements diff --git a/exporter/opentelemetry-exporter-zipkin-proto-http/LICENSE b/exporter/opentelemetry-exporter-zipkin-proto-http/LICENSE index 1ef7dad2c5c..261eeb9e9f8 100644 --- a/exporter/opentelemetry-exporter-zipkin-proto-http/LICENSE +++ b/exporter/opentelemetry-exporter-zipkin-proto-http/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright The OpenTelemetry Authors + Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/exporter/opentelemetry-exporter-zipkin-proto-http/pyproject.toml b/exporter/opentelemetry-exporter-zipkin-proto-http/pyproject.toml index 03a400dce75..a934fc7edd1 100644 --- a/exporter/opentelemetry-exporter-zipkin-proto-http/pyproject.toml +++ b/exporter/opentelemetry-exporter-zipkin-proto-http/pyproject.toml @@ -26,7 +26,7 @@ classifiers = [ ] dependencies = [ "opentelemetry-api ~= 1.3", - "opentelemetry-exporter-zipkin-json == 1.24.0.dev", + "opentelemetry-exporter-zipkin-json == 1.25.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 8c35630f0e1..e8b404f0501 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.24.0.dev" +__version__ = "1.25.0.dev" diff --git a/exporter/opentelemetry-exporter-zipkin-proto-http/test-requirements.txt b/exporter/opentelemetry-exporter-zipkin-proto-http/test-requirements similarity index 100% rename from exporter/opentelemetry-exporter-zipkin-proto-http/test-requirements.txt rename to exporter/opentelemetry-exporter-zipkin-proto-http/test-requirements diff --git a/exporter/opentelemetry-exporter-zipkin/LICENSE b/exporter/opentelemetry-exporter-zipkin/LICENSE index 1ef7dad2c5c..261eeb9e9f8 100644 --- a/exporter/opentelemetry-exporter-zipkin/LICENSE +++ b/exporter/opentelemetry-exporter-zipkin/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright The OpenTelemetry Authors + Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/exporter/opentelemetry-exporter-zipkin/pyproject.toml b/exporter/opentelemetry-exporter-zipkin/pyproject.toml index 7ec3ac135fa..905a52fae7d 100644 --- a/exporter/opentelemetry-exporter-zipkin/pyproject.toml +++ b/exporter/opentelemetry-exporter-zipkin/pyproject.toml @@ -25,8 +25,8 @@ classifiers = [ "Typing :: Typed", ] dependencies = [ - "opentelemetry-exporter-zipkin-json == 1.24.0.dev", - "opentelemetry-exporter-zipkin-proto-http == 1.24.0.dev", + "opentelemetry-exporter-zipkin-json == 1.25.0.dev", + "opentelemetry-exporter-zipkin-proto-http == 1.25.0.dev", ] [project.entry-points.opentelemetry_traces_exporter] 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 8c35630f0e1..e8b404f0501 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.24.0.dev" +__version__ = "1.25.0.dev" diff --git a/exporter/opentelemetry-exporter-zipkin/test-requirements.txt b/exporter/opentelemetry-exporter-zipkin/test-requirements similarity index 100% rename from exporter/opentelemetry-exporter-zipkin/test-requirements.txt rename to exporter/opentelemetry-exporter-zipkin/test-requirements diff --git a/gen-requirements.txt b/gen-requirements similarity index 100% rename from gen-requirements.txt rename to gen-requirements diff --git a/opentelemetry-api/LICENSE b/opentelemetry-api/LICENSE index 1ef7dad2c5c..261eeb9e9f8 100644 --- a/opentelemetry-api/LICENSE +++ b/opentelemetry-api/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright The OpenTelemetry Authors + Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/opentelemetry-api/pyproject.toml b/opentelemetry-api/pyproject.toml index 3f8f070992d..5348cf658b1 100644 --- a/opentelemetry-api/pyproject.toml +++ b/opentelemetry-api/pyproject.toml @@ -27,7 +27,7 @@ dependencies = [ "Deprecated >= 1.2.6", # FIXME This should be able to be removed after 3.12 is released if there is a reliable API # in importlib.metadata. - "importlib-metadata >= 6.0, <= 7.0", + "importlib-metadata >= 6.0, <= 7.1", ] dynamic = [ "version", diff --git a/opentelemetry-api/src/opentelemetry/_logs/_internal/__init__.py b/opentelemetry-api/src/opentelemetry/_logs/_internal/__init__.py index 156b2598e47..ccf9f4597aa 100644 --- a/opentelemetry-api/src/opentelemetry/_logs/_internal/__init__.py +++ b/opentelemetry-api/src/opentelemetry/_logs/_internal/__init__.py @@ -193,7 +193,6 @@ def get_logger( schema_url: Optional[str] = None, ) -> Logger: """Returns a NoOpLogger.""" - super().get_logger(name, version=version, schema_url=schema_url) return NoOpLogger(name, version=version, schema_url=schema_url) diff --git a/opentelemetry-api/src/opentelemetry/metrics/_internal/__init__.py b/opentelemetry-api/src/opentelemetry/metrics/_internal/__init__.py index 2e6914f8e3c..9cbf14d2edc 100644 --- a/opentelemetry-api/src/opentelemetry/metrics/_internal/__init__.py +++ b/opentelemetry-api/src/opentelemetry/metrics/_internal/__init__.py @@ -41,6 +41,7 @@ """ +import warnings from abc import ABC, abstractmethod from logging import getLogger from os import environ @@ -140,7 +141,6 @@ def get_meter( schema_url: Optional[str] = None, ) -> "Meter": """Returns a NoOpMeter.""" - super().get_meter(name, version=version, schema_url=schema_url) return NoOpMeter(name, version=version, schema_url=schema_url) @@ -385,8 +385,7 @@ def create_histogram( description: A description for this instrument and what it measures. """ - @abstractmethod - def create_gauge( + def create_gauge( # type: ignore # pylint: disable=no-self-use self, name: str, unit: str = "", @@ -400,6 +399,7 @@ def create_gauge( example, ``By`` for bytes. UCUM units are recommended. description: A description for this instrument and what it measures. """ + warnings.warn("create_gauge() is not implemented and will be a no-op") @abstractmethod def create_observable_gauge( @@ -598,7 +598,6 @@ def create_counter( description: str = "", ) -> Counter: """Returns a no-op Counter.""" - super().create_counter(name, unit=unit, description=description) if self._is_instrument_registered( name, NoOpCounter, unit, description )[0]: @@ -619,7 +618,6 @@ def create_gauge( description: str = "", ) -> Gauge: """Returns a no-op Gauge.""" - super().create_gauge(name, unit=unit, description=description) if self._is_instrument_registered(name, NoOpGauge, unit, description)[ 0 ]: @@ -640,9 +638,6 @@ def create_up_down_counter( description: str = "", ) -> UpDownCounter: """Returns a no-op UpDownCounter.""" - super().create_up_down_counter( - name, unit=unit, description=description - ) if self._is_instrument_registered( name, NoOpUpDownCounter, unit, description )[0]: @@ -664,9 +659,6 @@ def create_observable_counter( description: str = "", ) -> ObservableCounter: """Returns a no-op ObservableCounter.""" - super().create_observable_counter( - name, callbacks, unit=unit, description=description - ) if self._is_instrument_registered( name, NoOpObservableCounter, unit, description )[0]: @@ -692,7 +684,6 @@ def create_histogram( description: str = "", ) -> Histogram: """Returns a no-op Histogram.""" - super().create_histogram(name, unit=unit, description=description) if self._is_instrument_registered( name, NoOpHistogram, unit, description )[0]: @@ -714,9 +705,6 @@ def create_observable_gauge( description: str = "", ) -> ObservableGauge: """Returns a no-op ObservableGauge.""" - super().create_observable_gauge( - name, callbacks, unit=unit, description=description - ) if self._is_instrument_registered( name, NoOpObservableGauge, unit, description )[0]: @@ -743,9 +731,6 @@ def create_observable_up_down_counter( description: str = "", ) -> ObservableUpDownCounter: """Returns a no-op ObservableUpDownCounter.""" - super().create_observable_up_down_counter( - name, callbacks, unit=unit, description=description - ) if self._is_instrument_registered( name, NoOpObservableUpDownCounter, unit, description )[0]: diff --git a/opentelemetry-api/src/opentelemetry/propagate/__init__.py b/opentelemetry-api/src/opentelemetry/propagate/__init__.py index 90f9e617448..a7006175fb8 100644 --- a/opentelemetry-api/src/opentelemetry/propagate/__init__.py +++ b/opentelemetry-api/src/opentelemetry/propagate/__init__.py @@ -109,8 +109,9 @@ def inject( """Uses the configured propagator to inject a Context into the carrier. Args: - carrier: An object that contains a representation of HTTP - headers. Should be paired with setter, which + carrier: the medium used by Propagators to read + values from and write values to. + Should be paired with setter, which should know how to set header values on the carrier. context: An optional Context to use. Defaults to current context if not set. diff --git a/opentelemetry-api/src/opentelemetry/trace/span.py b/opentelemetry-api/src/opentelemetry/trace/span.py index 8201fdb251e..5d46ffcb4a9 100644 --- a/opentelemetry-api/src/opentelemetry/trace/span.py +++ b/opentelemetry-api/src/opentelemetry/trace/span.py @@ -169,7 +169,7 @@ def set_status( @abc.abstractmethod def record_exception( self, - exception: Exception, + exception: BaseException, attributes: types.Attributes = None, timestamp: typing.Optional[int] = None, escaped: bool = False, @@ -563,7 +563,7 @@ def set_status( def record_exception( self, - exception: Exception, + exception: BaseException, attributes: types.Attributes = None, timestamp: typing.Optional[int] = None, escaped: bool = False, diff --git a/opentelemetry-api/src/opentelemetry/util/_decorator.py b/opentelemetry-api/src/opentelemetry/util/_decorator.py index 233f29ff79d..870c97bd989 100644 --- a/opentelemetry-api/src/opentelemetry/util/_decorator.py +++ b/opentelemetry-api/src/opentelemetry/util/_decorator.py @@ -78,4 +78,5 @@ def _agnosticcontextmanager( def helper(*args: Pargs, **kwargs: Pkwargs) -> _AgnosticContextManager[R]: return _AgnosticContextManager(func, args, kwargs) - return helper + # Ignoring the type to keep the original signature of the function + return helper # type: ignore[return-value] diff --git a/opentelemetry-api/src/opentelemetry/util/_providers.py b/opentelemetry-api/src/opentelemetry/util/_providers.py index d255ac999f0..307650bb1d2 100644 --- a/opentelemetry-api/src/opentelemetry/util/_providers.py +++ b/opentelemetry-api/src/opentelemetry/util/_providers.py @@ -29,7 +29,7 @@ def _load_provider( provider_environment_variable: str, provider: str -) -> Provider: +) -> Provider: # type: ignore[type-var] try: diff --git a/opentelemetry-api/src/opentelemetry/version.py b/opentelemetry-api/src/opentelemetry/version.py index 8c35630f0e1..e8b404f0501 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.24.0.dev" +__version__ = "1.25.0.dev" diff --git a/opentelemetry-api/test-requirements.txt b/opentelemetry-api/test-requirements similarity index 100% rename from opentelemetry-api/test-requirements.txt rename to opentelemetry-api/test-requirements diff --git a/opentelemetry-api/tests/logs/test_proxy.py b/opentelemetry-api/tests/logs/test_proxy.py index d8fa0a9743c..cda187cae3c 100644 --- a/opentelemetry-api/tests/logs/test_proxy.py +++ b/opentelemetry-api/tests/logs/test_proxy.py @@ -18,7 +18,6 @@ import opentelemetry._logs._internal as _logs_internal from opentelemetry import _logs -from opentelemetry.sdk._logs import LogRecord # type: ignore from opentelemetry.test.globals_test import LoggingGlobalsTest @@ -33,8 +32,8 @@ def get_logger( class TestLogger(_logs.NoOpLogger): - def emit(self, *args, **kwargs): - return LogRecord(timestamp=0) + def emit(self, record: _logs.LogRecord) -> None: + pass class TestProxy(LoggingGlobalsTest, unittest.TestCase): diff --git a/opentelemetry-api/tests/metrics/test_meter.py b/opentelemetry-api/tests/metrics/test_meter.py index 8b427a73721..2226965521e 100644 --- a/opentelemetry-api/tests/metrics/test_meter.py +++ b/opentelemetry-api/tests/metrics/test_meter.py @@ -134,7 +134,6 @@ def test_create_gauge(self): """ self.assertTrue(hasattr(Meter, "create_gauge")) - self.assertTrue(Meter.create_gauge.__isabstractmethod__) def test_create_observable_gauge(self): """ diff --git a/opentelemetry-api/tests/metrics/test_subclass_instantiation.py b/opentelemetry-api/tests/metrics/test_subclass_instantiation.py new file mode 100644 index 00000000000..a5b68d1c063 --- /dev/null +++ b/opentelemetry-api/tests/metrics/test_subclass_instantiation.py @@ -0,0 +1,209 @@ +# Copyright The OpenTelemetry Authors +# +# 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. +# type: ignore + +# NOTE: The tests in this file are intended to test the semver compatibility of the public API. +# Any tests that fail here indicate that the public API has changed in a way that is not backwards compatible. +# Either bump the major version of the API, or make the necessary changes to the API to remain semver compatible. + +from typing import Optional + +from opentelemetry.metrics import ( + Asynchronous, + Counter, + Histogram, + Instrument, + Meter, + MeterProvider, + ObservableCounter, + ObservableGauge, + ObservableUpDownCounter, + Synchronous, + UpDownCounter, + _Gauge, +) + + +class MeterProviderImplTest(MeterProvider): + def get_meter( + self, + name: str, + version: Optional[str] = None, + schema_url: Optional[str] = None, + ) -> Meter: + return super().get_meter(name, version, schema_url) + + +def test_meter_provider_subclass_instantiation(): + meter_provider = MeterProviderImplTest() + assert isinstance(meter_provider, MeterProvider) + + +class MeterImplTest(Meter): + def create_counter(self, name, description, **kwargs): + pass + + def create_up_down_counter(self, name, description, **kwargs): + pass + + def create_observable_counter(self, name, description, **kwargs): + pass + + def create_histogram(self, name, description, **kwargs): + pass + + def create_observable_gauge(self, name, description, **kwargs): + pass + + def create_observable_up_down_counter(self, name, description, **kwargs): + pass + + +def test_meter_subclass_instantiation(): + meter = MeterImplTest("subclass_test") + assert isinstance(meter, Meter) + + +class SynchronousImplTest(Synchronous): + def __init__( + self, name: str, unit: str = "", description: str = "" + ) -> None: + super().__init__(name, unit, description) + + +def test_synchronous_subclass_instantiation(): + synchronous = SynchronousImplTest("subclass_test") + assert isinstance(synchronous, Synchronous) + + +class AsynchronousImplTest(Asynchronous): + def __init__( + self, name: str, unit: str = "", description: str = "" + ) -> None: + super().__init__(name, unit, description) + + +def test_asynchronous_subclass_instantiation(): + asynchronous = AsynchronousImplTest("subclass_test") + assert isinstance(asynchronous, Asynchronous) + + +class CounterImplTest(Counter): + def __init__( + self, name: str, unit: str = "", description: str = "" + ) -> None: + super().__init__(name, unit, description) + + def add(self, amount: int, **kwargs): + pass + + +def test_counter_subclass_instantiation(): + counter = CounterImplTest("subclass_test") + assert isinstance(counter, Counter) + + +class UpDownCounterImplTest(UpDownCounter): + def __init__( + self, name: str, unit: str = "", description: str = "" + ) -> None: + super().__init__(name, unit, description) + + def add(self, amount: int, **kwargs): + pass + + +def test_up_down_counter_subclass_instantiation(): + up_down_counter = UpDownCounterImplTest("subclass_test") + assert isinstance(up_down_counter, UpDownCounter) + + +class ObservableCounterImplTest(ObservableCounter): + def __init__( + self, name: str, unit: str = "", description: str = "" + ) -> None: + super().__init__(name, unit, description) + + +def test_observable_counter_subclass_instantiation(): + observable_counter = ObservableCounterImplTest("subclass_test") + assert isinstance(observable_counter, ObservableCounter) + + +class HistogramImplTest(Histogram): + def __init__( + self, name: str, unit: str = "", description: str = "" + ) -> None: + super().__init__(name, unit, description) + + def record(self, amount: int, **kwargs): + pass + + +def test_histogram_subclass_instantiation(): + histogram = HistogramImplTest("subclass_test") + assert isinstance(histogram, Histogram) + + +class GaugeImplTest(_Gauge): + def __init__( + self, name: str, unit: str = "", description: str = "" + ) -> None: + super().__init__(name, unit, description) + + def set(self, amount: int, **kwargs): + pass + + +def test_gauge_subclass_instantiation(): + gauge = GaugeImplTest("subclass_test") + assert isinstance(gauge, _Gauge) + + +class InstrumentImplTest(Instrument): + def __init__( + self, name: str, unit: str = "", description: str = "" + ) -> None: + super().__init__(name, unit, description) + + +def test_instrument_subclass_instantiation(): + instrument = InstrumentImplTest("subclass_test") + assert isinstance(instrument, Instrument) + + +class ObservableGaugeImplTest(ObservableGauge): + def __init__( + self, name: str, unit: str = "", description: str = "" + ) -> None: + super().__init__(name, unit, description) + + +def test_observable_gauge_subclass_instantiation(): + observable_gauge = ObservableGaugeImplTest("subclass_test") + assert isinstance(observable_gauge, ObservableGauge) + + +class ObservableUpDownCounterImplTest(ObservableUpDownCounter): + def __init__( + self, name: str, unit: str = "", description: str = "" + ) -> None: + super().__init__(name, unit, description) + + +def test_observable_up_down_counter_subclass_instantiation(): + observable_up_down_counter = ObservableUpDownCounterImplTest( + "subclass_test" + ) + assert isinstance(observable_up_down_counter, ObservableUpDownCounter) diff --git a/opentelemetry-api/tests/propagators/test_w3cbaggagepropagator.py b/opentelemetry-api/tests/propagators/test_w3cbaggagepropagator.py index ccc4b3cb2d0..99e37652ab0 100644 --- a/opentelemetry-api/tests/propagators/test_w3cbaggagepropagator.py +++ b/opentelemetry-api/tests/propagators/test_w3cbaggagepropagator.py @@ -134,11 +134,13 @@ def test_header_max_entries_skip_invalid_entry(self): self._extract( ",".join( [ - f"key{index}=value{index}" - if index != 2 - else ( - f"key{index}=" - f"value{'s' * (W3CBaggagePropagator._MAX_PAIR_LENGTH + 1)}" + ( + f"key{index}=value{index}" + if index != 2 + else ( + f"key{index}=" + f"value{'s' * (W3CBaggagePropagator._MAX_PAIR_LENGTH + 1)}" + ) ) for index in range( W3CBaggagePropagator._MAX_PAIRS + 1 @@ -162,9 +164,11 @@ def test_header_max_entries_skip_invalid_entry(self): self._extract( ",".join( [ - f"key{index}=value{index}" - if index != 2 - else f"key{index}xvalue{index}" + ( + f"key{index}=value{index}" + if index != 2 + else f"key{index}xvalue{index}" + ) for index in range( W3CBaggagePropagator._MAX_PAIRS + 1 ) diff --git a/opentelemetry-proto/LICENSE b/opentelemetry-proto/LICENSE index 1ef7dad2c5c..261eeb9e9f8 100644 --- a/opentelemetry-proto/LICENSE +++ b/opentelemetry-proto/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright The OpenTelemetry Authors + Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/opentelemetry-proto/README.rst b/opentelemetry-proto/README.rst index f3e07b0087d..7ee31de7d88 100644 --- a/opentelemetry-proto/README.rst +++ b/opentelemetry-proto/README.rst @@ -7,9 +7,9 @@ OpenTelemetry Python Proto :target: https://pypi.org/project/opentelemetry-proto/ This library contains the generated code for OpenTelemetry protobuf data model. The code in the current -package was generated using the v0.20.0 release_ of opentelemetry-proto. +package was generated using the v1.2.0 release_ of opentelemetry-proto. -.. _release: https://github.com/open-telemetry/opentelemetry-proto/releases/tag/v0.20.0 +.. _release: https://github.com/open-telemetry/opentelemetry-proto/releases/tag/v1.2.0 Installation ------------ diff --git a/opentelemetry-proto/src/opentelemetry/proto/logs/v1/logs_pb2.pyi b/opentelemetry-proto/src/opentelemetry/proto/logs/v1/logs_pb2.pyi index 98b89743900..5aee721a804 100644 --- a/opentelemetry-proto/src/opentelemetry/proto/logs/v1/logs_pb2.pyi +++ b/opentelemetry-proto/src/opentelemetry/proto/logs/v1/logs_pb2.pyi @@ -80,9 +80,11 @@ global___SeverityNumber = SeverityNumber class LogRecordFlags(_LogRecordFlags, metaclass=_LogRecordFlagsEnumTypeWrapper): - """LogRecordFlags is defined as a protobuf 'uint32' type and is to be used as - bit-fields. Each non-zero value defined in this enum is a bit-mask. - To extract the bit-field, for example, use an expression like: + """LogRecordFlags represents constants used to interpret the + LogRecord.flags field, which is protobuf 'fixed32' type and is to + be used as bit-fields. Each non-zero value defined in this enum is + a bit-mask. To extract the bit-field, for example, use an + expression like: (logRecord.flags & LOG_RECORD_FLAGS_TRACE_FLAGS_MASK) """ @@ -158,7 +160,10 @@ class ResourceLogs(google.protobuf.message.Message): """A list of ScopeLogs that originate from a resource.""" pass schema_url: typing.Text = ... - """This schema_url applies to the data in the "resource" field. It does not apply + """The Schema URL, if known. This is the identifier of the Schema that the resource data + is recorded in. To learn more about Schema URL see + https://opentelemetry.io/docs/specs/otel/schemas/#schema-url + This schema_url applies to the data in the "resource" field. It does not apply to the data in the "scope_logs" field which have their own schema_url field. """ @@ -190,7 +195,11 @@ class ScopeLogs(google.protobuf.message.Message): """A list of log records.""" pass schema_url: typing.Text = ... - """This schema_url applies to all logs in the "logs" field.""" + """The Schema URL, if known. This is the identifier of the Schema that the log data + is recorded in. To learn more about Schema URL see + https://opentelemetry.io/docs/specs/otel/schemas/#schema-url + This schema_url applies to all logs in the "logs" field. + """ def __init__(self, *, diff --git a/opentelemetry-proto/src/opentelemetry/proto/metrics/v1/metrics_pb2.py b/opentelemetry-proto/src/opentelemetry/proto/metrics/v1/metrics_pb2.py index 4b938c21469..e0b8f3bbc52 100644 --- a/opentelemetry-proto/src/opentelemetry/proto/metrics/v1/metrics_pb2.py +++ b/opentelemetry-proto/src/opentelemetry/proto/metrics/v1/metrics_pb2.py @@ -17,7 +17,7 @@ from opentelemetry.proto.resource.v1 import resource_pb2 as opentelemetry_dot_proto_dot_resource_dot_v1_dot_resource__pb2 -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n,opentelemetry/proto/metrics/v1/metrics.proto\x12\x1eopentelemetry.proto.metrics.v1\x1a*opentelemetry/proto/common/v1/common.proto\x1a.opentelemetry/proto/resource/v1/resource.proto\"X\n\x0bMetricsData\x12I\n\x10resource_metrics\x18\x01 \x03(\x0b\x32/.opentelemetry.proto.metrics.v1.ResourceMetrics\"\xaf\x01\n\x0fResourceMetrics\x12;\n\x08resource\x18\x01 \x01(\x0b\x32).opentelemetry.proto.resource.v1.Resource\x12\x43\n\rscope_metrics\x18\x02 \x03(\x0b\x32,.opentelemetry.proto.metrics.v1.ScopeMetrics\x12\x12\n\nschema_url\x18\x03 \x01(\tJ\x06\x08\xe8\x07\x10\xe9\x07\"\x9f\x01\n\x0cScopeMetrics\x12\x42\n\x05scope\x18\x01 \x01(\x0b\x32\x33.opentelemetry.proto.common.v1.InstrumentationScope\x12\x37\n\x07metrics\x18\x02 \x03(\x0b\x32&.opentelemetry.proto.metrics.v1.Metric\x12\x12\n\nschema_url\x18\x03 \x01(\t\"\x92\x03\n\x06Metric\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x02 \x01(\t\x12\x0c\n\x04unit\x18\x03 \x01(\t\x12\x36\n\x05gauge\x18\x05 \x01(\x0b\x32%.opentelemetry.proto.metrics.v1.GaugeH\x00\x12\x32\n\x03sum\x18\x07 \x01(\x0b\x32#.opentelemetry.proto.metrics.v1.SumH\x00\x12>\n\thistogram\x18\t \x01(\x0b\x32).opentelemetry.proto.metrics.v1.HistogramH\x00\x12U\n\x15\x65xponential_histogram\x18\n \x01(\x0b\x32\x34.opentelemetry.proto.metrics.v1.ExponentialHistogramH\x00\x12:\n\x07summary\x18\x0b \x01(\x0b\x32\'.opentelemetry.proto.metrics.v1.SummaryH\x00\x42\x06\n\x04\x64\x61taJ\x04\x08\x04\x10\x05J\x04\x08\x06\x10\x07J\x04\x08\x08\x10\t\"M\n\x05Gauge\x12\x44\n\x0b\x64\x61ta_points\x18\x01 \x03(\x0b\x32/.opentelemetry.proto.metrics.v1.NumberDataPoint\"\xba\x01\n\x03Sum\x12\x44\n\x0b\x64\x61ta_points\x18\x01 \x03(\x0b\x32/.opentelemetry.proto.metrics.v1.NumberDataPoint\x12W\n\x17\x61ggregation_temporality\x18\x02 \x01(\x0e\x32\x36.opentelemetry.proto.metrics.v1.AggregationTemporality\x12\x14\n\x0cis_monotonic\x18\x03 \x01(\x08\"\xad\x01\n\tHistogram\x12G\n\x0b\x64\x61ta_points\x18\x01 \x03(\x0b\x32\x32.opentelemetry.proto.metrics.v1.HistogramDataPoint\x12W\n\x17\x61ggregation_temporality\x18\x02 \x01(\x0e\x32\x36.opentelemetry.proto.metrics.v1.AggregationTemporality\"\xc3\x01\n\x14\x45xponentialHistogram\x12R\n\x0b\x64\x61ta_points\x18\x01 \x03(\x0b\x32=.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint\x12W\n\x17\x61ggregation_temporality\x18\x02 \x01(\x0e\x32\x36.opentelemetry.proto.metrics.v1.AggregationTemporality\"P\n\x07Summary\x12\x45\n\x0b\x64\x61ta_points\x18\x01 \x03(\x0b\x32\x30.opentelemetry.proto.metrics.v1.SummaryDataPoint\"\x86\x02\n\x0fNumberDataPoint\x12;\n\nattributes\x18\x07 \x03(\x0b\x32\'.opentelemetry.proto.common.v1.KeyValue\x12\x1c\n\x14start_time_unix_nano\x18\x02 \x01(\x06\x12\x16\n\x0etime_unix_nano\x18\x03 \x01(\x06\x12\x13\n\tas_double\x18\x04 \x01(\x01H\x00\x12\x10\n\x06\x61s_int\x18\x06 \x01(\x10H\x00\x12;\n\texemplars\x18\x05 \x03(\x0b\x32(.opentelemetry.proto.metrics.v1.Exemplar\x12\r\n\x05\x66lags\x18\x08 \x01(\rB\x07\n\x05valueJ\x04\x08\x01\x10\x02\"\xe6\x02\n\x12HistogramDataPoint\x12;\n\nattributes\x18\t \x03(\x0b\x32\'.opentelemetry.proto.common.v1.KeyValue\x12\x1c\n\x14start_time_unix_nano\x18\x02 \x01(\x06\x12\x16\n\x0etime_unix_nano\x18\x03 \x01(\x06\x12\r\n\x05\x63ount\x18\x04 \x01(\x06\x12\x10\n\x03sum\x18\x05 \x01(\x01H\x00\x88\x01\x01\x12\x15\n\rbucket_counts\x18\x06 \x03(\x06\x12\x17\n\x0f\x65xplicit_bounds\x18\x07 \x03(\x01\x12;\n\texemplars\x18\x08 \x03(\x0b\x32(.opentelemetry.proto.metrics.v1.Exemplar\x12\r\n\x05\x66lags\x18\n \x01(\r\x12\x10\n\x03min\x18\x0b \x01(\x01H\x01\x88\x01\x01\x12\x10\n\x03max\x18\x0c \x01(\x01H\x02\x88\x01\x01\x42\x06\n\x04_sumB\x06\n\x04_minB\x06\n\x04_maxJ\x04\x08\x01\x10\x02\"\xda\x04\n\x1d\x45xponentialHistogramDataPoint\x12;\n\nattributes\x18\x01 \x03(\x0b\x32\'.opentelemetry.proto.common.v1.KeyValue\x12\x1c\n\x14start_time_unix_nano\x18\x02 \x01(\x06\x12\x16\n\x0etime_unix_nano\x18\x03 \x01(\x06\x12\r\n\x05\x63ount\x18\x04 \x01(\x06\x12\x10\n\x03sum\x18\x05 \x01(\x01H\x00\x88\x01\x01\x12\r\n\x05scale\x18\x06 \x01(\x11\x12\x12\n\nzero_count\x18\x07 \x01(\x06\x12W\n\x08positive\x18\x08 \x01(\x0b\x32\x45.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets\x12W\n\x08negative\x18\t \x01(\x0b\x32\x45.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets\x12\r\n\x05\x66lags\x18\n \x01(\r\x12;\n\texemplars\x18\x0b \x03(\x0b\x32(.opentelemetry.proto.metrics.v1.Exemplar\x12\x10\n\x03min\x18\x0c \x01(\x01H\x01\x88\x01\x01\x12\x10\n\x03max\x18\r \x01(\x01H\x02\x88\x01\x01\x12\x16\n\x0ezero_threshold\x18\x0e \x01(\x01\x1a\x30\n\x07\x42uckets\x12\x0e\n\x06offset\x18\x01 \x01(\x11\x12\x15\n\rbucket_counts\x18\x02 \x03(\x04\x42\x06\n\x04_sumB\x06\n\x04_minB\x06\n\x04_max\"\xc5\x02\n\x10SummaryDataPoint\x12;\n\nattributes\x18\x07 \x03(\x0b\x32\'.opentelemetry.proto.common.v1.KeyValue\x12\x1c\n\x14start_time_unix_nano\x18\x02 \x01(\x06\x12\x16\n\x0etime_unix_nano\x18\x03 \x01(\x06\x12\r\n\x05\x63ount\x18\x04 \x01(\x06\x12\x0b\n\x03sum\x18\x05 \x01(\x01\x12Y\n\x0fquantile_values\x18\x06 \x03(\x0b\x32@.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile\x12\r\n\x05\x66lags\x18\x08 \x01(\r\x1a\x32\n\x0fValueAtQuantile\x12\x10\n\x08quantile\x18\x01 \x01(\x01\x12\r\n\x05value\x18\x02 \x01(\x01J\x04\x08\x01\x10\x02\"\xc1\x01\n\x08\x45xemplar\x12\x44\n\x13\x66iltered_attributes\x18\x07 \x03(\x0b\x32\'.opentelemetry.proto.common.v1.KeyValue\x12\x16\n\x0etime_unix_nano\x18\x02 \x01(\x06\x12\x13\n\tas_double\x18\x03 \x01(\x01H\x00\x12\x10\n\x06\x61s_int\x18\x06 \x01(\x10H\x00\x12\x0f\n\x07span_id\x18\x04 \x01(\x0c\x12\x10\n\x08trace_id\x18\x05 \x01(\x0c\x42\x07\n\x05valueJ\x04\x08\x01\x10\x02*\x8c\x01\n\x16\x41ggregationTemporality\x12\'\n#AGGREGATION_TEMPORALITY_UNSPECIFIED\x10\x00\x12!\n\x1d\x41GGREGATION_TEMPORALITY_DELTA\x10\x01\x12&\n\"AGGREGATION_TEMPORALITY_CUMULATIVE\x10\x02*^\n\x0e\x44\x61taPointFlags\x12\x1f\n\x1b\x44\x41TA_POINT_FLAGS_DO_NOT_USE\x10\x00\x12+\n\'DATA_POINT_FLAGS_NO_RECORDED_VALUE_MASK\x10\x01\x42\x7f\n!io.opentelemetry.proto.metrics.v1B\x0cMetricsProtoP\x01Z)go.opentelemetry.io/proto/otlp/metrics/v1\xaa\x02\x1eOpenTelemetry.Proto.Metrics.V1b\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n,opentelemetry/proto/metrics/v1/metrics.proto\x12\x1eopentelemetry.proto.metrics.v1\x1a*opentelemetry/proto/common/v1/common.proto\x1a.opentelemetry/proto/resource/v1/resource.proto\"X\n\x0bMetricsData\x12I\n\x10resource_metrics\x18\x01 \x03(\x0b\x32/.opentelemetry.proto.metrics.v1.ResourceMetrics\"\xaf\x01\n\x0fResourceMetrics\x12;\n\x08resource\x18\x01 \x01(\x0b\x32).opentelemetry.proto.resource.v1.Resource\x12\x43\n\rscope_metrics\x18\x02 \x03(\x0b\x32,.opentelemetry.proto.metrics.v1.ScopeMetrics\x12\x12\n\nschema_url\x18\x03 \x01(\tJ\x06\x08\xe8\x07\x10\xe9\x07\"\x9f\x01\n\x0cScopeMetrics\x12\x42\n\x05scope\x18\x01 \x01(\x0b\x32\x33.opentelemetry.proto.common.v1.InstrumentationScope\x12\x37\n\x07metrics\x18\x02 \x03(\x0b\x32&.opentelemetry.proto.metrics.v1.Metric\x12\x12\n\nschema_url\x18\x03 \x01(\t\"\xcd\x03\n\x06Metric\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x02 \x01(\t\x12\x0c\n\x04unit\x18\x03 \x01(\t\x12\x36\n\x05gauge\x18\x05 \x01(\x0b\x32%.opentelemetry.proto.metrics.v1.GaugeH\x00\x12\x32\n\x03sum\x18\x07 \x01(\x0b\x32#.opentelemetry.proto.metrics.v1.SumH\x00\x12>\n\thistogram\x18\t \x01(\x0b\x32).opentelemetry.proto.metrics.v1.HistogramH\x00\x12U\n\x15\x65xponential_histogram\x18\n \x01(\x0b\x32\x34.opentelemetry.proto.metrics.v1.ExponentialHistogramH\x00\x12:\n\x07summary\x18\x0b \x01(\x0b\x32\'.opentelemetry.proto.metrics.v1.SummaryH\x00\x12\x39\n\x08metadata\x18\x0c \x03(\x0b\x32\'.opentelemetry.proto.common.v1.KeyValueB\x06\n\x04\x64\x61taJ\x04\x08\x04\x10\x05J\x04\x08\x06\x10\x07J\x04\x08\x08\x10\t\"M\n\x05Gauge\x12\x44\n\x0b\x64\x61ta_points\x18\x01 \x03(\x0b\x32/.opentelemetry.proto.metrics.v1.NumberDataPoint\"\xba\x01\n\x03Sum\x12\x44\n\x0b\x64\x61ta_points\x18\x01 \x03(\x0b\x32/.opentelemetry.proto.metrics.v1.NumberDataPoint\x12W\n\x17\x61ggregation_temporality\x18\x02 \x01(\x0e\x32\x36.opentelemetry.proto.metrics.v1.AggregationTemporality\x12\x14\n\x0cis_monotonic\x18\x03 \x01(\x08\"\xad\x01\n\tHistogram\x12G\n\x0b\x64\x61ta_points\x18\x01 \x03(\x0b\x32\x32.opentelemetry.proto.metrics.v1.HistogramDataPoint\x12W\n\x17\x61ggregation_temporality\x18\x02 \x01(\x0e\x32\x36.opentelemetry.proto.metrics.v1.AggregationTemporality\"\xc3\x01\n\x14\x45xponentialHistogram\x12R\n\x0b\x64\x61ta_points\x18\x01 \x03(\x0b\x32=.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint\x12W\n\x17\x61ggregation_temporality\x18\x02 \x01(\x0e\x32\x36.opentelemetry.proto.metrics.v1.AggregationTemporality\"P\n\x07Summary\x12\x45\n\x0b\x64\x61ta_points\x18\x01 \x03(\x0b\x32\x30.opentelemetry.proto.metrics.v1.SummaryDataPoint\"\x86\x02\n\x0fNumberDataPoint\x12;\n\nattributes\x18\x07 \x03(\x0b\x32\'.opentelemetry.proto.common.v1.KeyValue\x12\x1c\n\x14start_time_unix_nano\x18\x02 \x01(\x06\x12\x16\n\x0etime_unix_nano\x18\x03 \x01(\x06\x12\x13\n\tas_double\x18\x04 \x01(\x01H\x00\x12\x10\n\x06\x61s_int\x18\x06 \x01(\x10H\x00\x12;\n\texemplars\x18\x05 \x03(\x0b\x32(.opentelemetry.proto.metrics.v1.Exemplar\x12\r\n\x05\x66lags\x18\x08 \x01(\rB\x07\n\x05valueJ\x04\x08\x01\x10\x02\"\xe6\x02\n\x12HistogramDataPoint\x12;\n\nattributes\x18\t \x03(\x0b\x32\'.opentelemetry.proto.common.v1.KeyValue\x12\x1c\n\x14start_time_unix_nano\x18\x02 \x01(\x06\x12\x16\n\x0etime_unix_nano\x18\x03 \x01(\x06\x12\r\n\x05\x63ount\x18\x04 \x01(\x06\x12\x10\n\x03sum\x18\x05 \x01(\x01H\x00\x88\x01\x01\x12\x15\n\rbucket_counts\x18\x06 \x03(\x06\x12\x17\n\x0f\x65xplicit_bounds\x18\x07 \x03(\x01\x12;\n\texemplars\x18\x08 \x03(\x0b\x32(.opentelemetry.proto.metrics.v1.Exemplar\x12\r\n\x05\x66lags\x18\n \x01(\r\x12\x10\n\x03min\x18\x0b \x01(\x01H\x01\x88\x01\x01\x12\x10\n\x03max\x18\x0c \x01(\x01H\x02\x88\x01\x01\x42\x06\n\x04_sumB\x06\n\x04_minB\x06\n\x04_maxJ\x04\x08\x01\x10\x02\"\xda\x04\n\x1d\x45xponentialHistogramDataPoint\x12;\n\nattributes\x18\x01 \x03(\x0b\x32\'.opentelemetry.proto.common.v1.KeyValue\x12\x1c\n\x14start_time_unix_nano\x18\x02 \x01(\x06\x12\x16\n\x0etime_unix_nano\x18\x03 \x01(\x06\x12\r\n\x05\x63ount\x18\x04 \x01(\x06\x12\x10\n\x03sum\x18\x05 \x01(\x01H\x00\x88\x01\x01\x12\r\n\x05scale\x18\x06 \x01(\x11\x12\x12\n\nzero_count\x18\x07 \x01(\x06\x12W\n\x08positive\x18\x08 \x01(\x0b\x32\x45.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets\x12W\n\x08negative\x18\t \x01(\x0b\x32\x45.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets\x12\r\n\x05\x66lags\x18\n \x01(\r\x12;\n\texemplars\x18\x0b \x03(\x0b\x32(.opentelemetry.proto.metrics.v1.Exemplar\x12\x10\n\x03min\x18\x0c \x01(\x01H\x01\x88\x01\x01\x12\x10\n\x03max\x18\r \x01(\x01H\x02\x88\x01\x01\x12\x16\n\x0ezero_threshold\x18\x0e \x01(\x01\x1a\x30\n\x07\x42uckets\x12\x0e\n\x06offset\x18\x01 \x01(\x11\x12\x15\n\rbucket_counts\x18\x02 \x03(\x04\x42\x06\n\x04_sumB\x06\n\x04_minB\x06\n\x04_max\"\xc5\x02\n\x10SummaryDataPoint\x12;\n\nattributes\x18\x07 \x03(\x0b\x32\'.opentelemetry.proto.common.v1.KeyValue\x12\x1c\n\x14start_time_unix_nano\x18\x02 \x01(\x06\x12\x16\n\x0etime_unix_nano\x18\x03 \x01(\x06\x12\r\n\x05\x63ount\x18\x04 \x01(\x06\x12\x0b\n\x03sum\x18\x05 \x01(\x01\x12Y\n\x0fquantile_values\x18\x06 \x03(\x0b\x32@.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile\x12\r\n\x05\x66lags\x18\x08 \x01(\r\x1a\x32\n\x0fValueAtQuantile\x12\x10\n\x08quantile\x18\x01 \x01(\x01\x12\r\n\x05value\x18\x02 \x01(\x01J\x04\x08\x01\x10\x02\"\xc1\x01\n\x08\x45xemplar\x12\x44\n\x13\x66iltered_attributes\x18\x07 \x03(\x0b\x32\'.opentelemetry.proto.common.v1.KeyValue\x12\x16\n\x0etime_unix_nano\x18\x02 \x01(\x06\x12\x13\n\tas_double\x18\x03 \x01(\x01H\x00\x12\x10\n\x06\x61s_int\x18\x06 \x01(\x10H\x00\x12\x0f\n\x07span_id\x18\x04 \x01(\x0c\x12\x10\n\x08trace_id\x18\x05 \x01(\x0c\x42\x07\n\x05valueJ\x04\x08\x01\x10\x02*\x8c\x01\n\x16\x41ggregationTemporality\x12\'\n#AGGREGATION_TEMPORALITY_UNSPECIFIED\x10\x00\x12!\n\x1d\x41GGREGATION_TEMPORALITY_DELTA\x10\x01\x12&\n\"AGGREGATION_TEMPORALITY_CUMULATIVE\x10\x02*^\n\x0e\x44\x61taPointFlags\x12\x1f\n\x1b\x44\x41TA_POINT_FLAGS_DO_NOT_USE\x10\x00\x12+\n\'DATA_POINT_FLAGS_NO_RECORDED_VALUE_MASK\x10\x01\x42\x7f\n!io.opentelemetry.proto.metrics.v1B\x0cMetricsProtoP\x01Z)go.opentelemetry.io/proto/otlp/metrics/v1\xaa\x02\x1eOpenTelemetry.Proto.Metrics.V1b\x06proto3') _AGGREGATIONTEMPORALITY = DESCRIPTOR.enum_types_by_name['AggregationTemporality'] AggregationTemporality = enum_type_wrapper.EnumTypeWrapper(_AGGREGATIONTEMPORALITY) @@ -164,10 +164,10 @@ DESCRIPTOR._options = None DESCRIPTOR._serialized_options = b'\n!io.opentelemetry.proto.metrics.v1B\014MetricsProtoP\001Z)go.opentelemetry.io/proto/otlp/metrics/v1\252\002\036OpenTelemetry.Proto.Metrics.V1' - _AGGREGATIONTEMPORALITY._serialized_start=3487 - _AGGREGATIONTEMPORALITY._serialized_end=3627 - _DATAPOINTFLAGS._serialized_start=3629 - _DATAPOINTFLAGS._serialized_end=3723 + _AGGREGATIONTEMPORALITY._serialized_start=3546 + _AGGREGATIONTEMPORALITY._serialized_end=3686 + _DATAPOINTFLAGS._serialized_start=3688 + _DATAPOINTFLAGS._serialized_end=3782 _METRICSDATA._serialized_start=172 _METRICSDATA._serialized_end=260 _RESOURCEMETRICS._serialized_start=263 @@ -175,29 +175,29 @@ _SCOPEMETRICS._serialized_start=441 _SCOPEMETRICS._serialized_end=600 _METRIC._serialized_start=603 - _METRIC._serialized_end=1005 - _GAUGE._serialized_start=1007 - _GAUGE._serialized_end=1084 - _SUM._serialized_start=1087 - _SUM._serialized_end=1273 - _HISTOGRAM._serialized_start=1276 - _HISTOGRAM._serialized_end=1449 - _EXPONENTIALHISTOGRAM._serialized_start=1452 - _EXPONENTIALHISTOGRAM._serialized_end=1647 - _SUMMARY._serialized_start=1649 - _SUMMARY._serialized_end=1729 - _NUMBERDATAPOINT._serialized_start=1732 - _NUMBERDATAPOINT._serialized_end=1994 - _HISTOGRAMDATAPOINT._serialized_start=1997 - _HISTOGRAMDATAPOINT._serialized_end=2355 - _EXPONENTIALHISTOGRAMDATAPOINT._serialized_start=2358 - _EXPONENTIALHISTOGRAMDATAPOINT._serialized_end=2960 - _EXPONENTIALHISTOGRAMDATAPOINT_BUCKETS._serialized_start=2888 - _EXPONENTIALHISTOGRAMDATAPOINT_BUCKETS._serialized_end=2936 - _SUMMARYDATAPOINT._serialized_start=2963 - _SUMMARYDATAPOINT._serialized_end=3288 - _SUMMARYDATAPOINT_VALUEATQUANTILE._serialized_start=3232 - _SUMMARYDATAPOINT_VALUEATQUANTILE._serialized_end=3282 - _EXEMPLAR._serialized_start=3291 - _EXEMPLAR._serialized_end=3484 + _METRIC._serialized_end=1064 + _GAUGE._serialized_start=1066 + _GAUGE._serialized_end=1143 + _SUM._serialized_start=1146 + _SUM._serialized_end=1332 + _HISTOGRAM._serialized_start=1335 + _HISTOGRAM._serialized_end=1508 + _EXPONENTIALHISTOGRAM._serialized_start=1511 + _EXPONENTIALHISTOGRAM._serialized_end=1706 + _SUMMARY._serialized_start=1708 + _SUMMARY._serialized_end=1788 + _NUMBERDATAPOINT._serialized_start=1791 + _NUMBERDATAPOINT._serialized_end=2053 + _HISTOGRAMDATAPOINT._serialized_start=2056 + _HISTOGRAMDATAPOINT._serialized_end=2414 + _EXPONENTIALHISTOGRAMDATAPOINT._serialized_start=2417 + _EXPONENTIALHISTOGRAMDATAPOINT._serialized_end=3019 + _EXPONENTIALHISTOGRAMDATAPOINT_BUCKETS._serialized_start=2947 + _EXPONENTIALHISTOGRAMDATAPOINT_BUCKETS._serialized_end=2995 + _SUMMARYDATAPOINT._serialized_start=3022 + _SUMMARYDATAPOINT._serialized_end=3347 + _SUMMARYDATAPOINT_VALUEATQUANTILE._serialized_start=3291 + _SUMMARYDATAPOINT_VALUEATQUANTILE._serialized_end=3341 + _EXEMPLAR._serialized_start=3350 + _EXEMPLAR._serialized_end=3543 # @@protoc_insertion_point(module_scope) diff --git a/opentelemetry-proto/src/opentelemetry/proto/metrics/v1/metrics_pb2.pyi b/opentelemetry-proto/src/opentelemetry/proto/metrics/v1/metrics_pb2.pyi index ccbbb35cfbb..8fd86329610 100644 --- a/opentelemetry-proto/src/opentelemetry/proto/metrics/v1/metrics_pb2.pyi +++ b/opentelemetry-proto/src/opentelemetry/proto/metrics/v1/metrics_pb2.pyi @@ -250,7 +250,10 @@ class ResourceMetrics(google.protobuf.message.Message): """A list of metrics that originate from a resource.""" pass schema_url: typing.Text = ... - """This schema_url applies to the data in the "resource" field. It does not apply + """The Schema URL, if known. This is the identifier of the Schema that the resource data + is recorded in. To learn more about Schema URL see + https://opentelemetry.io/docs/specs/otel/schemas/#schema-url + This schema_url applies to the data in the "resource" field. It does not apply to the data in the "scope_metrics" field which have their own schema_url field. """ @@ -282,7 +285,11 @@ class ScopeMetrics(google.protobuf.message.Message): """A list of metrics that originate from an instrumentation library.""" pass schema_url: typing.Text = ... - """This schema_url applies to all metrics in the "metrics" field.""" + """The Schema URL, if known. This is the identifier of the Schema that the metric data + is recorded in. To learn more about Schema URL see + https://opentelemetry.io/docs/specs/otel/schemas/#schema-url + This schema_url applies to all metrics in the "metrics" field. + """ def __init__(self, *, @@ -390,8 +397,9 @@ class Metric(google.protobuf.message.Message): HISTOGRAM_FIELD_NUMBER: builtins.int EXPONENTIAL_HISTOGRAM_FIELD_NUMBER: builtins.int SUMMARY_FIELD_NUMBER: builtins.int + METADATA_FIELD_NUMBER: builtins.int name: typing.Text = ... - """name of the metric, including its DNS name prefix. It must be unique.""" + """name of the metric.""" description: typing.Text = ... """description of the metric, which can be used in documentation.""" @@ -411,6 +419,17 @@ class Metric(google.protobuf.message.Message): def exponential_histogram(self) -> global___ExponentialHistogram: ... @property def summary(self) -> global___Summary: ... + @property + def metadata(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[opentelemetry.proto.common.v1.common_pb2.KeyValue]: + """Additional metadata attributes that describe the metric. [Optional]. + Attributes are non-identifying. + Consumers SHOULD NOT need to be aware of these attributes. + These attributes MAY be used to encode information allowing + for lossless roundtrip translation to / from another data model. + Attribute keys MUST be unique (it is not allowed to have more than one + attribute with the same key). + """ + pass def __init__(self, *, name : typing.Text = ..., @@ -421,9 +440,10 @@ class Metric(google.protobuf.message.Message): histogram : typing.Optional[global___Histogram] = ..., exponential_histogram : typing.Optional[global___ExponentialHistogram] = ..., summary : typing.Optional[global___Summary] = ..., + metadata : typing.Optional[typing.Iterable[opentelemetry.proto.common.v1.common_pb2.KeyValue]] = ..., ) -> None: ... def HasField(self, field_name: typing_extensions.Literal["data",b"data","exponential_histogram",b"exponential_histogram","gauge",b"gauge","histogram",b"histogram","sum",b"sum","summary",b"summary"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal["data",b"data","description",b"description","exponential_histogram",b"exponential_histogram","gauge",b"gauge","histogram",b"histogram","name",b"name","sum",b"sum","summary",b"summary","unit",b"unit"]) -> None: ... + def ClearField(self, field_name: typing_extensions.Literal["data",b"data","description",b"description","exponential_histogram",b"exponential_histogram","gauge",b"gauge","histogram",b"histogram","metadata",b"metadata","name",b"name","sum",b"sum","summary",b"summary","unit",b"unit"]) -> None: ... def WhichOneof(self, oneof_group: typing_extensions.Literal["data",b"data"]) -> typing.Optional[typing_extensions.Literal["gauge","sum","histogram","exponential_histogram","summary"]]: ... global___Metric = Metric diff --git a/opentelemetry-proto/src/opentelemetry/proto/trace/v1/trace_pb2.py b/opentelemetry-proto/src/opentelemetry/proto/trace/v1/trace_pb2.py index 6e80acce517..5a9fec5eaa3 100644 --- a/opentelemetry-proto/src/opentelemetry/proto/trace/v1/trace_pb2.py +++ b/opentelemetry-proto/src/opentelemetry/proto/trace/v1/trace_pb2.py @@ -2,6 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # source: opentelemetry/proto/trace/v1/trace.proto """Generated protocol buffer code.""" +from google.protobuf.internal import enum_type_wrapper from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool from google.protobuf import message as _message @@ -16,8 +17,14 @@ from opentelemetry.proto.resource.v1 import resource_pb2 as opentelemetry_dot_proto_dot_resource_dot_v1_dot_resource__pb2 -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n(opentelemetry/proto/trace/v1/trace.proto\x12\x1copentelemetry.proto.trace.v1\x1a*opentelemetry/proto/common/v1/common.proto\x1a.opentelemetry/proto/resource/v1/resource.proto\"Q\n\nTracesData\x12\x43\n\x0eresource_spans\x18\x01 \x03(\x0b\x32+.opentelemetry.proto.trace.v1.ResourceSpans\"\xa7\x01\n\rResourceSpans\x12;\n\x08resource\x18\x01 \x01(\x0b\x32).opentelemetry.proto.resource.v1.Resource\x12=\n\x0bscope_spans\x18\x02 \x03(\x0b\x32(.opentelemetry.proto.trace.v1.ScopeSpans\x12\x12\n\nschema_url\x18\x03 \x01(\tJ\x06\x08\xe8\x07\x10\xe9\x07\"\x97\x01\n\nScopeSpans\x12\x42\n\x05scope\x18\x01 \x01(\x0b\x32\x33.opentelemetry.proto.common.v1.InstrumentationScope\x12\x31\n\x05spans\x18\x02 \x03(\x0b\x32\".opentelemetry.proto.trace.v1.Span\x12\x12\n\nschema_url\x18\x03 \x01(\t\"\xe6\x07\n\x04Span\x12\x10\n\x08trace_id\x18\x01 \x01(\x0c\x12\x0f\n\x07span_id\x18\x02 \x01(\x0c\x12\x13\n\x0btrace_state\x18\x03 \x01(\t\x12\x16\n\x0eparent_span_id\x18\x04 \x01(\x0c\x12\x0c\n\x04name\x18\x05 \x01(\t\x12\x39\n\x04kind\x18\x06 \x01(\x0e\x32+.opentelemetry.proto.trace.v1.Span.SpanKind\x12\x1c\n\x14start_time_unix_nano\x18\x07 \x01(\x06\x12\x1a\n\x12\x65nd_time_unix_nano\x18\x08 \x01(\x06\x12;\n\nattributes\x18\t \x03(\x0b\x32\'.opentelemetry.proto.common.v1.KeyValue\x12 \n\x18\x64ropped_attributes_count\x18\n \x01(\r\x12\x38\n\x06\x65vents\x18\x0b \x03(\x0b\x32(.opentelemetry.proto.trace.v1.Span.Event\x12\x1c\n\x14\x64ropped_events_count\x18\x0c \x01(\r\x12\x36\n\x05links\x18\r \x03(\x0b\x32\'.opentelemetry.proto.trace.v1.Span.Link\x12\x1b\n\x13\x64ropped_links_count\x18\x0e \x01(\r\x12\x34\n\x06status\x18\x0f \x01(\x0b\x32$.opentelemetry.proto.trace.v1.Status\x1a\x8c\x01\n\x05\x45vent\x12\x16\n\x0etime_unix_nano\x18\x01 \x01(\x06\x12\x0c\n\x04name\x18\x02 \x01(\t\x12;\n\nattributes\x18\x03 \x03(\x0b\x32\'.opentelemetry.proto.common.v1.KeyValue\x12 \n\x18\x64ropped_attributes_count\x18\x04 \x01(\r\x1a\x9d\x01\n\x04Link\x12\x10\n\x08trace_id\x18\x01 \x01(\x0c\x12\x0f\n\x07span_id\x18\x02 \x01(\x0c\x12\x13\n\x0btrace_state\x18\x03 \x01(\t\x12;\n\nattributes\x18\x04 \x03(\x0b\x32\'.opentelemetry.proto.common.v1.KeyValue\x12 \n\x18\x64ropped_attributes_count\x18\x05 \x01(\r\"\x99\x01\n\x08SpanKind\x12\x19\n\x15SPAN_KIND_UNSPECIFIED\x10\x00\x12\x16\n\x12SPAN_KIND_INTERNAL\x10\x01\x12\x14\n\x10SPAN_KIND_SERVER\x10\x02\x12\x14\n\x10SPAN_KIND_CLIENT\x10\x03\x12\x16\n\x12SPAN_KIND_PRODUCER\x10\x04\x12\x16\n\x12SPAN_KIND_CONSUMER\x10\x05\"\xae\x01\n\x06Status\x12\x0f\n\x07message\x18\x02 \x01(\t\x12=\n\x04\x63ode\x18\x03 \x01(\x0e\x32/.opentelemetry.proto.trace.v1.Status.StatusCode\"N\n\nStatusCode\x12\x15\n\x11STATUS_CODE_UNSET\x10\x00\x12\x12\n\x0eSTATUS_CODE_OK\x10\x01\x12\x15\n\x11STATUS_CODE_ERROR\x10\x02J\x04\x08\x01\x10\x02\x42w\n\x1fio.opentelemetry.proto.trace.v1B\nTraceProtoP\x01Z\'go.opentelemetry.io/proto/otlp/trace/v1\xaa\x02\x1cOpenTelemetry.Proto.Trace.V1b\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n(opentelemetry/proto/trace/v1/trace.proto\x12\x1copentelemetry.proto.trace.v1\x1a*opentelemetry/proto/common/v1/common.proto\x1a.opentelemetry/proto/resource/v1/resource.proto\"Q\n\nTracesData\x12\x43\n\x0eresource_spans\x18\x01 \x03(\x0b\x32+.opentelemetry.proto.trace.v1.ResourceSpans\"\xa7\x01\n\rResourceSpans\x12;\n\x08resource\x18\x01 \x01(\x0b\x32).opentelemetry.proto.resource.v1.Resource\x12=\n\x0bscope_spans\x18\x02 \x03(\x0b\x32(.opentelemetry.proto.trace.v1.ScopeSpans\x12\x12\n\nschema_url\x18\x03 \x01(\tJ\x06\x08\xe8\x07\x10\xe9\x07\"\x97\x01\n\nScopeSpans\x12\x42\n\x05scope\x18\x01 \x01(\x0b\x32\x33.opentelemetry.proto.common.v1.InstrumentationScope\x12\x31\n\x05spans\x18\x02 \x03(\x0b\x32\".opentelemetry.proto.trace.v1.Span\x12\x12\n\nschema_url\x18\x03 \x01(\t\"\x84\x08\n\x04Span\x12\x10\n\x08trace_id\x18\x01 \x01(\x0c\x12\x0f\n\x07span_id\x18\x02 \x01(\x0c\x12\x13\n\x0btrace_state\x18\x03 \x01(\t\x12\x16\n\x0eparent_span_id\x18\x04 \x01(\x0c\x12\r\n\x05\x66lags\x18\x10 \x01(\x07\x12\x0c\n\x04name\x18\x05 \x01(\t\x12\x39\n\x04kind\x18\x06 \x01(\x0e\x32+.opentelemetry.proto.trace.v1.Span.SpanKind\x12\x1c\n\x14start_time_unix_nano\x18\x07 \x01(\x06\x12\x1a\n\x12\x65nd_time_unix_nano\x18\x08 \x01(\x06\x12;\n\nattributes\x18\t \x03(\x0b\x32\'.opentelemetry.proto.common.v1.KeyValue\x12 \n\x18\x64ropped_attributes_count\x18\n \x01(\r\x12\x38\n\x06\x65vents\x18\x0b \x03(\x0b\x32(.opentelemetry.proto.trace.v1.Span.Event\x12\x1c\n\x14\x64ropped_events_count\x18\x0c \x01(\r\x12\x36\n\x05links\x18\r \x03(\x0b\x32\'.opentelemetry.proto.trace.v1.Span.Link\x12\x1b\n\x13\x64ropped_links_count\x18\x0e \x01(\r\x12\x34\n\x06status\x18\x0f \x01(\x0b\x32$.opentelemetry.proto.trace.v1.Status\x1a\x8c\x01\n\x05\x45vent\x12\x16\n\x0etime_unix_nano\x18\x01 \x01(\x06\x12\x0c\n\x04name\x18\x02 \x01(\t\x12;\n\nattributes\x18\x03 \x03(\x0b\x32\'.opentelemetry.proto.common.v1.KeyValue\x12 \n\x18\x64ropped_attributes_count\x18\x04 \x01(\r\x1a\xac\x01\n\x04Link\x12\x10\n\x08trace_id\x18\x01 \x01(\x0c\x12\x0f\n\x07span_id\x18\x02 \x01(\x0c\x12\x13\n\x0btrace_state\x18\x03 \x01(\t\x12;\n\nattributes\x18\x04 \x03(\x0b\x32\'.opentelemetry.proto.common.v1.KeyValue\x12 \n\x18\x64ropped_attributes_count\x18\x05 \x01(\r\x12\r\n\x05\x66lags\x18\x06 \x01(\x07\"\x99\x01\n\x08SpanKind\x12\x19\n\x15SPAN_KIND_UNSPECIFIED\x10\x00\x12\x16\n\x12SPAN_KIND_INTERNAL\x10\x01\x12\x14\n\x10SPAN_KIND_SERVER\x10\x02\x12\x14\n\x10SPAN_KIND_CLIENT\x10\x03\x12\x16\n\x12SPAN_KIND_PRODUCER\x10\x04\x12\x16\n\x12SPAN_KIND_CONSUMER\x10\x05\"\xae\x01\n\x06Status\x12\x0f\n\x07message\x18\x02 \x01(\t\x12=\n\x04\x63ode\x18\x03 \x01(\x0e\x32/.opentelemetry.proto.trace.v1.Status.StatusCode\"N\n\nStatusCode\x12\x15\n\x11STATUS_CODE_UNSET\x10\x00\x12\x12\n\x0eSTATUS_CODE_OK\x10\x01\x12\x15\n\x11STATUS_CODE_ERROR\x10\x02J\x04\x08\x01\x10\x02*\x9c\x01\n\tSpanFlags\x12\x19\n\x15SPAN_FLAGS_DO_NOT_USE\x10\x00\x12 \n\x1bSPAN_FLAGS_TRACE_FLAGS_MASK\x10\xff\x01\x12*\n%SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK\x10\x80\x02\x12&\n!SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK\x10\x80\x04\x42w\n\x1fio.opentelemetry.proto.trace.v1B\nTraceProtoP\x01Z\'go.opentelemetry.io/proto/otlp/trace/v1\xaa\x02\x1cOpenTelemetry.Proto.Trace.V1b\x06proto3') +_SPANFLAGS = DESCRIPTOR.enum_types_by_name['SpanFlags'] +SpanFlags = enum_type_wrapper.EnumTypeWrapper(_SPANFLAGS) +SPAN_FLAGS_DO_NOT_USE = 0 +SPAN_FLAGS_TRACE_FLAGS_MASK = 255 +SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK = 256 +SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK = 512 _TRACESDATA = DESCRIPTOR.message_types_by_name['TracesData'] @@ -84,6 +91,8 @@ DESCRIPTOR._options = None DESCRIPTOR._serialized_options = b'\n\037io.opentelemetry.proto.trace.v1B\nTraceProtoP\001Z\'go.opentelemetry.io/proto/otlp/trace/v1\252\002\034OpenTelemetry.Proto.Trace.V1' + _SPANFLAGS._serialized_start=1782 + _SPANFLAGS._serialized_end=1938 _TRACESDATA._serialized_start=166 _TRACESDATA._serialized_end=247 _RESOURCESPANS._serialized_start=250 @@ -91,15 +100,15 @@ _SCOPESPANS._serialized_start=420 _SCOPESPANS._serialized_end=571 _SPAN._serialized_start=574 - _SPAN._serialized_end=1572 - _SPAN_EVENT._serialized_start=1116 - _SPAN_EVENT._serialized_end=1256 - _SPAN_LINK._serialized_start=1259 - _SPAN_LINK._serialized_end=1416 - _SPAN_SPANKIND._serialized_start=1419 - _SPAN_SPANKIND._serialized_end=1572 - _STATUS._serialized_start=1575 - _STATUS._serialized_end=1749 - _STATUS_STATUSCODE._serialized_start=1665 - _STATUS_STATUSCODE._serialized_end=1743 + _SPAN._serialized_end=1602 + _SPAN_EVENT._serialized_start=1131 + _SPAN_EVENT._serialized_end=1271 + _SPAN_LINK._serialized_start=1274 + _SPAN_LINK._serialized_end=1446 + _SPAN_SPANKIND._serialized_start=1449 + _SPAN_SPANKIND._serialized_end=1602 + _STATUS._serialized_start=1605 + _STATUS._serialized_end=1779 + _STATUS_STATUSCODE._serialized_start=1695 + _STATUS_STATUSCODE._serialized_end=1773 # @@protoc_insertion_point(module_scope) diff --git a/opentelemetry-proto/src/opentelemetry/proto/trace/v1/trace_pb2.pyi b/opentelemetry-proto/src/opentelemetry/proto/trace/v1/trace_pb2.pyi index 52052ff7e96..b1aaf784c9c 100644 --- a/opentelemetry-proto/src/opentelemetry/proto/trace/v1/trace_pb2.pyi +++ b/opentelemetry-proto/src/opentelemetry/proto/trace/v1/trace_pb2.pyi @@ -14,6 +14,61 @@ import typing_extensions DESCRIPTOR: google.protobuf.descriptor.FileDescriptor = ... +class SpanFlags(_SpanFlags, metaclass=_SpanFlagsEnumTypeWrapper): + """SpanFlags represents constants used to interpret the + Span.flags field, which is protobuf 'fixed32' type and is to + be used as bit-fields. Each non-zero value defined in this enum is + a bit-mask. To extract the bit-field, for example, use an + expression like: + + (span.flags & SPAN_FLAGS_TRACE_FLAGS_MASK) + + See https://www.w3.org/TR/trace-context-2/#trace-flags for the flag definitions. + + Note that Span flags were introduced in version 1.1 of the + OpenTelemetry protocol. Older Span producers do not set this + field, consequently consumers should not rely on the absence of a + particular flag bit to indicate the presence of a particular feature. + """ + pass +class _SpanFlags: + V = typing.NewType('V', builtins.int) +class _SpanFlagsEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[_SpanFlags.V], builtins.type): + DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor = ... + SPAN_FLAGS_DO_NOT_USE = SpanFlags.V(0) + """The zero value for the enum. Should not be used for comparisons. + Instead use bitwise "and" with the appropriate mask as shown above. + """ + + SPAN_FLAGS_TRACE_FLAGS_MASK = SpanFlags.V(255) + """Bits 0-7 are used for trace flags.""" + + SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK = SpanFlags.V(256) + """Bits 8 and 9 are used to indicate that the parent span or link span is remote. + Bit 8 (`HAS_IS_REMOTE`) indicates whether the value is known. + Bit 9 (`IS_REMOTE`) indicates whether the span or link is remote. + """ + + SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK = SpanFlags.V(512) + +SPAN_FLAGS_DO_NOT_USE = SpanFlags.V(0) +"""The zero value for the enum. Should not be used for comparisons. +Instead use bitwise "and" with the appropriate mask as shown above. +""" + +SPAN_FLAGS_TRACE_FLAGS_MASK = SpanFlags.V(255) +"""Bits 0-7 are used for trace flags.""" + +SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK = SpanFlags.V(256) +"""Bits 8 and 9 are used to indicate that the parent span or link span is remote. +Bit 8 (`HAS_IS_REMOTE`) indicates whether the value is known. +Bit 9 (`IS_REMOTE`) indicates whether the span or link is remote. +""" + +SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK = SpanFlags.V(512) +global___SpanFlags = SpanFlags + + class TracesData(google.protobuf.message.Message): """TracesData represents the traces data that can be stored in a persistent storage, OR can be embedded by other protocols that transfer OTLP traces data but do @@ -61,7 +116,10 @@ class ResourceSpans(google.protobuf.message.Message): """A list of ScopeSpans that originate from a resource.""" pass schema_url: typing.Text = ... - """This schema_url applies to the data in the "resource" field. It does not apply + """The Schema URL, if known. This is the identifier of the Schema that the resource data + is recorded in. To learn more about Schema URL see + https://opentelemetry.io/docs/specs/otel/schemas/#schema-url + This schema_url applies to the data in the "resource" field. It does not apply to the data in the "scope_spans" field which have their own schema_url field. """ @@ -93,7 +151,11 @@ class ScopeSpans(google.protobuf.message.Message): """A list of Spans that originate from an instrumentation scope.""" pass schema_url: typing.Text = ... - """This schema_url applies to all spans and span events in the "spans" field.""" + """The Schema URL, if known. This is the identifier of the Schema that the span data + is recorded in. To learn more about Schema URL see + https://opentelemetry.io/docs/specs/otel/schemas/#schema-url + This schema_url applies to all spans and span events in the "spans" field. + """ def __init__(self, *, @@ -234,6 +296,7 @@ class Span(google.protobuf.message.Message): TRACE_STATE_FIELD_NUMBER: builtins.int ATTRIBUTES_FIELD_NUMBER: builtins.int DROPPED_ATTRIBUTES_COUNT_FIELD_NUMBER: builtins.int + FLAGS_FIELD_NUMBER: builtins.int trace_id: builtins.bytes = ... """A unique identifier of a trace that this linked span is part of. The ID is a 16-byte array. @@ -257,6 +320,26 @@ class Span(google.protobuf.message.Message): then no attributes were dropped. """ + flags: builtins.int = ... + """Flags, a bit field. + + Bits 0-7 (8 least significant bits) are the trace flags as defined in W3C Trace + Context specification. To read the 8-bit W3C trace flag, use + `flags & SPAN_FLAGS_TRACE_FLAGS_MASK`. + + See https://www.w3.org/TR/trace-context-2/#trace-flags for the flag definitions. + + Bits 8 and 9 represent the 3 states of whether the link is remote. + The states are (unknown, is not remote, is remote). + To read whether the value is known, use `(flags & SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK) != 0`. + To read whether the link is remote, use `(flags & SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK) != 0`. + + Readers MUST NOT assume that bits 10-31 (22 most significant bits) will be zero. + When creating new spans, bits 10-31 (most-significant 22-bits) MUST be zero. + + [Optional]. + """ + def __init__(self, *, trace_id : builtins.bytes = ..., @@ -264,13 +347,15 @@ class Span(google.protobuf.message.Message): trace_state : typing.Text = ..., attributes : typing.Optional[typing.Iterable[opentelemetry.proto.common.v1.common_pb2.KeyValue]] = ..., dropped_attributes_count : builtins.int = ..., + flags : builtins.int = ..., ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["attributes",b"attributes","dropped_attributes_count",b"dropped_attributes_count","span_id",b"span_id","trace_id",b"trace_id","trace_state",b"trace_state"]) -> None: ... + def ClearField(self, field_name: typing_extensions.Literal["attributes",b"attributes","dropped_attributes_count",b"dropped_attributes_count","flags",b"flags","span_id",b"span_id","trace_id",b"trace_id","trace_state",b"trace_state"]) -> None: ... TRACE_ID_FIELD_NUMBER: builtins.int SPAN_ID_FIELD_NUMBER: builtins.int TRACE_STATE_FIELD_NUMBER: builtins.int PARENT_SPAN_ID_FIELD_NUMBER: builtins.int + FLAGS_FIELD_NUMBER: builtins.int NAME_FIELD_NUMBER: builtins.int KIND_FIELD_NUMBER: builtins.int START_TIME_UNIX_NANO_FIELD_NUMBER: builtins.int @@ -311,6 +396,30 @@ class Span(google.protobuf.message.Message): field must be empty. The ID is an 8-byte array. """ + flags: builtins.int = ... + """Flags, a bit field. + + Bits 0-7 (8 least significant bits) are the trace flags as defined in W3C Trace + Context specification. To read the 8-bit W3C trace flag, use + `flags & SPAN_FLAGS_TRACE_FLAGS_MASK`. + + See https://www.w3.org/TR/trace-context-2/#trace-flags for the flag definitions. + + Bits 8 and 9 represent the 3 states of whether a span's parent + is remote. The states are (unknown, is not remote, is remote). + To read whether the value is known, use `(flags & SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK) != 0`. + To read whether the span is remote, use `(flags & SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK) != 0`. + + When creating span messages, if the message is logically forwarded from another source + with an equivalent flags fields (i.e., usually another OTLP span message), the field SHOULD + be copied as-is. If creating from a source that does not have an equivalent flags field + (such as a runtime representation of an OpenTelemetry span), the high 22 bits MUST + be set to zero. + Readers MUST NOT assume that bits 10-31 (22 most significant bits) will be zero. + + [Optional]. + """ + name: typing.Text = ... """A description of the span's operation. @@ -403,6 +512,7 @@ class Span(google.protobuf.message.Message): span_id : builtins.bytes = ..., trace_state : typing.Text = ..., parent_span_id : builtins.bytes = ..., + flags : builtins.int = ..., name : typing.Text = ..., kind : global___Span.SpanKind.V = ..., start_time_unix_nano : builtins.int = ..., @@ -416,7 +526,7 @@ class Span(google.protobuf.message.Message): status : typing.Optional[global___Status] = ..., ) -> None: ... def HasField(self, field_name: typing_extensions.Literal["status",b"status"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal["attributes",b"attributes","dropped_attributes_count",b"dropped_attributes_count","dropped_events_count",b"dropped_events_count","dropped_links_count",b"dropped_links_count","end_time_unix_nano",b"end_time_unix_nano","events",b"events","kind",b"kind","links",b"links","name",b"name","parent_span_id",b"parent_span_id","span_id",b"span_id","start_time_unix_nano",b"start_time_unix_nano","status",b"status","trace_id",b"trace_id","trace_state",b"trace_state"]) -> None: ... + def ClearField(self, field_name: typing_extensions.Literal["attributes",b"attributes","dropped_attributes_count",b"dropped_attributes_count","dropped_events_count",b"dropped_events_count","dropped_links_count",b"dropped_links_count","end_time_unix_nano",b"end_time_unix_nano","events",b"events","flags",b"flags","kind",b"kind","links",b"links","name",b"name","parent_span_id",b"parent_span_id","span_id",b"span_id","start_time_unix_nano",b"start_time_unix_nano","status",b"status","trace_id",b"trace_id","trace_state",b"trace_state"]) -> None: ... global___Span = Span class Status(google.protobuf.message.Message): diff --git a/opentelemetry-proto/src/opentelemetry/proto/version.py b/opentelemetry-proto/src/opentelemetry/proto/version.py index 8c35630f0e1..e8b404f0501 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.24.0.dev" +__version__ = "1.25.0.dev" diff --git a/opentelemetry-proto/test-requirements.txt b/opentelemetry-proto/test-requirements-0 similarity index 94% rename from opentelemetry-proto/test-requirements.txt rename to opentelemetry-proto/test-requirements-0 index 4908ed5baaf..811544a0826 100644 --- a/opentelemetry-proto/test-requirements.txt +++ b/opentelemetry-proto/test-requirements-0 @@ -6,6 +6,7 @@ importlib-metadata==6.11.0 iniconfig==2.0.0 packaging==23.2 pluggy==1.4.0 +protobuf==3.20.3 py==1.11.0 py-cpuinfo==9.0.0 pytest==7.1.3 diff --git a/opentelemetry-proto/test-requirements-1 b/opentelemetry-proto/test-requirements-1 new file mode 100644 index 00000000000..5b10e6867a7 --- /dev/null +++ b/opentelemetry-proto/test-requirements-1 @@ -0,0 +1,18 @@ +asgiref==3.7.2 +attrs==23.2.0 +Deprecated==1.2.14 +flaky==3.7.0 +importlib-metadata==6.11.0 +iniconfig==2.0.0 +packaging==23.2 +pluggy==1.4.0 +protobuf==4.25.3 +py==1.11.0 +py-cpuinfo==9.0.0 +pytest==7.1.3 +pytest-benchmark==4.0.0 +tomli==2.0.1 +typing_extensions==4.10.0 +wrapt==1.16.0 +zipp==3.17.0 +-e opentelemetry-proto diff --git a/opentelemetry-sdk/LICENSE b/opentelemetry-sdk/LICENSE index 1ef7dad2c5c..261eeb9e9f8 100644 --- a/opentelemetry-sdk/LICENSE +++ b/opentelemetry-sdk/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright The OpenTelemetry Authors + Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/opentelemetry-sdk/pyproject.toml b/opentelemetry-sdk/pyproject.toml index ea5d1ec2b0c..25568d42c6d 100644 --- a/opentelemetry-sdk/pyproject.toml +++ b/opentelemetry-sdk/pyproject.toml @@ -25,8 +25,8 @@ classifiers = [ "Typing :: Typed", ] dependencies = [ - "opentelemetry-api == 1.24.0.dev", - "opentelemetry-semantic-conventions == 0.45b0.dev", + "opentelemetry-api == 1.25.0.dev", + "opentelemetry-semantic-conventions == 0.46b0.dev", "typing-extensions >= 3.7.4", ] diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/_configuration/__init__.py b/opentelemetry-sdk/src/opentelemetry/sdk/_configuration/__init__.py index 33c5147a599..14c560c41b0 100644 --- a/opentelemetry-sdk/src/opentelemetry/sdk/_configuration/__init__.py +++ b/opentelemetry-sdk/src/opentelemetry/sdk/_configuration/__init__.py @@ -265,7 +265,10 @@ def _import_exporters( metric_exporters = {} log_exporters = {} - for (exporter_name, exporter_impl,) in _import_config_components( + for ( + exporter_name, + exporter_impl, + ) in _import_config_components( trace_exporter_names, "opentelemetry_traces_exporter" ): if issubclass(exporter_impl, SpanExporter): @@ -273,7 +276,10 @@ def _import_exporters( else: raise RuntimeError(f"{exporter_name} is not a trace exporter") - for (exporter_name, exporter_impl,) in _import_config_components( + for ( + exporter_name, + exporter_impl, + ) in _import_config_components( metric_exporter_names, "opentelemetry_metrics_exporter" ): # The metric exporter components may be push MetricExporter or pull exporters which @@ -283,7 +289,10 @@ def _import_exporters( else: raise RuntimeError(f"{exporter_name} is not a metric exporter") - for (exporter_name, exporter_impl,) in _import_config_components( + for ( + exporter_name, + exporter_impl, + ) in _import_config_components( log_exporter_names, "opentelemetry_logs_exporter" ): if issubclass(exporter_impl, LogExporter): @@ -360,9 +369,9 @@ def _initialize_components(auto_instrumentation_version): auto_resource = {} # populate version if using auto-instrumentation if auto_instrumentation_version: - auto_resource[ - ResourceAttributes.TELEMETRY_AUTO_VERSION - ] = auto_instrumentation_version + auto_resource[ResourceAttributes.TELEMETRY_AUTO_VERSION] = ( + auto_instrumentation_version + ) resource = Resource.create(auto_resource) _init_tracing( diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/_logs/_internal/__init__.py b/opentelemetry-sdk/src/opentelemetry/sdk/_logs/_internal/__init__.py index 8ba0dae6f2e..08835942971 100644 --- a/opentelemetry-sdk/src/opentelemetry/sdk/_logs/_internal/__init__.py +++ b/opentelemetry-sdk/src/opentelemetry/sdk/_logs/_internal/__init__.py @@ -202,22 +202,26 @@ def to_json(self, indent=4) -> str: "body": self.body, "severity_number": repr(self.severity_number), "severity_text": self.severity_text, - "attributes": dict(self.attributes) - if bool(self.attributes) - else None, + "attributes": ( + dict(self.attributes) if bool(self.attributes) else None + ), "dropped_attributes": self.dropped_attributes, "timestamp": ns_to_iso_str(self.timestamp), "observed_timestamp": ns_to_iso_str(self.observed_timestamp), - "trace_id": f"0x{format_trace_id(self.trace_id)}" - if self.trace_id is not None - else "", - "span_id": f"0x{format_span_id(self.span_id)}" - if self.span_id is not None - else "", + "trace_id": ( + f"0x{format_trace_id(self.trace_id)}" + if self.trace_id is not None + else "" + ), + "span_id": ( + f"0x{format_span_id(self.span_id)}" + if self.span_id is not None + else "" + ), "trace_flags": self.trace_flags, - "resource": repr(self.resource.attributes) - if self.resource - else "", + "resource": ( + repr(self.resource.attributes) if self.resource else "" + ), }, indent=indent, ) diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/aggregation.py b/opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/aggregation.py index 3ec37473f60..3f93c91fa24 100644 --- a/opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/aggregation.py +++ b/opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/aggregation.py @@ -37,6 +37,9 @@ from opentelemetry.sdk.metrics._internal.exponential_histogram.buckets import ( Buckets, ) +from opentelemetry.sdk.metrics._internal.exponential_histogram.mapping import ( + Mapping, +) from opentelemetry.sdk.metrics._internal.exponential_histogram.mapping.exponent_mapping import ( ExponentMapping, ) @@ -519,6 +522,12 @@ def collect( return None +def _new_exponential_mapping(scale: int) -> Mapping: + if scale <= 0: + return ExponentMapping(scale) + return LogarithmMapping(scale) + + # pylint: disable=protected-access class _ExponentialBucketHistogramAggregation(_Aggregation[HistogramPoint]): # _min_max_size and _max_max_size are the smallest and largest values @@ -592,13 +601,15 @@ def __init__( "larger than the recommended value of 20", self._max_scale, ) - self._mapping = LogarithmMapping(self._max_scale) + self._mapping = _new_exponential_mapping(self._max_scale) self._instrument_aggregation_temporality = AggregationTemporality.DELTA self._start_time_unix_nano = start_time_unix_nano self._previous_scale = None self._previous_start_time_unix_nano = None + self._previous_zero_count = None + self._previous_count = None self._previous_sum = None self._previous_max = None self._previous_min = None @@ -678,11 +689,14 @@ def aggregate(self, measurement: Measurement) -> None: # 4. Rescale the mapping if needed. if is_rescaling_needed: + scale_change = self._get_scale_change(low, high) self._downscale( - self._get_scale_change(low, high), + scale_change, self._positive, self._negative, ) + new_scale = self._mapping.scale - scale_change + self._mapping = _new_exponential_mapping(new_scale) index = self._mapping.map_to_index(value) @@ -756,28 +770,6 @@ def collect( self._min = inf self._max = -inf - current_point = ExponentialHistogramDataPoint( - attributes=self._attributes, - start_time_unix_nano=current_start_time_unix_nano, - time_unix_nano=collection_start_nano, - count=current_count, - sum=current_sum, - scale=current_scale, - zero_count=current_zero_count, - positive=BucketsPoint( - offset=current_positive.offset, - bucket_counts=current_positive.counts, - ), - negative=BucketsPoint( - offset=current_negative.offset, - bucket_counts=current_negative.counts, - ), - # FIXME: Find the right value for flags - flags=0, - min=current_min, - max=current_max, - ) - if self._previous_scale is None or ( self._instrument_aggregation_temporality is collection_aggregation_temporality @@ -789,18 +781,48 @@ def collect( self._previous_max = current_max self._previous_min = current_min self._previous_sum = current_sum + self._previous_count = current_count + self._previous_zero_count = current_zero_count self._previous_positive = current_positive self._previous_negative = current_negative + current_point = ExponentialHistogramDataPoint( + attributes=self._attributes, + start_time_unix_nano=current_start_time_unix_nano, + time_unix_nano=collection_start_nano, + count=current_count, + sum=current_sum, + scale=current_scale, + zero_count=current_zero_count, + positive=BucketsPoint( + offset=current_positive.offset, + bucket_counts=current_positive.get_offset_counts(), + ), + negative=BucketsPoint( + offset=current_negative.offset, + bucket_counts=current_negative.get_offset_counts(), + ), + # FIXME: Find the right value for flags + flags=0, + min=current_min, + max=current_max, + ) + return current_point min_scale = min(self._previous_scale, current_scale) low_positive, high_positive = self._get_low_high_previous_current( - self._previous_positive, current_positive, min_scale + self._previous_positive, + current_positive, + current_scale, + min_scale, ) low_negative, high_negative = self._get_low_high_previous_current( - self._previous_negative, current_negative, min_scale + self._previous_negative, + current_negative, + current_scale, + min_scale, ) min_scale = min( @@ -814,10 +836,11 @@ def collect( # but the histogram) has a count larger than zero, if not, scale # (the histogram scale) would be zero. See exponential.go 191 self._downscale( - self._mapping.scale - min_scale, + self._previous_scale - min_scale, self._previous_positive, self._previous_negative, ) + self._previous_scale = min_scale if ( collection_aggregation_temporality @@ -826,6 +849,8 @@ def collect( start_time_unix_nano = self._previous_start_time_unix_nano sum_ = current_sum + self._previous_sum + zero_count = current_zero_count + self._previous_zero_count + count = current_count + self._previous_count # Only update min/max on delta -> cumulative max_ = max(current_max, self._previous_max) min_ = min(current_min, self._previous_min) @@ -844,10 +869,16 @@ def collect( min_scale, collection_aggregation_temporality, ) + current_scale = min_scale + + current_positive = self._previous_positive + current_negative = self._previous_negative else: start_time_unix_nano = self._previous_start_time_unix_nano sum_ = current_sum - self._previous_sum + zero_count = current_zero_count + count = current_count max_ = current_max min_ = current_min @@ -870,17 +901,17 @@ def collect( attributes=self._attributes, start_time_unix_nano=start_time_unix_nano, time_unix_nano=collection_start_nano, - count=current_count, + count=count, sum=sum_, scale=current_scale, - zero_count=current_zero_count, + zero_count=zero_count, positive=BucketsPoint( offset=current_positive.offset, - bucket_counts=current_positive.counts, + bucket_counts=current_positive.get_offset_counts(), ), negative=BucketsPoint( offset=current_negative.offset, - bucket_counts=current_negative.counts, + bucket_counts=current_negative.get_offset_counts(), ), # FIXME: Find the right value for flags flags=0, @@ -892,19 +923,27 @@ def collect( self._previous_positive = current_positive self._previous_negative = current_negative self._previous_start_time_unix_nano = current_start_time_unix_nano - self._previous_sum = current_sum + self._previous_sum = sum_ + self._previous_count = count + self._previous_max = max_ + self._previous_min = min_ + self._previous_zero_count = zero_count return current_point def _get_low_high_previous_current( - self, previous_point_buckets, current_point_buckets, min_scale + self, + previous_point_buckets, + current_point_buckets, + current_scale, + min_scale, ): (previous_point_low, previous_point_high) = self._get_low_high( - previous_point_buckets, min_scale + previous_point_buckets, self._previous_scale, min_scale ) (current_point_low, current_point_high) = self._get_low_high( - current_point_buckets, min_scale + current_point_buckets, current_scale, min_scale ) if current_point_low > current_point_high: @@ -921,11 +960,12 @@ def _get_low_high_previous_current( return low, high - def _get_low_high(self, buckets, min_scale): + @staticmethod + def _get_low_high(buckets, scale, min_scale): if buckets.counts == [0]: return 0, -1 - shift = self._mapping._scale - min_scale + shift = scale - min_scale return buckets.index_start >> shift, buckets.index_end >> shift @@ -941,7 +981,8 @@ def _get_scale_change(self, low, high): return change - def _downscale(self, change: int, positive, negative): + @staticmethod + def _downscale(change: int, positive, negative): if change == 0: return @@ -949,22 +990,13 @@ def _downscale(self, change: int, positive, negative): if change < 0: raise Exception("Invalid change of scale") - new_scale = self._mapping.scale - change - positive.downscale(change) negative.downscale(change) - if new_scale <= 0: - mapping = ExponentMapping(new_scale) - else: - mapping = LogarithmMapping(new_scale) - - self._mapping = mapping - def _merge( self, - previous_buckets, - current_buckets, + previous_buckets: Buckets, + current_buckets: Buckets, current_scale, min_scale, aggregation_temporality, @@ -983,9 +1015,11 @@ def _merge( # would not happen because self._previous_point is only assigned to # an ExponentialHistogramDataPoint object if self._count != 0. - index = ( - current_buckets.offset + current_bucket_index - ) >> current_change + current_index = current_buckets.index_base + current_bucket_index + if current_index > current_buckets.index_end: + current_index -= len(current_buckets.counts) + + index = current_index >> current_change if index < previous_buckets.index_start: span = previous_buckets.index_end - index @@ -999,7 +1033,7 @@ def _merge( previous_buckets.index_start = index if index > previous_buckets.index_end: - span = index - previous_buckets.index_end + span = index - previous_buckets.index_start if span >= self._max_size: raise Exception("Incorrect merge scale") diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/exponential_histogram/buckets.py b/opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/exponential_histogram/buckets.py index 5c6b04bd39b..4dbe8f385e8 100644 --- a/opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/exponential_histogram/buckets.py +++ b/opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/exponential_histogram/buckets.py @@ -73,6 +73,10 @@ def index_base(self, value: int) -> None: def counts(self): return self._counts + def get_offset_counts(self): + bias = self.__index_base - self.__index_start + return self._counts[-bias:] + self._counts[:-bias] + def grow(self, needed: int, max_size: int) -> None: size = len(self._counts) @@ -129,7 +133,6 @@ def downscale(self, amount: int) -> None: bias = self.__index_base - self.__index_start if bias != 0: - self.__index_base = self.__index_start # [0, 1, 2, 3, 4] Original backing array 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 14546636a94..02dc2cf287a 100644 --- a/opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/export/__init__.py +++ b/opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/export/__init__.py @@ -247,27 +247,27 @@ def __init__( if typ is Counter: self._instrument_class_temporality[_Counter] = temporality elif typ is UpDownCounter: - self._instrument_class_temporality[ - _UpDownCounter - ] = temporality + self._instrument_class_temporality[_UpDownCounter] = ( + temporality + ) elif typ is Histogram: - self._instrument_class_temporality[ - _Histogram - ] = temporality + self._instrument_class_temporality[_Histogram] = ( + temporality + ) elif typ is Gauge: self._instrument_class_temporality[_Gauge] = temporality elif typ is ObservableCounter: - self._instrument_class_temporality[ - _ObservableCounter - ] = temporality + self._instrument_class_temporality[_ObservableCounter] = ( + temporality + ) elif typ is ObservableUpDownCounter: self._instrument_class_temporality[ _ObservableUpDownCounter ] = temporality elif typ is ObservableGauge: - self._instrument_class_temporality[ - _ObservableGauge - ] = temporality + self._instrument_class_temporality[_ObservableGauge] = ( + temporality + ) else: raise Exception(f"Invalid instrument class found {typ}") @@ -287,27 +287,27 @@ def __init__( if typ is Counter: self._instrument_class_aggregation[_Counter] = aggregation elif typ is UpDownCounter: - self._instrument_class_aggregation[ - _UpDownCounter - ] = aggregation + self._instrument_class_aggregation[_UpDownCounter] = ( + aggregation + ) elif typ is Histogram: - self._instrument_class_aggregation[ - _Histogram - ] = aggregation + self._instrument_class_aggregation[_Histogram] = ( + aggregation + ) elif typ is Gauge: self._instrument_class_aggregation[_Gauge] = aggregation elif typ is ObservableCounter: - self._instrument_class_aggregation[ - _ObservableCounter - ] = aggregation + self._instrument_class_aggregation[_ObservableCounter] = ( + aggregation + ) elif typ is ObservableUpDownCounter: self._instrument_class_aggregation[ _ObservableUpDownCounter ] = aggregation elif typ is ObservableGauge: - self._instrument_class_aggregation[ - _ObservableGauge - ] = aggregation + self._instrument_class_aggregation[_ObservableGauge] = ( + aggregation + ) else: raise Exception(f"Invalid instrument class found {typ}") @@ -398,13 +398,13 @@ def __init__( preferred_aggregation=preferred_aggregation, ) self._lock = RLock() - self._metrics_data: ( - "opentelemetry.sdk.metrics.export.MetricsData" - ) = None + self._metrics_data: "opentelemetry.sdk.metrics.export.MetricsData" = ( + None + ) def get_metrics_data( self, - ) -> ("opentelemetry.sdk.metrics.export.MetricsData"): + ) -> "opentelemetry.sdk.metrics.export.MetricsData": """Reads and returns current metrics from the SDK""" with self._lock: self.collect() @@ -551,9 +551,7 @@ def _shutdown(): self._shutdown_event.set() if self._daemon_thread: - self._daemon_thread.join( - timeout=(deadline_ns - time_ns()) / 10**9 - ) + self._daemon_thread.join(timeout=(deadline_ns - time_ns()) / 10**9) self._exporter.shutdown(timeout=(deadline_ns - time_ns()) / 10**6) def force_flush(self, timeout_millis: float = 10_000) -> bool: diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/metric_reader_storage.py b/opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/metric_reader_storage.py index 700ace87204..7fac6c6c105 100644 --- a/opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/metric_reader_storage.py +++ b/opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/metric_reader_storage.py @@ -107,9 +107,9 @@ def _get_or_init_view_instrument_match( ), ) ) - self._instrument_view_instrument_matches[ - instrument - ] = view_instrument_matches + self._instrument_view_instrument_matches[instrument] = ( + view_instrument_matches + ) return view_instrument_matches @@ -136,9 +136,9 @@ def collect(self) -> Optional[MetricsData]: with self._lock: - instrumentation_scope_scope_metrics: ( - Dict[InstrumentationScope, ScopeMetrics] - ) = {} + instrumentation_scope_scope_metrics: Dict[ + InstrumentationScope, ScopeMetrics + ] = {} for ( instrument, diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/point.py b/opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/point.py index c30705c59a4..42420b9008e 100644 --- a/opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/point.py +++ b/opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/point.py @@ -101,6 +101,18 @@ class ExponentialHistogram: "opentelemetry.sdk.metrics.export.AggregationTemporality" ) + def to_json(self, indent=4) -> str: + return dumps( + { + "data_points": [ + loads(data_point.to_json(indent=indent)) + for data_point in self.data_points + ], + "aggregation_temporality": self.aggregation_temporality, + }, + indent=indent, + ) + @dataclass(frozen=True) class Sum: diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/resources/__init__.py b/opentelemetry-sdk/src/opentelemetry/sdk/resources/__init__.py index 852b23f5002..20dd56862a0 100644 --- a/opentelemetry-sdk/src/opentelemetry/sdk/resources/__init__.py +++ b/opentelemetry-sdk/src/opentelemetry/sdk/resources/__init__.py @@ -335,10 +335,12 @@ def detect(self) -> "Resource": _runtime_version = ".".join( map( str, - sys.version_info[:3] - if sys.version_info.releaselevel == "final" - and not sys.version_info.serial - else sys.version_info, + ( + sys.version_info[:3] + if sys.version_info.releaselevel == "final" + and not sys.version_info.serial + else sys.version_info + ), ) ) _process_pid = os.getpid() diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/trace/__init__.py b/opentelemetry-sdk/src/opentelemetry/sdk/trace/__init__.py index 5ba183a2cd1..55a375315b4 100644 --- a/opentelemetry-sdk/src/opentelemetry/sdk/trace/__init__.py +++ b/opentelemetry-sdk/src/opentelemetry/sdk/trace/__init__.py @@ -30,6 +30,7 @@ Dict, Iterator, List, + MutableMapping, Optional, Sequence, Tuple, @@ -484,9 +485,9 @@ def to_json(self, indent: int = 4): f_span = { "name": self._name, - "context": self._format_context(self._context) - if self._context - else None, + "context": ( + self._format_context(self._context) if self._context else None + ), "kind": str(self.kind), "parent_id": parent_id, "start_time": start_time, @@ -626,23 +627,29 @@ def __init__( self.max_span_attributes = self._from_env_if_absent( max_span_attributes, OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT, - global_max_attributes - if global_max_attributes is not None - else _DEFAULT_OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT, + ( + global_max_attributes + if global_max_attributes is not None + else _DEFAULT_OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT + ), ) self.max_event_attributes = self._from_env_if_absent( max_event_attributes, OTEL_EVENT_ATTRIBUTE_COUNT_LIMIT, - global_max_attributes - if global_max_attributes is not None - else _DEFAULT_OTEL_EVENT_ATTRIBUTE_COUNT_LIMIT, + ( + global_max_attributes + if global_max_attributes is not None + else _DEFAULT_OTEL_EVENT_ATTRIBUTE_COUNT_LIMIT + ), ) self.max_link_attributes = self._from_env_if_absent( max_link_attributes, OTEL_LINK_ATTRIBUTE_COUNT_LIMIT, - global_max_attributes - if global_max_attributes is not None - else _DEFAULT_OTEL_LINK_ATTRIBUTE_COUNT_LIMIT, + ( + global_max_attributes + if global_max_attributes is not None + else _DEFAULT_OTEL_LINK_ATTRIBUTE_COUNT_LIMIT + ), ) # attribute length @@ -745,17 +752,17 @@ def __init__( parent: Optional[trace_api.SpanContext] = None, sampler: Optional[sampling.Sampler] = None, trace_config: None = None, # TODO - resource: Resource = None, + resource: Optional[Resource] = None, attributes: types.Attributes = None, - events: Sequence[Event] = None, + events: Optional[Sequence[Event]] = None, links: Sequence[trace_api.Link] = (), kind: trace_api.SpanKind = trace_api.SpanKind.INTERNAL, span_processor: SpanProcessor = SpanProcessor(), - instrumentation_info: InstrumentationInfo = None, + instrumentation_info: Optional[InstrumentationInfo] = None, record_exception: bool = True, set_status_on_exception: bool = True, limits=_UnsetLimits, - instrumentation_scope: InstrumentationScope = None, + instrumentation_scope: Optional[InstrumentationScope] = None, ) -> None: if resource is None: resource = Resource.create({}) @@ -982,7 +989,7 @@ def __exit__( def record_exception( self, - exception: Exception, + exception: BaseException, attributes: types.Attributes = None, timestamp: Optional[int] = None, escaped: bool = False, @@ -994,8 +1001,15 @@ def record_exception( type(exception), value=exception, tb=exception.__traceback__ ) ) - _attributes = { - "exception.type": exception.__class__.__name__, + module = type(exception).__module__ + qualname = type(exception).__qualname__ + exception_type = ( + f"{module}.{qualname}" + if module and module != "builtins" + else qualname + ) + _attributes: MutableMapping[str, types.AttributeValue] = { + "exception.type": exception_type, "exception.message": str(exception), "exception.stacktrace": stacktrace, "exception.escaped": str(escaped), @@ -1045,7 +1059,7 @@ def start_as_current_span( context: Optional[context_api.Context] = None, kind: trace_api.SpanKind = trace_api.SpanKind.INTERNAL, attributes: types.Attributes = None, - links: Sequence[trace_api.Link] = (), + links: Optional[Sequence[trace_api.Link]] = (), start_time: Optional[int] = None, record_exception: bool = True, set_status_on_exception: bool = True, @@ -1075,7 +1089,7 @@ def start_span( # pylint: disable=too-many-locals context: Optional[context_api.Context] = None, kind: trace_api.SpanKind = trace_api.SpanKind.INTERNAL, attributes: types.Attributes = None, - links: Sequence[trace_api.Link] = (), + links: Optional[Sequence[trace_api.Link]] = (), start_time: Optional[int] = None, record_exception: bool = True, set_status_on_exception: bool = True, @@ -1152,15 +1166,15 @@ class TracerProvider(trace_api.TracerProvider): def __init__( self, - sampler: sampling.Sampler = None, - resource: Resource = None, + sampler: Optional[sampling.Sampler] = None, + resource: Optional[Resource] = None, shutdown_on_exit: bool = True, active_span_processor: Union[ - SynchronousMultiSpanProcessor, ConcurrentMultiSpanProcessor + SynchronousMultiSpanProcessor, ConcurrentMultiSpanProcessor, None ] = None, - id_generator: IdGenerator = None, - span_limits: SpanLimits = None, - ): + id_generator: Optional[IdGenerator] = None, + span_limits: Optional[SpanLimits] = None, + ) -> None: self._active_span_processor = ( active_span_processor or SynchronousMultiSpanProcessor() ) diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/trace/sampling.py b/opentelemetry-sdk/src/opentelemetry/sdk/trace/sampling.py index 0236fac6b62..40e142ea1a9 100644 --- a/opentelemetry-sdk/src/opentelemetry/sdk/trace/sampling.py +++ b/opentelemetry-sdk/src/opentelemetry/sdk/trace/sampling.py @@ -184,7 +184,7 @@ def __init__( self, decision: Decision, attributes: "Attributes" = None, - trace_state: "TraceState" = None, + trace_state: Optional["TraceState"] = None, ) -> None: self.decision = decision if attributes is None: @@ -201,10 +201,10 @@ def should_sample( parent_context: Optional["Context"], trace_id: int, name: str, - kind: SpanKind = None, + kind: Optional[SpanKind] = None, attributes: Attributes = None, - links: Sequence["Link"] = None, - trace_state: "TraceState" = None, + links: Optional[Sequence["Link"]] = None, + trace_state: Optional["TraceState"] = None, ) -> "SamplingResult": pass @@ -216,7 +216,7 @@ def get_description(self) -> str: class StaticSampler(Sampler): """Sampler that always returns the same decision.""" - def __init__(self, decision: "Decision"): + def __init__(self, decision: "Decision") -> None: self._decision = decision def should_sample( @@ -224,10 +224,10 @@ def should_sample( parent_context: Optional["Context"], trace_id: int, name: str, - kind: SpanKind = None, + kind: Optional[SpanKind] = None, attributes: Attributes = None, - links: Sequence["Link"] = None, - trace_state: "TraceState" = None, + links: Optional[Sequence["Link"]] = None, + trace_state: Optional["TraceState"] = None, ) -> "SamplingResult": if self._decision is Decision.DROP: attributes = None @@ -285,10 +285,10 @@ def should_sample( parent_context: Optional["Context"], trace_id: int, name: str, - kind: SpanKind = None, + kind: Optional[SpanKind] = None, attributes: Attributes = None, - links: Sequence["Link"] = None, - trace_state: "TraceState" = None, + links: Optional[Sequence["Link"]] = None, + trace_state: Optional["TraceState"] = None, ) -> "SamplingResult": decision = Decision.DROP if trace_id & self.TRACE_ID_LIMIT < self.bound: @@ -340,10 +340,10 @@ def should_sample( parent_context: Optional["Context"], trace_id: int, name: str, - kind: SpanKind = None, + kind: Optional[SpanKind] = None, attributes: Attributes = None, - links: Sequence["Link"] = None, - trace_state: "TraceState" = None, + links: Optional[Sequence["Link"]] = None, + trace_state: Optional["TraceState"] = None, ) -> "SamplingResult": parent_span_context = get_current_span( parent_context @@ -443,7 +443,9 @@ def _get_from_env_or_default() -> Sampler: return _KNOWN_SAMPLERS[trace_sampler] -def _get_parent_trace_state(parent_context) -> Optional["TraceState"]: +def _get_parent_trace_state( + parent_context: Optional[Context], +) -> Optional["TraceState"]: parent_span_context = get_current_span(parent_context).get_span_context() if parent_span_context is None or not parent_span_context.is_valid: return None diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/util/__init__.py b/opentelemetry-sdk/src/opentelemetry/sdk/util/__init__.py index c74ecd0c649..68f10ddc9e9 100644 --- a/opentelemetry-sdk/src/opentelemetry/sdk/util/__init__.py +++ b/opentelemetry-sdk/src/opentelemetry/sdk/util/__init__.py @@ -34,9 +34,9 @@ def get_dict_as_key(labels): return tuple( sorted( map( - lambda kv: (kv[0], tuple(kv[1])) - if isinstance(kv[1], list) - else kv, + lambda kv: ( + (kv[0], tuple(kv[1])) if isinstance(kv[1], list) else kv + ), labels.items(), ) ) diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/version.py b/opentelemetry-sdk/src/opentelemetry/sdk/version.py index 8c35630f0e1..e8b404f0501 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.24.0.dev" +__version__ = "1.25.0.dev" diff --git a/opentelemetry-sdk/test-requirements.txt b/opentelemetry-sdk/test-requirements similarity index 100% rename from opentelemetry-sdk/test-requirements.txt rename to opentelemetry-sdk/test-requirements diff --git a/opentelemetry-sdk/tests/metrics/exponential_histogram/test_exponential_bucket_histogram_aggregation.py b/opentelemetry-sdk/tests/metrics/exponential_histogram/test_exponential_bucket_histogram_aggregation.py index 311f00a0b00..bae0aca20bf 100644 --- a/opentelemetry-sdk/tests/metrics/exponential_histogram/test_exponential_bucket_histogram_aggregation.py +++ b/opentelemetry-sdk/tests/metrics/exponential_histogram/test_exponential_bucket_histogram_aggregation.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import random as insecure_random from itertools import permutations from logging import WARNING from math import ldexp @@ -37,6 +38,9 @@ LogarithmMapping, ) from opentelemetry.sdk.metrics._internal.measurement import Measurement +from opentelemetry.sdk.metrics._internal.point import ( + ExponentialHistogramDataPoint, +) from opentelemetry.sdk.metrics.view import ( ExponentialBucketHistogramAggregation, ) @@ -853,13 +857,14 @@ def test_aggregate_collect(self): AggregationTemporality.CUMULATIVE, 0 ) - def test_collect_results_cumulative(self): + def test_collect_results_cumulative(self) -> None: exponential_histogram_aggregation = ( _ExponentialBucketHistogramAggregation( Mock(), Mock(), ) ) + self.maxDiff = None self.assertEqual(exponential_histogram_aggregation._mapping._scale, 20) @@ -884,7 +889,7 @@ def test_collect_results_cumulative(self): self.assertEqual(collection_0.zero_count, 0) self.assertEqual( collection_0.positive.bucket_counts, - [1, *[0] * 63, 1, *[0] * 31, 1, *[0] * 63], + [1, *[0] * 63, 1, *[0] * 63, 1, *[0] * 31], ) self.assertEqual(collection_0.flags, 0) self.assertEqual(collection_0.min, 1) @@ -911,7 +916,7 @@ def test_collect_results_cumulative(self): previous_count = count count_counts.append([previous_count, 1]) - self.assertEqual(collection_1.count, 5) + self.assertEqual(collection_1.count, 8) self.assertEqual(collection_1.sum, 16.645) self.assertEqual(collection_1.scale, 4) self.assertEqual(collection_1.zero_count, 0) @@ -920,21 +925,68 @@ def test_collect_results_cumulative(self): collection_1.positive.bucket_counts, [ 1, - *[0] * 15, + *[0] * 17, 1, - *[0] * 47, + *[0] * 36, 1, - *[0] * 40, + *[0] * 15, + 2, + *[0] * 15, 1, - *[0] * 17, + *[0] * 15, 1, - *[0] * 36, + *[0] * 15, + 1, + *[0] * 40, ], ) self.assertEqual(collection_1.flags, 0) self.assertEqual(collection_1.min, 0.045) self.assertEqual(collection_1.max, 8) + def test_cumulative_aggregation_with_random_data(self) -> None: + histogram = _ExponentialBucketHistogramAggregation(Mock(), Mock()) + + def collect_and_validate() -> None: + result: ExponentialHistogramDataPoint = histogram.collect( + AggregationTemporality.CUMULATIVE, 0 + ) + buckets = result.positive.bucket_counts + scale = result.scale + index_start = result.positive.offset + + for i in range(len(buckets)): + index = index_start + i + count = buckets[i] + lower_bound = 2 ** (index / (2**scale)) + upper_bound = 2 ** ((index + 1) / (2**scale)) + matches = 0 + for value in values: + if value > lower_bound and value <= upper_bound: + matches += 1 + assert ( + matches == count + ), f"index: {index}, count: {count}, scale: {scale}, lower_bound: {lower_bound}, upper_bound: {upper_bound}, matches: {matches}" + + assert sum(buckets) + result.zero_count == len(values) + assert result.sum == sum(values) + assert result.count == len(values) + assert result.min == min(values) + assert result.max == max(values) + assert result.zero_count == len([v for v in values if v == 0]) + assert scale >= 3 + + random = insecure_random.Random("opentelemetry2") + values = [] + for i in range(2000): + value = random.randint(0, 1000) + values.append(value) + histogram.aggregate(Measurement(value, Mock())) + if i % 20 == 0: + collect_and_validate() + + collect_and_validate() + def test_merge_collect_cumulative(self): exponential_histogram_aggregation = ( _ExponentialBucketHistogramAggregation(Mock(), Mock(), max_size=4) @@ -974,7 +1026,8 @@ def test_merge_collect_cumulative(self): 0, ) - self.assertEqual(result.scale, result_1.scale) + self.assertEqual(result.scale, 0) + self.assertEqual(result_1.scale, -1) def test_merge_collect_delta(self): exponential_histogram_aggregation = ( diff --git a/opentelemetry-sdk/tests/metrics/integration_test/test_cpu_time.py b/opentelemetry-sdk/tests/metrics/integration_test/test_cpu_time.py index 7b440c0332a..18b8cbdcea0 100644 --- a/opentelemetry-sdk/tests/metrics/integration_test/test_cpu_time.py +++ b/opentelemetry-sdk/tests/metrics/integration_test/test_cpu_time.py @@ -188,9 +188,9 @@ def cpu_time_callback( ) def test_cpu_time_generator(self): - def cpu_time_generator() -> Generator[ - Iterable[Observation], None, None - ]: + def cpu_time_generator() -> ( + Generator[Iterable[Observation], None, None] + ): options = yield while True: self.assertIsInstance(options, CallbackOptions) diff --git a/opentelemetry-sdk/tests/metrics/integration_test/test_explicit_bucket_histogram_aggregation.py b/opentelemetry-sdk/tests/metrics/integration_test/test_explicit_bucket_histogram_aggregation.py index 6db35fd4c0a..bdae2aad13e 100644 --- a/opentelemetry-sdk/tests/metrics/integration_test/test_explicit_bucket_histogram_aggregation.py +++ b/opentelemetry-sdk/tests/metrics/integration_test/test_explicit_bucket_histogram_aggregation.py @@ -193,9 +193,11 @@ def test_synchronous_cumulative_temporality(self): metric_data.bucket_counts, tuple( [ - 0 - if internal_index < 1 or internal_index > index + 1 - else 1 + ( + 0 + if internal_index < 1 or internal_index > index + 1 + else 1 + ) for internal_index in range(16) ] ), diff --git a/opentelemetry-sdk/tests/metrics/test_point.py b/opentelemetry-sdk/tests/metrics/test_point.py index 5d6640fdea6..20dd0e72384 100644 --- a/opentelemetry-sdk/tests/metrics/test_point.py +++ b/opentelemetry-sdk/tests/metrics/test_point.py @@ -16,6 +16,9 @@ from opentelemetry.sdk.metrics.export import ( AggregationTemporality, + Buckets, + ExponentialHistogram, + ExponentialHistogramDataPoint, Gauge, Histogram, HistogramDataPoint, @@ -100,6 +103,22 @@ def setUpClass(cls): ) cls.histogram_data_point_1_str = f'{{"attributes": {cls.attributes_1_str}, "start_time_unix_nano": 2, "time_unix_nano": 3, "count": 4, "sum": 4.4, "bucket_counts": [2, 1, 1], "explicit_bounds": [1.2, 2.3, 3.4, 4.5], "min": 0.3, "max": 4.4}}' + cls.exp_histogram_data_point_0 = ExponentialHistogramDataPoint( + attributes=cls.attributes_0, + start_time_unix_nano=1, + time_unix_nano=2, + count=1, + sum=10, + scale=1, + zero_count=0, + positive=Buckets(offset=0, bucket_counts=[1]), + negative=Buckets(offset=0, bucket_counts=[0]), + flags=0, + min=10, + max=10, + ) + cls.exp_histogram_data_point_0_str = f'{{"attributes": {cls.attributes_0_str}, "start_time_unix_nano": 1, "time_unix_nano": 2, "count": 1, "sum": 10, "scale": 1, "zero_count": 0, "positive": {{"offset": 0, "bucket_counts": [1]}}, "negative": {{"offset": 0, "bucket_counts": [0]}}, "flags": 0, "min": 10, "max": 10}}' + cls.sum_0 = Sum( data_points=[cls.number_data_point_0, cls.number_data_point_1], aggregation_temporality=AggregationTemporality.DELTA, @@ -121,6 +140,14 @@ def setUpClass(cls): ) cls.histogram_0_str = f'{{"data_points": [{cls.histogram_data_point_0_str}, {cls.histogram_data_point_1_str}], "aggregation_temporality": 1}}' + cls.exp_histogram_0 = ExponentialHistogram( + data_points=[ + cls.exp_histogram_data_point_0, + ], + aggregation_temporality=AggregationTemporality.CUMULATIVE, + ) + cls.exp_histogram_0_str = f'{{"data_points": [{cls.exp_histogram_data_point_0_str}], "aggregation_temporality": 2}}' + cls.metric_0 = Metric( name="metric_0", description="description_0", @@ -209,6 +236,15 @@ def test_histogram_data_point(self): self.histogram_data_point_1_str, ) + def test_exp_histogram_data_point(self): + + self.maxDiff = None + + self.assertEqual( + self.exp_histogram_data_point_0.to_json(indent=None), + self.exp_histogram_data_point_0_str, + ) + def test_sum(self): self.assertEqual(self.sum_0.to_json(indent=None), self.sum_0_str) @@ -225,6 +261,14 @@ def test_histogram(self): self.histogram_0.to_json(indent=None), self.histogram_0_str ) + def test_exp_histogram(self): + + self.maxDiff = None + + self.assertEqual( + self.exp_histogram_0.to_json(indent=None), self.exp_histogram_0_str + ) + def test_metric(self): self.assertEqual(self.metric_0.to_json(indent=None), self.metric_0_str) diff --git a/opentelemetry-sdk/tests/resources/test_resources.py b/opentelemetry-sdk/tests/resources/test_resources.py index da3f9469617..a0c6159010d 100644 --- a/opentelemetry-sdk/tests/resources/test_resources.py +++ b/opentelemetry-sdk/tests/resources/test_resources.py @@ -511,9 +511,9 @@ def test_invalid_key_value_pairs(self): def test_multiple_with_url_decode(self): detector = OTELResourceDetector() - environ[ - OTEL_RESOURCE_ATTRIBUTES - ] = "key=value%20test%0A, key2=value+%202" + environ[OTEL_RESOURCE_ATTRIBUTES] = ( + "key=value%20test%0A, key2=value+%202" + ) self.assertEqual( detector.detect(), Resource({"key": "value test\n", "key2": "value+ 2"}), diff --git a/opentelemetry-sdk/tests/trace/test_trace.py b/opentelemetry-sdk/tests/trace/test_trace.py index 5441bed6dd7..72c7095da70 100644 --- a/opentelemetry-sdk/tests/trace/test_trace.py +++ b/opentelemetry-sdk/tests/trace/test_trace.py @@ -636,6 +636,10 @@ def test_events(self): self.assertEqual(span.events, tuple(events)) +class DummyError(Exception): + pass + + class TestSpan(unittest.TestCase): # pylint: disable=too-many-public-methods @@ -1144,6 +1148,25 @@ def error_status_test(context): .start_as_current_span("root") ) + def test_record_exception_fqn(self): + span = trace._Span("name", mock.Mock(spec=trace_api.SpanContext)) + exception = DummyError("error") + exception_type = "tests.trace.test_trace.DummyError" + span.record_exception(exception) + exception_event = span.events[0] + self.assertEqual("exception", exception_event.name) + self.assertEqual( + "error", exception_event.attributes["exception.message"] + ) + self.assertEqual( + exception_type, + exception_event.attributes["exception.type"], + ) + self.assertIn( + "DummyError: error", + exception_event.attributes["exception.stacktrace"], + ) + def test_record_exception(self): span = trace._Span("name", mock.Mock(spec=trace_api.SpanContext)) try: diff --git a/opentelemetry-semantic-conventions/LICENSE b/opentelemetry-semantic-conventions/LICENSE index 1ef7dad2c5c..261eeb9e9f8 100644 --- a/opentelemetry-semantic-conventions/LICENSE +++ b/opentelemetry-semantic-conventions/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright The OpenTelemetry Authors + Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/version.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/version.py index 2b23bc49941..ff4933b20b8 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.45b0.dev" +__version__ = "0.46b0.dev" diff --git a/opentelemetry-semantic-conventions/test-requirements.txt b/opentelemetry-semantic-conventions/test-requirements similarity index 100% rename from opentelemetry-semantic-conventions/test-requirements.txt rename to opentelemetry-semantic-conventions/test-requirements diff --git a/propagator/opentelemetry-propagator-b3/LICENSE b/propagator/opentelemetry-propagator-b3/LICENSE index 1ef7dad2c5c..261eeb9e9f8 100644 --- a/propagator/opentelemetry-propagator-b3/LICENSE +++ b/propagator/opentelemetry-propagator-b3/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright The OpenTelemetry Authors + Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. 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 8c35630f0e1..e8b404f0501 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.24.0.dev" +__version__ = "1.25.0.dev" diff --git a/propagator/opentelemetry-propagator-b3/test-requirements.txt b/propagator/opentelemetry-propagator-b3/test-requirements similarity index 100% rename from propagator/opentelemetry-propagator-b3/test-requirements.txt rename to propagator/opentelemetry-propagator-b3/test-requirements diff --git a/propagator/opentelemetry-propagator-jaeger/LICENSE b/propagator/opentelemetry-propagator-jaeger/LICENSE index 1ef7dad2c5c..261eeb9e9f8 100644 --- a/propagator/opentelemetry-propagator-jaeger/LICENSE +++ b/propagator/opentelemetry-propagator-jaeger/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright The OpenTelemetry Authors + Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. 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 8c35630f0e1..e8b404f0501 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.24.0.dev" +__version__ = "1.25.0.dev" diff --git a/propagator/opentelemetry-propagator-jaeger/test-requirements.txt b/propagator/opentelemetry-propagator-jaeger/test-requirements similarity index 100% rename from propagator/opentelemetry-propagator-jaeger/test-requirements.txt rename to propagator/opentelemetry-propagator-jaeger/test-requirements diff --git a/scripts/proto_codegen.sh b/scripts/proto_codegen.sh index 26fb8b1ee85..f445d3f42a0 100755 --- a/scripts/proto_codegen.sh +++ b/scripts/proto_codegen.sh @@ -12,7 +12,7 @@ # PROTO_REPO_DIR - the path to an existing checkout of the opentelemetry-proto repo # Pinned commit/branch/tag for the current version used in opentelemetry-proto python package. -PROTO_REPO_BRANCH_OR_COMMIT="v0.20.0" +PROTO_REPO_BRANCH_OR_COMMIT="v1.2.0" set -e diff --git a/scripts/public_symbols_checker.py b/scripts/public_symbols_checker.py index 05b7ad4abb4..c8bf7fd22e7 100644 --- a/scripts/public_symbols_checker.py +++ b/scripts/public_symbols_checker.py @@ -123,11 +123,11 @@ def remove_common_symbols(): 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 as not +# added or removed. +remove_common_symbols() - # If a symbol is added and removed in the same commit, we consider it - # as not added or removed. - remove_common_symbols() +if added_symbols or removed_symbols: print("The code in this branch adds the following public symbols:") print() for file_path_, symbols_ in added_symbols.items(): diff --git a/shim/opentelemetry-opencensus-shim/LICENSE b/shim/opentelemetry-opencensus-shim/LICENSE index 1ef7dad2c5c..261eeb9e9f8 100644 --- a/shim/opentelemetry-opencensus-shim/LICENSE +++ b/shim/opentelemetry-opencensus-shim/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright The OpenTelemetry Authors + Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/shim/opentelemetry-opencensus-shim/src/opentelemetry/shim/opencensus/_shim_span.py b/shim/opentelemetry-opencensus-shim/src/opentelemetry/shim/opencensus/_shim_span.py index f3ff804c6f2..2012035247a 100644 --- a/shim/opentelemetry-opencensus-shim/src/opentelemetry/shim/opencensus/_shim_span.py +++ b/shim/opentelemetry-opencensus-shim/src/opentelemetry/shim/opencensus/_shim_span.py @@ -97,13 +97,13 @@ def add_message_event(self, message_event: MessageEvent): ], } if message_event.uncompressed_size_bytes is not None: - attrs[ - _MESSAGE_EVENT_ATTRIBUTE_KEY_SIZE_UNCOMPRESSED - ] = message_event.uncompressed_size_bytes + attrs[_MESSAGE_EVENT_ATTRIBUTE_KEY_SIZE_UNCOMPRESSED] = ( + message_event.uncompressed_size_bytes + ) if message_event.compressed_size_bytes is not None: - attrs[ - _MESSAGE_EVENT_ATTRIBUTE_KEY_SIZE_COMPRESSED - ] = message_event.compressed_size_bytes + attrs[_MESSAGE_EVENT_ATTRIBUTE_KEY_SIZE_COMPRESSED] = ( + message_event.compressed_size_bytes + ) timestamp = _opencensus_time_to_nanos(message_event.timestamp) self._self_otel_span.add_event( diff --git a/shim/opentelemetry-opencensus-shim/src/opentelemetry/shim/opencensus/version.py b/shim/opentelemetry-opencensus-shim/src/opentelemetry/shim/opencensus/version.py index 2b23bc49941..ff4933b20b8 100644 --- a/shim/opentelemetry-opencensus-shim/src/opentelemetry/shim/opencensus/version.py +++ b/shim/opentelemetry-opencensus-shim/src/opentelemetry/shim/opencensus/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "0.45b0.dev" +__version__ = "0.46b0.dev" diff --git a/shim/opentelemetry-opencensus-shim/test-requirements.txt b/shim/opentelemetry-opencensus-shim/test-requirements similarity index 100% rename from shim/opentelemetry-opencensus-shim/test-requirements.txt rename to shim/opentelemetry-opencensus-shim/test-requirements diff --git a/shim/opentelemetry-opentracing-shim/LICENSE b/shim/opentelemetry-opentracing-shim/LICENSE index 1ef7dad2c5c..261eeb9e9f8 100644 --- a/shim/opentelemetry-opentracing-shim/LICENSE +++ b/shim/opentelemetry-opentracing-shim/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright The OpenTelemetry Authors + Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. 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 2b23bc49941..ff4933b20b8 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.45b0.dev" +__version__ = "0.46b0.dev" diff --git a/shim/opentelemetry-opentracing-shim/test-requirements.txt b/shim/opentelemetry-opentracing-shim/test-requirements similarity index 100% rename from shim/opentelemetry-opentracing-shim/test-requirements.txt rename to shim/opentelemetry-opentracing-shim/test-requirements diff --git a/shim/opentelemetry-opentracing-shim/tests/test_shim.py b/shim/opentelemetry-opentracing-shim/tests/test_shim.py index 99394ad2169..b75915d20fe 100644 --- a/shim/opentelemetry-opentracing-shim/tests/test_shim.py +++ b/shim/opentelemetry-opentracing-shim/tests/test_shim.py @@ -302,7 +302,7 @@ def test_parent_child_implicit(self): # Verify parent span becomes the active span again. self.assertEqual( self.shim.active_span.context.unwrap(), - parent.span.context.unwrap() + parent.span.context.unwrap(), # TODO: Check equality of the spans themselves rather than # their context once the SpanShim reconstruction problem has # been addressed (see previous TODO). diff --git a/tests/opentelemetry-test-utils/pyproject.toml b/tests/opentelemetry-test-utils/pyproject.toml index 9d68cb67088..e4547b6e340 100644 --- a/tests/opentelemetry-test-utils/pyproject.toml +++ b/tests/opentelemetry-test-utils/pyproject.toml @@ -24,8 +24,8 @@ classifiers = [ ] dependencies = [ "asgiref ~= 3.0", - "opentelemetry-api == 1.24.0.dev", - "opentelemetry-sdk == 1.24.0.dev", + "opentelemetry-api == 1.25.0.dev", + "opentelemetry-sdk == 1.25.0.dev", ] [project.urls] diff --git a/tests/opentelemetry-test-utils/src/opentelemetry/test/version.py b/tests/opentelemetry-test-utils/src/opentelemetry/test/version.py index ef9e7fdbaf9..e38c2cb2e40 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.45b0.dev" +__version__ = "0.46b0.dev" diff --git a/tests/opentelemetry-test-utils/test-requirements.txt b/tests/opentelemetry-test-utils/test-requirements similarity index 100% rename from tests/opentelemetry-test-utils/test-requirements.txt rename to tests/opentelemetry-test-utils/test-requirements diff --git a/tox.ini b/tox.ini index 2b82d804dc9..2e12556b4d1 100644 --- a/tox.ini +++ b/tox.ini @@ -8,9 +8,12 @@ envlist = py3{8,9,10,11}-opentelemetry-api pypy3-opentelemetry-api - ; Test against both protobuf 3.x and 4.x - py3{8,9,10,11}-proto{3,4}-opentelemetry-protobuf - pypy3-proto{3,4}-opentelemetry-protobuf + ; The numbers at the end of the environment names + ; below mean these dependencies are being used: + ; 0: protobuf==3.20.3 + ; 1: protobuf==4.25.3 + py3{8,9,10,11}-opentelemetry-protobuf-{0,1} + pypy3-opentelemetry-protobuf-{0,1} py3{8,9,10,11}-opentelemetry-sdk pypy3-opentelemetry-sdk @@ -31,18 +34,30 @@ envlist = py3{8,9,10,11}-opentelemetry-exporter-opencensus ; exporter-opencensus intentionally excluded from pypy3 - py3{8,9,10,11}-proto{3,4}-opentelemetry-exporter-otlp-proto-common - pypy3-proto{3,4}-opentelemetry-exporter-otlp-proto-common + ; The numbers at the end of the environment names + ; below mean these dependencies are being used: + ; 0: protobuf==3.20.3 + ; 1: protobuf==4.25.3 + py3{8,9,10,11}-opentelemetry-exporter-otlp-proto-common-{0,1} + pypy3-opentelemetry-exporter-otlp-proto-common-{0,1} ; opentelemetry-exporter-otlp py3{8,9,10,11}-opentelemetry-exporter-otlp-combined ; intentionally excluded from pypy3 - py3{8,9,10,11}-proto{3,4}-opentelemetry-exporter-otlp-proto-grpc + ; The numbers at the end of the environment names + ; below mean these dependencies are being used: + ; 0: protobuf==3.20.3 + ; 1: protobuf==4.25.3 + py3{8,9,10,11}-opentelemetry-exporter-otlp-proto-grpc-{0,1} ; intentionally excluded from pypy3 - py3{8,9,10,11}-proto{3,4}-opentelemetry-exporter-otlp-proto-http - pypy3-opentelemetry-proto{3,4}-exporter-otlp-proto-http + ; The numbers at the end of the environment names + ; below mean these dependencies are being used: + ; 0: protobuf==3.20.3 + ; 1: protobuf==4.25.3 + py3{8,9,10,11}-opentelemetry-exporter-otlp-proto-http-{0,1} + pypy3-opentelemetry-exporter-otlp-proto-http-{0,1} py3{8,9,10,11}-opentelemetry-exporter-prometheus pypy3-opentelemetry-exporter-prometheus @@ -109,7 +124,8 @@ commands_pre = ; cases but it saves a lot of boilerplate in this file. opentelemetry: pip install {toxinidir}/opentelemetry-api {toxinidir}/opentelemetry-semantic-conventions {toxinidir}/opentelemetry-sdk {toxinidir}/tests/opentelemetry-test-utils - protobuf: pip install -r {toxinidir}/opentelemetry-proto/test-requirements.txt + protobuf-0: pip install -r {toxinidir}/opentelemetry-proto/test-requirements-0.txt + protobuf-1: pip install -r {toxinidir}/opentelemetry-proto/test-requirements-1.txt getting-started: pip install -r {toxinidir}/docs/getting_started/tests/requirements.txt getting-started: pip install -e {env:CONTRIB_REPO}\#egg=opentelemetry-util-http&subdirectory=util/opentelemetry-util-http @@ -120,16 +136,16 @@ commands_pre = exporter-opencensus: pip install -r {toxinidir}/exporter/opentelemetry-exporter-opencensus/test-requirements.txt - exporter-otlp-proto-common: pip install -r {toxinidir}/exporter/opentelemetry-exporter-otlp-proto-common/test-requirements.txt + exporter-otlp-proto-common-0: pip install -r {toxinidir}/exporter/opentelemetry-exporter-otlp-proto-common/test-requirements-0.txt + exporter-otlp-proto-common-1: pip install -r {toxinidir}/exporter/opentelemetry-exporter-otlp-proto-common/test-requirements-1.txt exporter-otlp-combined: pip install -r {toxinidir}/exporter/opentelemetry-exporter-otlp/test-requirements.txt - exporter-otlp-proto-grpc: pip install {toxinidir}/opentelemetry-proto - exporter-otlp-proto-grpc: pip install {toxinidir}/exporter/opentelemetry-exporter-otlp-proto-common - exporter-otlp-proto-grpc: pip install {toxinidir}/exporter/opentelemetry-exporter-otlp-proto-grpc + opentelemetry-exporter-otlp-proto-grpc-0: pip install -r {toxinidir}/exporter/opentelemetry-exporter-otlp-proto-grpc/test-requirements-0.txt + opentelemetry-exporter-otlp-proto-grpc-1: pip install -r {toxinidir}/exporter/opentelemetry-exporter-otlp-proto-grpc/test-requirements-1.txt - proto3-opentelemetry-exporter-otlp-proto-http: pip install -r {toxinidir}/exporter/opentelemetry-exporter-otlp-proto-http/test-requirements-0.txt - proto4-opentelemetry-exporter-otlp-proto-http: pip install -r {toxinidir}/exporter/opentelemetry-exporter-otlp-proto-http/test-requirements-1.txt + opentelemetry-exporter-otlp-proto-http-0: pip install -r {toxinidir}/exporter/opentelemetry-exporter-otlp-proto-http/test-requirements-0.txt + opentelemetry-exporter-otlp-proto-http-1: pip install -r {toxinidir}/exporter/opentelemetry-exporter-otlp-proto-http/test-requirements-1.txt opentracing-shim: pip install -r {toxinidir}/shim/opentelemetry-opentracing-shim/test-requirements.txt @@ -205,27 +221,24 @@ deps = -r dev-requirements.txt commands_pre = - pip install -r {toxinidir}/opentelemetry-api/test-requirements.txt - pip install -r {toxinidir}/opentelemetry-sdk/test-requirements.txt - pip install -r {toxinidir}/opentelemetry-semantic-conventions/test-requirements.txt - pip install -r {toxinidir}/opentelemetry-proto/test-requirements.txt - pip install -r {toxinidir}/shim/opentelemetry-opentracing-shim/test-requirements.txt - pip install -r {toxinidir}/shim/opentelemetry-opencensus-shim/test-requirements.txt - pip install -r {toxinidir}/exporter/opentelemetry-exporter-opencensus/test-requirements.txt - pip install -r {toxinidir}/tests/opentelemetry-test-utils/test-requirements.txt - pip install -r {toxinidir}/exporter/opentelemetry-exporter-otlp-proto-common/test-requirements.txt - python -m pip install -e {toxinidir}/exporter/opentelemetry-exporter-otlp-proto-grpc[test] - pip install -r {toxinidir}/exporter/opentelemetry-exporter-otlp-proto-http/test-requirements-1.txt - pip install -r {toxinidir}/exporter/opentelemetry-exporter-prometheus/test-requirements.txt - pip install -r {toxinidir}/exporter/opentelemetry-exporter-zipkin-proto-http/test-requirements.txt - pip install -r {toxinidir}/exporter/opentelemetry-exporter-zipkin-json/test-requirements.txt - pip install -r {toxinidir}/exporter/opentelemetry-exporter-otlp/test-requirements.txt - pip install -r {toxinidir}/exporter/opentelemetry-exporter-zipkin/test-requirements.txt - pip install -r {toxinidir}/propagator/opentelemetry-propagator-b3/test-requirements.txt - pip install -r {toxinidir}/propagator/opentelemetry-propagator-jaeger/test-requirements.txt - # Pin protobuf version due to lint failing on v3.20.0 - # https://github.com/protocolbuffers/protobuf/issues/9730 - python -m pip install protobuf==3.19.4 + pip install -r {toxinidir}/opentelemetry-api/test-requirements.txt \ + -r {toxinidir}/opentelemetry-sdk/test-requirements.txt \ + -r {toxinidir}/opentelemetry-semantic-conventions/test-requirements.txt \ + -r {toxinidir}/opentelemetry-proto/test-requirements-0.txt \ + -r {toxinidir}/shim/opentelemetry-opentracing-shim/test-requirements.txt \ + -r {toxinidir}/shim/opentelemetry-opencensus-shim/test-requirements.txt \ + -r {toxinidir}/exporter/opentelemetry-exporter-opencensus/test-requirements.txt \ + -r {toxinidir}/tests/opentelemetry-test-utils/test-requirements.txt \ + -r {toxinidir}/exporter/opentelemetry-exporter-otlp-proto-common/test-requirements-0.txt \ + -r {toxinidir}/exporter/opentelemetry-exporter-otlp-proto-http/test-requirements-0.txt \ + -r {toxinidir}/exporter/opentelemetry-exporter-otlp-proto-grpc/test-requirements-0.txt \ + -r {toxinidir}/exporter/opentelemetry-exporter-prometheus/test-requirements.txt \ + -r {toxinidir}/exporter/opentelemetry-exporter-zipkin-proto-http/test-requirements.txt \ + -r {toxinidir}/exporter/opentelemetry-exporter-zipkin-json/test-requirements.txt \ + -r {toxinidir}/exporter/opentelemetry-exporter-otlp/test-requirements.txt \ + -r {toxinidir}/exporter/opentelemetry-exporter-zipkin/test-requirements.txt \ + -r {toxinidir}/propagator/opentelemetry-propagator-b3/test-requirements.txt \ + -r {toxinidir}/propagator/opentelemetry-propagator-jaeger/test-requirements.txt commands = python scripts/eachdist.py lint --check-only