Skip to content

resource-dector-container: package rename to opentelemetry-resource-detector-containerid #3536

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/core_contrib_test_0.yml
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ jobs:
- name: Run tests
run: tox -e py39-test-instrumentation-google-genai-latest -- -ra

py39-test-resource-detector-container:
name: resource-detector-container
py39-test-resource-detector-containerid:
name: resource-detector-containerid
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
Expand All @@ -179,7 +179,7 @@ jobs:
run: pip install tox-uv

- name: Run tests
run: tox -e py39-test-resource-detector-container -- -ra
run: tox -e py39-test-resource-detector-containerid -- -ra

py39-test-resource-detector-azure-0:
name: resource-detector-azure-0
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/lint_0.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ jobs:
- name: Run tests
run: tox -e lint-instrumentation-google-genai

lint-resource-detector-container:
name: resource-detector-container
lint-resource-detector-containerid:
name: resource-detector-containerid
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
Expand All @@ -102,7 +102,7 @@ jobs:
run: pip install tox-uv

- name: Run tests
run: tox -e lint-resource-detector-container
run: tox -e lint-resource-detector-containerid

lint-resource-detector-azure:
name: resource-detector-azure
Expand Down
36 changes: 18 additions & 18 deletions .github/workflows/test_0.yml
Original file line number Diff line number Diff line change
Expand Up @@ -636,8 +636,8 @@ jobs:
- name: Run tests
run: tox -e py313-test-instrumentation-google-genai-latest -- -ra

py39-test-resource-detector-container_ubuntu-latest:
name: resource-detector-container 3.9 Ubuntu
py39-test-resource-detector-containerid_ubuntu-latest:
name: resource-detector-containerid 3.9 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
Expand All @@ -653,10 +653,10 @@ jobs:
run: pip install tox-uv

- name: Run tests
run: tox -e py39-test-resource-detector-container -- -ra
run: tox -e py39-test-resource-detector-containerid -- -ra

py310-test-resource-detector-container_ubuntu-latest:
name: resource-detector-container 3.10 Ubuntu
py310-test-resource-detector-containerid_ubuntu-latest:
name: resource-detector-containerid 3.10 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
Expand All @@ -672,10 +672,10 @@ jobs:
run: pip install tox-uv

- name: Run tests
run: tox -e py310-test-resource-detector-container -- -ra
run: tox -e py310-test-resource-detector-containerid -- -ra

py311-test-resource-detector-container_ubuntu-latest:
name: resource-detector-container 3.11 Ubuntu
py311-test-resource-detector-containerid_ubuntu-latest:
name: resource-detector-containerid 3.11 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
Expand All @@ -691,10 +691,10 @@ jobs:
run: pip install tox-uv

- name: Run tests
run: tox -e py311-test-resource-detector-container -- -ra
run: tox -e py311-test-resource-detector-containerid -- -ra

py312-test-resource-detector-container_ubuntu-latest:
name: resource-detector-container 3.12 Ubuntu
py312-test-resource-detector-containerid_ubuntu-latest:
name: resource-detector-containerid 3.12 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
Expand All @@ -710,10 +710,10 @@ jobs:
run: pip install tox-uv

- name: Run tests
run: tox -e py312-test-resource-detector-container -- -ra
run: tox -e py312-test-resource-detector-containerid -- -ra

py313-test-resource-detector-container_ubuntu-latest:
name: resource-detector-container 3.13 Ubuntu
py313-test-resource-detector-containerid_ubuntu-latest:
name: resource-detector-containerid 3.13 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
Expand All @@ -729,10 +729,10 @@ jobs:
run: pip install tox-uv

- name: Run tests
run: tox -e py313-test-resource-detector-container -- -ra
run: tox -e py313-test-resource-detector-containerid -- -ra

pypy3-test-resource-detector-container_ubuntu-latest:
name: resource-detector-container pypy-3.9 Ubuntu
pypy3-test-resource-detector-containerid_ubuntu-latest:
name: resource-detector-containerid pypy-3.9 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
Expand All @@ -748,7 +748,7 @@ jobs:
run: pip install tox-uv

- name: Run tests
run: tox -e pypy3-test-resource-detector-container -- -ra
run: tox -e pypy3-test-resource-detector-containerid -- -ra

