Skip to content

Commit 0813592

Browse files
committed
resource-dector-container: package rename
Signed-off-by: emdneto <[email protected]>
1 parent 85ea8f3 commit 0813592

File tree

17 files changed

+83
-51
lines changed

17 files changed

+83
-51
lines changed

.github/workflows/core_contrib_test_0.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ jobs:
112112
- name: Run tests
113113
run: tox -e py39-test-instrumentation-vertexai-latest -- -ra
114114

115+
<<<<<<< HEAD
115116
py39-test-instrumentation-google-genai-oldest:
116117
name: instrumentation-google-genai-oldest
117118
runs-on: ubuntu-latest
@@ -160,6 +161,10 @@ jobs:
160161

161162
py39-test-resource-detector-container:
162163
name: resource-detector-container
164+
=======
165+
py38-test-resource-detector-containerid:
166+
name: resource-detector-containerid
167+
>>>>>>> dc37a537 (resource-dector-container: package rename)
163168
runs-on: ubuntu-latest
164169
timeout-minutes: 30
165170
steps:
@@ -179,7 +184,11 @@ jobs:
179184
run: pip install tox-uv
180185

181186
- name: Run tests
187+
<<<<<<< HEAD
182188
run: tox -e py39-test-resource-detector-container -- -ra
189+
=======
190+
run: tox -e py38-test-resource-detector-containerid -- -ra
191+
>>>>>>> dc37a537 (resource-dector-container: package rename)
183192

184193
py39-test-resource-detector-azure-0:
185194
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: 37 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -636,8 +636,27 @@ 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+
py38-test-resource-detector-containerid_ubuntu-latest:
640+
name: resource-detector-containerid 3.8 Ubuntu
641+
runs-on: ubuntu-latest
642+
timeout-minutes: 30
643+
steps:
644+
- name: Checkout repo @ SHA - ${{ github.sha }}
645+
uses: actions/checkout@v4
646+
647+
- name: Set up Python 3.8
648+
uses: actions/setup-python@v5
649+
with:
650+
python-version: "3.8"
651+
652+
- name: Install tox
653+
run: pip install tox-uv
654+
655+
- name: Run tests
656+
run: tox -e py38-test-resource-detector-containerid -- -ra
657+
658+
py39-test-resource-detector-containerid_ubuntu-latest:
659+
name: resource-detector-containerid 3.9 Ubuntu
641660
runs-on: ubuntu-latest
642661
timeout-minutes: 30
643662
steps:
@@ -653,10 +672,10 @@ jobs:
653672
run: pip install tox-uv
654673

655674
- name: Run tests
656-
run: tox -e py39-test-resource-detector-container -- -ra
675+
run: tox -e py39-test-resource-detector-containerid -- -ra
657676

658-
py310-test-resource-detector-container_ubuntu-latest:
659-
name: resource-detector-container 3.10 Ubuntu
677+
py310-test-resource-detector-containerid_ubuntu-latest:
678+
name: resource-detector-containerid 3.10 Ubuntu
660679
runs-on: ubuntu-latest
661680
timeout-minutes: 30
662681
steps:
@@ -672,10 +691,10 @@ jobs:
672691
run: pip install tox-uv
673692

674693
- name: Run tests
675-
run: tox -e py310-test-resource-detector-container -- -ra
694+
run: tox -e py310-test-resource-detector-containerid -- -ra
676695

677-
py311-test-resource-detector-container_ubuntu-latest:
678-
name: resource-detector-container 3.11 Ubuntu
696+
py311-test-resource-detector-containerid_ubuntu-latest:
697+
name: resource-detector-containerid 3.11 Ubuntu
679698
runs-on: ubuntu-latest
680699
timeout-minutes: 30
681700
steps:
@@ -691,10 +710,10 @@ jobs:
691710
run: pip install tox-uv
692711

693712
- name: Run tests
694-
run: tox -e py311-test-resource-detector-container -- -ra
713+
run: tox -e py311-test-resource-detector-containerid -- -ra
695714

696-
py312-test-resource-detector-container_ubuntu-latest:
697-
name: resource-detector-container 3.12 Ubuntu
715+
py312-test-resource-detector-containerid_ubuntu-latest:
716+
name: resource-detector-containerid 3.12 Ubuntu
698717
runs-on: ubuntu-latest
699718
timeout-minutes: 30
700719
steps:
@@ -710,10 +729,10 @@ jobs:
710729
run: pip install tox-uv
711730

