Skip to content

Commit 4a21b39

Browse files
authored
resource-dector-container: package rename to opentelemetry-resource-detector-containerid (#3536)
* resource-dector-container: package rename Signed-off-by: emdneto <[email protected]> * fix ruff Signed-off-by: emdneto <[email protected]> * change entrypoint Signed-off-by: emdneto <[email protected]> * fix Signed-off-by: emdneto <[email protected]> * fix test Signed-off-by: emdneto <[email protected]> * fix for entrypoint name Signed-off-by: emdneto <[email protected]> * add changelog Signed-off-by: emdneto <[email protected]> --------- Signed-off-by: emdneto <[email protected]>
1 parent 85ea8f3 commit 4a21b39

File tree

18 files changed

+64
-56
lines changed

18 files changed

+64
-56
lines changed

.github/workflows/core_contrib_test_0.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,8 @@ jobs:
158158
- name: Run tests
159159
run: tox -e py39-test-instrumentation-google-genai-latest -- -ra
160160

161-
py39-test-resource-detector-container:
162-
name: resource-detector-container
161+
py39-test-resource-detector-containerid:
162+
name: resource-detector-containerid
163163
runs-on: ubuntu-latest
164164
timeout-minutes: 30
165165
steps:
@@ -179,7 +179,7 @@ jobs:
179179
run: pip install tox-uv
180180

181181
- name: Run tests
182-
run: tox -e py39-test-resource-detector-container -- -ra
182+
run: tox -e py39-test-resource-detector-containerid -- -ra
183183

184184
py39-test-resource-detector-azure-0:
185185
name: resource-detector-azure-0

.github/workflows/lint_0.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ jobs:
8585
- name: Run tests
8686
run: tox -e lint-instrumentation-google-genai
8787

88-
lint-resource-detector-container:
89-
name: resource-detector-container
88+
lint-resource-detector-containerid:
89+
name: resource-detector-containerid
9090
runs-on: ubuntu-latest
9191
timeout-minutes: 30
9292
steps:
@@ -102,7 +102,7 @@ jobs:
102102
run: pip install tox-uv
103103

104104
- name: Run tests
105-
run: tox -e lint-resource-detector-container
105+
run: tox -e lint-resource-detector-containerid
106106

107107
lint-resource-detector-azure:
108108
name: resource-detector-azure

.github/workflows/test_0.yml

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -636,8 +636,8 @@ jobs:
636636
- name: Run tests
637637
run: tox -e py313-test-instrumentation-google-genai-latest -- -ra
638638

639-
py39-test-resource-detector-container_ubuntu-latest:
640-
name: resource-detector-container 3.9 Ubuntu
639+
py39-test-resource-detector-containerid_ubuntu-latest:
640+
name: resource-detector-containerid 3.9 Ubuntu
641641
runs-on: ubuntu-latest
642642
timeout-minutes: 30
643643
steps:
@@ -653,10 +653,10 @@ jobs:
653653
run: pip install tox-uv
654654

655655
- name: Run tests
656-
run: tox -e py39-test-resource-detector-container -- -ra
656+
run: tox -e py39-test-resource-detector-containerid -- -ra
657657

658-
py310-test-resource-detector-container_ubuntu-latest:
659-
name: resource-detector-container 3.10 Ubuntu
658+
py310-test-resource-detector-containerid_ubuntu-latest:
659+
name: resource-detector-containerid 3.10 Ubuntu
660660
runs-on: ubuntu-latest
661661
timeout-minutes: 30
662662
steps:
@@ -672,10 +672,10 @@ jobs:
672672
run: pip install tox-uv
673673

674674
- name: Run tests
675-
run: tox -e py310-test-resource-detector-container -- -ra
675+
run: tox -e py310-test-resource-detector-containerid -- -ra
676676

677-
py311-test-resource-detector-container_ubuntu-latest:
678-
name: resource-detector-container 3.11 Ubuntu
677+
py311-test-resource-detector-containerid_ubuntu-latest:
678+
name: resource-detector-containerid 3.11 Ubuntu
679679
runs-on: ubuntu-latest
680680
timeout-minutes: 30
681681
steps:
@@ -691,10 +691,10 @@ jobs:
691691
run: pip install tox-uv
692692

693693
- name: Run tests
694-
run: tox -e py311-test-resource-detector-container -- -ra
694+
run: tox -e py311-test-resource-detector-containerid -- -ra
695695

696-
py312-test-resource-detector-container_ubuntu-latest:
697-
name: resource-detector-container 3.12 Ubuntu
696+
py312-test-resource-detector-containerid_ubuntu-latest:
697+
name: resource-detector-containerid 3.12 Ubuntu
698698
runs-on: ubuntu-latest
699699
timeout-minutes: 30
700700
steps:
@@ -710,10 +710,10 @@ jobs:
710710
run: pip install tox-uv
711711

712712
- name: Run tests
713-
run: tox -e py312-test-resource-detector-container -- -ra
713+
run: tox -e py312-test-resource-detector-containerid -- -ra
714714

715-
py313-test-resource-detector-container_ubuntu-latest:
716-
name: resource-detector-container 3.13 Ubuntu
715+
py313-test-resource-detector-containerid_ubuntu-latest:
716+
name: resource-detector-containerid 3.13 Ubuntu
717717
runs-on: ubuntu-latest
718718
timeout-minutes: 30
719719
steps:
@@ -729,10 +729,10 @@ jobs:
729729
run: pip install tox-uv
730730

731731
- name: Run tests
732-
run: tox -e py313-test-resource-detector-container -- -ra
732+
run: tox -e py313-test-resource-detector-containerid -- -ra
733733

734-
pypy3-test-resource-detector-container_ubuntu-latest:
735-
name: resource-detector-container pypy-3.9 Ubuntu
734+
pypy3-test-resource-detector-containerid_ubuntu-latest:
735+
name: resource-detector-containerid pypy-3.9 Ubuntu
736736
runs-on: ubuntu-latest
737737
timeout-minutes: 30
738738
steps:
@@ -748,7 +748,7 @@ jobs:
748748
run: pip install tox-uv
749749

750750
- name: Run tests
751-
run: tox -e pypy3-test-resource-detector-container -- -ra
751+
run: tox -e pypy3-test-resource-detector-containerid -- -ra
752752

753753
py39-test-resource-detector-azure-0_ubuntu-latest:
754754
name: resource-detector-azure-0 3.9 Ubuntu

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6060
([#3474](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3474))
6161
- `opentelemetry-instrumentation-fastapi`: Drop support for FastAPI versions earlier than `0.92`
6262
([#3012](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3012))
63+
- `opentelemetry-resource-detector-container`: rename package name to `opentelemetry-resource-detector-containerid`
64+
([#3536](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3536))
6365

6466
### Added
6567

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

docs/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ install <https://pip.pypa.io/en/stable/reference/pip_install/#editable-installs>
5252
pip install -e ./instrumentation/opentelemetry-instrumentation-botocore
5353
pip install -e ./instrumentation-genai/opentelemetry-instrumentation-openai-v2
5454
pip install -e ./sdk-extension/opentelemetry-sdk-extension-aws
55-
pip install -e ./resource/opentelemetry-resource-detector-container
55+
pip install -e ./resource/opentelemetry-resource-detector-containerid
5656
5757
5858
.. toctree::

docs/resource/container/container.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
OpenTelemetry Python - Resource Detector for Containers
22
=======================================================
33

4-
.. automodule:: opentelemetry.resource.detector.container
4+
.. automodule:: opentelemetry.resource.detector.containerid
55
:members:
66
:undoc-members:
77
:show-inheritance:

eachdist.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ packages=
4343
opentelemetry-instrumentation
4444
opentelemetry-contrib-instrumentations
4545
opentelemetry-distro
46-
opentelemetry-resource-detector-container
46+
opentelemetry-resource-detector-containerid
4747

4848
[exclude_release]
4949
packages=

resource/opentelemetry-resource-detector-container/README.rst renamed to resource/opentelemetry-resource-detector-containerid/README.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@ Installation
1414

1515
::
1616

17-
pip install opentelemetry-resource-detector-container
17+
pip install opentelemetry-resource-detector-containerid
1818

1919
---------------------------
2020

21-
Usage example for `opentelemetry-resource-detector-container`
21+
Usage example for `opentelemetry-resource-detector-containerid`
2222

2323
.. code-block:: python
2424
2525
from opentelemetry import trace
2626
from opentelemetry.sdk.trace import TracerProvider
27-
from opentelemetry.resource.detector.container import (
27+
from opentelemetry.resource.detector.containerid import (
2828
ContainerResourceDetector,
2929
)
3030
from opentelemetry.sdk.resources import get_aggregated_resources

resource/opentelemetry-resource-detector-container/pyproject.toml renamed to resource/opentelemetry-resource-detector-containerid/pyproject.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ requires = ["hatchling"]
33
build-backend = "hatchling.build"
44

55
[project]
6-
name = "opentelemetry-resource-detector-container"
6+
name = "opentelemetry-resource-detector-containerid"
77
dynamic = ["version"]
88
description = "Container Resource Detector for OpenTelemetry"
99
readme = "README.rst"
@@ -29,14 +29,14 @@ dependencies = [
2929
]
3030

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

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

3838
[tool.hatch.version]
39-
path = "src/opentelemetry/resource/detector/container/version.py"
39+
path = "src/opentelemetry/resource/detector/containerid/version.py"
4040

4141
[tool.hatch.build.targets.sdist]
4242
include = [

resource/opentelemetry-resource-detector-container/test-requirements.txt renamed to resource/opentelemetry-resource-detector-containerid/test-requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ tomli==2.0.1
99
typing_extensions==4.12.2
1010
wrapt==1.16.0
1111
zipp==3.19.2
12-
-e resource/opentelemetry-resource-detector-container
12+
-e resource/opentelemetry-resource-detector-containerid

resource/opentelemetry-resource-detector-container/tests/test_container.py renamed to resource/opentelemetry-resource-detector-containerid/tests/test_container.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,13 @@
1515
from unittest.mock import mock_open, patch
1616

1717
from opentelemetry import trace as trace_api
18-
from opentelemetry.resource.detector.container import ContainerResourceDetector
18+
from opentelemetry.resource.detector.containerid import (
19+
ContainerResourceDetector,
20+
)
1921
from opentelemetry.sdk.resources import get_aggregated_resources
2022
from opentelemetry.semconv.resource import ResourceAttributes
2123
from opentelemetry.test.test_base import TestBase
24+
from opentelemetry.util._importlib_metadata import entry_points
2225

2326
MockContainerResourceAttributes = {
2427
ResourceAttributes.CONTAINER_ID: "7be92808767a667f35c8505cbf40d14e931ef6db5b0210329cf193b15ba9d605",
@@ -66,7 +69,7 @@ def test_container_id_detect_from_cgroup_file_with_suffix(
6669
)
6770

6871
@patch(
69-
"opentelemetry.resource.detector.container._get_container_id_v1",
72+
"opentelemetry.resource.detector.containerid._get_container_id_v1",
7073
return_value=None,
7174
)
7275
@patch(
@@ -107,7 +110,7 @@ def test_container_id_detect_from_mountinfo_file(
107110
)
108111

109112
@patch(
110-
"opentelemetry.resource.detector.container._get_container_id",
113+
"opentelemetry.resource.detector.containerid._get_container_id",
111114
return_value=MockContainerResourceAttributes[
112115
ResourceAttributes.CONTAINER_ID
113116
],
@@ -130,7 +133,7 @@ def test_container_id_as_span_attribute(self, mock_cgroup_file):
130133
)
131134

132135
@patch(
133-
"opentelemetry.resource.detector.container._get_container_id",
136+
"opentelemetry.resource.detector.containerid._get_container_id",
134137
return_value=MockContainerResourceAttributes[
135138
ResourceAttributes.CONTAINER_ID
136139
],
@@ -142,11 +145,11 @@ def test_container_id_detect_from_cgroup(self, mock_get_container_id):
142145
)
143146

144147
@patch(
145-
"opentelemetry.resource.detector.container._get_container_id_v1",
148+
"opentelemetry.resource.detector.containerid._get_container_id_v1",
146149
return_value=None,
147150
)
148151
@patch(
149-
"opentelemetry.resource.detector.container._get_container_id_v2",
152+
"opentelemetry.resource.detector.containerid._get_container_id_v2",
150153
return_value=MockContainerResourceAttributes[
151154
ResourceAttributes.CONTAINER_ID
152155
],
@@ -158,3 +161,10 @@ def test_container_id_detect_from_mount_info(
158161
self.assertDictEqual(
159162
actual.attributes.copy(), MockContainerResourceAttributes
160163
)
164+
165+
def test_container_id_entrypoint(self):
166+
(entrypoint,) = entry_points(
167+
group="opentelemetry_resource_detector", name="containerid"
168+
)
169+
detector = entrypoint.load()()
170+
self.assertIsInstance(detector, ContainerResourceDetector)

scripts/build.sh

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,8 @@ DISTDIR=dist
3131
(
3232
cd $DISTDIR
3333
for x in * ; do
34-
# FIXME: Remove this logic once these packages are available in Pypi
35-
if echo "$x" | grep -Eq "^opentelemetry_resource_detector_container.*(\.tar\.gz|\.whl)$"; then
36-
echo "Skipping $x because of erroneous uploads. See: https://github.com/open-telemetry/opentelemetry-python-contrib/issues/2053"
37-
rm $x
3834
# FIXME: Remove this once opentelemetry-resource-detector-azure package goes 1.X
39-
elif echo "$x" | grep -Eq "^opentelemetry_resource_detector_azure.*(\.tar\.gz|\.whl)$"; then
35+
if echo "$x" | grep -Eq "^opentelemetry_resource_detector_azure.*(\.tar\.gz|\.whl)$"; then
4036
echo "Skipping $x because of manual upload by Azure maintainers."
4137
rm $x
4238
# NOTE: We filter beta vs 1.0 package at this point because we can read the

tox.ini

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ envlist =
2525
# pypy3-test-instrumentation-google-genai-{0,1}
2626
lint-instrumentation-google-genai
2727

28-
; opentelemetry-resource-detector-container
29-
py3{9,10,11,12,13}-test-resource-detector-container
30-
pypy3-test-resource-detector-container
31-
lint-resource-detector-container
28+
; opentelemetry-resource-detector-containerid
29+
py3{9,10,11,12,13}-test-resource-detector-containerid
30+
pypy3-test-resource-detector-containerid
31+
lint-resource-detector-containerid
3232

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

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

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

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

919919
test-resource-detector-azure: pytest {toxinidir}/resource/opentelemetry-resource-detector-azure/tests {posargs}
920920
lint-resource-detector-azure: sh -c "cd resource && pylint --rcfile ../.pylintrc opentelemetry-resource-detector-azure"
@@ -1050,6 +1050,6 @@ deps =
10501050
{toxinidir}/instrumentation-genai/opentelemetry-instrumentation-google-genai[instruments]
10511051
{toxinidir}/instrumentation/opentelemetry-instrumentation-aiokafka[instruments]
10521052
{toxinidir}/instrumentation/opentelemetry-instrumentation-asyncclick[instruments]
1053-
1053+
10541054
commands =
10551055
pyright

0 commit comments

Comments
 (0)