py39-test-resource-detector-azure-0_ubuntu-latest:
name: resource-detector-azure-0 3.9 Ubuntu
Expand Down
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
([#3474](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3474))
- `opentelemetry-instrumentation-fastapi`: Drop support for FastAPI versions earlier than `0.92`
([#3012](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3012))
- `opentelemetry-resource-detector-container`: rename package name to `opentelemetry-resource-detector-containerid`
([#3536](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3536))

### Added

- `opentelemetry-instrumentation-aiohttp-client` Add support for HTTP metrics
([#3517](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3517))
([#3517](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3517))
- `opentelemetry-instrumentation-httpx` Add support for HTTP metrics
([#3513](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3513))

Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ install <https://pip.pypa.io/en/stable/reference/pip_install/#editable-installs>
pip install -e ./instrumentation/opentelemetry-instrumentation-botocore
pip install -e ./instrumentation-genai/opentelemetry-instrumentation-openai-v2
pip install -e ./sdk-extension/opentelemetry-sdk-extension-aws
pip install -e ./resource/opentelemetry-resource-detector-container
pip install -e ./resource/opentelemetry-resource-detector-containerid


.. toctree::
Expand Down
2 changes: 1 addition & 1 deletion docs/resource/container/container.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
OpenTelemetry Python - Resource Detector for Containers
=======================================================

.. automodule:: opentelemetry.resource.detector.container
.. automodule:: opentelemetry.resource.detector.containerid
:members:
:undoc-members:
:show-inheritance:
2 changes: 1 addition & 1 deletion eachdist.ini
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ packages=
opentelemetry-instrumentation
opentelemetry-contrib-instrumentations
opentelemetry-distro
opentelemetry-resource-detector-container
opentelemetry-resource-detector-containerid

[exclude_release]
packages=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ Installation

::

pip install opentelemetry-resource-detector-container
pip install opentelemetry-resource-detector-containerid

---------------------------

Usage example for `opentelemetry-resource-detector-container`
Usage example for `opentelemetry-resource-detector-containerid`

.. code-block:: python

from opentelemetry import trace
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.resource.detector.container import (
from opentelemetry.resource.detector.containerid import (
ContainerResourceDetector,
)
from opentelemetry.sdk.resources import get_aggregated_resources
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "opentelemetry-resource-detector-container"
name = "opentelemetry-resource-detector-containerid"
dynamic = ["version"]
description = "Container Resource Detector for OpenTelemetry"
readme = "README.rst"
Expand All @@ -29,14 +29,14 @@ dependencies = [
]

[project.entry-points.opentelemetry_resource_detector]
container = "opentelemetry.resource.detector.container:ContainerResourceDetector"
containerid = "opentelemetry.resource.detector.containerid:ContainerResourceDetector"

[project.urls]
Homepage = "https://github.com/open-telemetry/opentelemetry-python-contrib/tree/main/resource/opentelemetry-resource-detector-container"
Homepage = "https://github.com/open-telemetry/opentelemetry-python-contrib/tree/main/resource/opentelemetry-resource-detector-containerid"
Repository = "https://github.com/open-telemetry/opentelemetry-python-contrib"

[tool.hatch.version]
path = "src/opentelemetry/resource/detector/container/version.py"
path = "src/opentelemetry/resource/detector/containerid/version.py"

[tool.hatch.build.targets.sdist]
include = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ tomli==2.0.1
typing_extensions==4.12.2
wrapt==1.16.0
zipp==3.19.2
-e resource/opentelemetry-resource-detector-container
-e resource/opentelemetry-resource-detector-containerid
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@
from unittest.mock import mock_open, patch

from opentelemetry import trace as trace_api
from opentelemetry.resource.detector.container import ContainerResourceDetector
from opentelemetry.resource.detector.containerid import (
ContainerResourceDetector,
)
from opentelemetry.sdk.resources import get_aggregated_resources
from opentelemetry.semconv.resource import ResourceAttributes
from opentelemetry.test.test_base import TestBase
from opentelemetry.util._importlib_metadata import entry_points

MockContainerResourceAttributes = {
ResourceAttributes.CONTAINER_ID: "7be92808767a667f35c8505cbf40d14e931ef6db5b0210329cf193b15ba9d605",
Expand Down Expand Up @@ -66,7 +69,7 @@ def test_container_id_detect_from_cgroup_file_with_suffix(
)

@patch(
"opentelemetry.resource.detector.container._get_container_id_v1",
"opentelemetry.resource.detector.containerid._get_container_id_v1",
return_value=None,
)
@patch(
Expand Down Expand Up @@ -107,7 +110,7 @@ def test_container_id_detect_from_mountinfo_file(
)

@patch(
"opentelemetry.resource.detector.container._get_container_id",
"opentelemetry.resource.detector.containerid._get_container_id",
return_value=MockContainerResourceAttributes[
ResourceAttributes.CONTAINER_ID
],
Expand All @@ -130,7 +133,7 @@ def test_container_id_as_span_attribute(self, mock_cgroup_file):
)

@patch(
"opentelemetry.resource.detector.container._get_container_id",
"opentelemetry.resource.detector.containerid._get_container_id",
return_value=MockContainerResourceAttributes[
ResourceAttributes.CONTAINER_ID
],
Expand All @@ -142,11 +145,11 @@ def test_container_id_detect_from_cgroup(self, mock_get_container_id):
)

@patch(
"opentelemetry.resource.detector.container._get_container_id_v1",
"opentelemetry.resource.detector.containerid._get_container_id_v1",
return_value=None,
)
@patch(
"opentelemetry.resource.detector.container._get_container_id_v2",
"opentelemetry.resource.detector.containerid._get_container_id_v2",
return_value=MockContainerResourceAttributes[
ResourceAttributes.CONTAINER_ID
],
Expand All @@ -158,3 +161,10 @@ def test_container_id_detect_from_mount_info(
self.assertDictEqual(
actual.attributes.copy(), MockContainerResourceAttributes
)

def test_container_id_entrypoint(self):
(entrypoint,) = entry_points(
group="opentelemetry_resource_detector", name="containerid"
)
detector = entrypoint.load()()
self.assertIsInstance(detector, ContainerResourceDetector)
6 changes: 1 addition & 5 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,8 @@ DISTDIR=dist
(
cd $DISTDIR
for x in * ; do
# FIXME: Remove this logic once these packages are available in Pypi
if echo "$x" | grep -Eq "^opentelemetry_resource_detector_container.*(\.tar\.gz|\.whl)$"; then
echo "Skipping $x because of erroneous uploads. See: https://github.com/open-telemetry/opentelemetry-python-contrib/issues/2053"
rm $x
# FIXME: Remove this once opentelemetry-resource-detector-azure package goes 1.X
elif echo "$x" | grep -Eq "^opentelemetry_resource_detector_azure.*(\.tar\.gz|\.whl)$"; then
if echo "$x" | grep -Eq "^opentelemetry_resource_detector_azure.*(\.tar\.gz|\.whl)$"; then
echo "Skipping $x because of manual upload by Azure maintainers."
rm $x
# NOTE: We filter beta vs 1.0 package at this point because we can read the
Expand Down
18 changes: 9 additions & 9 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ envlist =
# pypy3-test-instrumentation-google-genai-{0,1}
lint-instrumentation-google-genai

; opentelemetry-resource-detector-container
py3{9,10,11,12,13}-test-resource-detector-container
pypy3-test-resource-detector-container
lint-resource-detector-container
; opentelemetry-resource-detector-containerid
py3{9,10,11,12,13}-test-resource-detector-containerid
pypy3-test-resource-detector-containerid
lint-resource-detector-containerid

; opentelemetry-resource-detector-azure
py3{9,10,11,12,13}-test-resource-detector-azure-{0,1}
Expand Down Expand Up @@ -686,8 +686,8 @@ deps =
lint-sdk-extension-aws: -r {toxinidir}/sdk-extension/opentelemetry-sdk-extension-aws/test-requirements-0.txt
benchmark-sdk-extension-aws: -r {toxinidir}/sdk-extension/opentelemetry-sdk-extension-aws/benchmark-requirements.txt

resource-detector-container: {[testenv]test_deps}
resource-detector-container: -r {toxinidir}/resource/opentelemetry-resource-detector-container/test-requirements.txt
resource-detector-containerid: {[testenv]test_deps}
resource-detector-containerid: -r {toxinidir}/resource/opentelemetry-resource-detector-containerid/test-requirements.txt

# packages that are released individually should provide a test-requirements.txt with the lowest version of OTel API
# and SDK supported to test we are honoring it
Expand Down Expand Up @@ -913,8 +913,8 @@ commands =
lint-sdk-extension-aws: sh -c "cd sdk-extension && pylint --rcfile ../.pylintrc opentelemetry-sdk-extension-aws"
benchmark-sdk-extension-aws: pytest {toxinidir}/sdk-extension/opentelemetry-sdk-extension-aws/benchmarks {posargs} --benchmark-json=sdk-extension-aws-benchmark.json

test-resource-detector-container: pytest {toxinidir}/resource/opentelemetry-resource-detector-container/tests {posargs}
lint-resource-detector-container: sh -c "cd resource && pylint --rcfile ../.pylintrc opentelemetry-resource-detector-container"
test-resource-detector-containerid: pytest {toxinidir}/resource/opentelemetry-resource-detector-containerid/tests {posargs}
lint-resource-detector-containerid: sh -c "cd resource && pylint --rcfile ../.pylintrc opentelemetry-resource-detector-containerid"

test-resource-detector-azure: pytest {toxinidir}/resource/opentelemetry-resource-detector-azure/tests {posargs}
lint-resource-detector-azure: sh -c "cd resource && pylint --rcfile ../.pylintrc opentelemetry-resource-detector-azure"
Expand Down Expand Up @@ -1050,6 +1050,6 @@ deps =
{toxinidir}/instrumentation-genai/opentelemetry-instrumentation-google-genai[instruments]
{toxinidir}/instrumentation/opentelemetry-instrumentation-aiokafka[instruments]
{toxinidir}/instrumentation/opentelemetry-instrumentation-asyncclick[instruments]

commands =
pyright