712731
- name: Run tests
713-
run: tox -e py312-test-resource-detector-container -- -ra
732+
run: tox -e py312-test-resource-detector-containerid -- -ra
714733

715-
py313-test-resource-detector-container_ubuntu-latest:
716-
name: resource-detector-container 3.13 Ubuntu
734+
py313-test-resource-detector-containerid_ubuntu-latest:
735+
name: resource-detector-containerid 3.13 Ubuntu
717736
runs-on: ubuntu-latest
718737
timeout-minutes: 30
719738
steps:
@@ -729,10 +748,10 @@ jobs:
729748
run: pip install tox-uv
730749

731750
- name: Run tests
732-
run: tox -e py313-test-resource-detector-container -- -ra
751+
run: tox -e py313-test-resource-detector-containerid -- -ra
733752

734-
pypy3-test-resource-detector-container_ubuntu-latest:
735-
name: resource-detector-container pypy-3.9 Ubuntu
753+
pypy3-test-resource-detector-containerid_ubuntu-latest:
754+
name: resource-detector-containerid pypy-3.8 Ubuntu
736755
runs-on: ubuntu-latest
737756
timeout-minutes: 30
738757
steps:
@@ -748,7 +767,7 @@ jobs:
748767
run: pip install tox-uv
749768

750769
- name: Run tests
751-
run: tox -e pypy3-test-resource-detector-container -- -ra
770+
run: tox -e pypy3-test-resource-detector-containerid -- -ra
752771

753772
py39-test-resource-detector-azure-0_ubuntu-latest:
754773
name: resource-detector-azure-0 3.9 Ubuntu

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+
container = "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: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@
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 ContainerResourceDetector
1919
from opentelemetry.sdk.resources import get_aggregated_resources
2020
from opentelemetry.semconv.resource import ResourceAttributes
2121
from opentelemetry.test.test_base import TestBase
22+
from opentelemetry.util._importlib_metadata import entry_points
2223

2324
MockContainerResourceAttributes = {
2425
ResourceAttributes.CONTAINER_ID: "7be92808767a667f35c8505cbf40d14e931ef6db5b0210329cf193b15ba9d605",
@@ -107,7 +108,7 @@ def test_container_id_detect_from_mountinfo_file(
107108
)
108109

109110
@patch(
110-
"opentelemetry.resource.detector.container._get_container_id",
111+
"opentelemetry.resource.detector.containerid._get_container_id",
111112
return_value=MockContainerResourceAttributes[
112113
ResourceAttributes.CONTAINER_ID
113114
],
@@ -130,7 +131,7 @@ def test_container_id_as_span_attribute(self, mock_cgroup_file):
130131
)
131132

132133
@patch(
133-
"opentelemetry.resource.detector.container._get_container_id",
134+
"opentelemetry.resource.detector.containerid._get_container_id",
134135
return_value=MockContainerResourceAttributes[
135136
ResourceAttributes.CONTAINER_ID
136137
],
@@ -142,11 +143,11 @@ def test_container_id_detect_from_cgroup(self, mock_get_container_id):
142143
)
143144

144145
@patch(
145-
"opentelemetry.resource.detector.container._get_container_id_v1",
146+
"opentelemetry.resource.detector.containerid._get_container_id_v1",
146147
return_value=None,
147148
)
148149
@patch(
149-
"opentelemetry.resource.detector.container._get_container_id_v2",
150+
"opentelemetry.resource.detector.containerid._get_container_id_v2",
150151
return_value=MockContainerResourceAttributes[
151152
ResourceAttributes.CONTAINER_ID
152153
],
@@ -158,3 +159,10 @@ def test_container_id_detect_from_mount_info(
158159
self.assertDictEqual(
159160
actual.attributes.copy(), MockContainerResourceAttributes
160161
)
162+
163+
def test_container_id_entrypoint(self):
164+
(entrypoint,) = entry_points(
165+
group="opentelemetry_resource_detector", name="container"
166+
)
167+
detector = entrypoint.load()()
168+
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{8,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)