Skip to content

Commit dc37a53

Browse files
committed
resource-dector-container: package rename
Signed-off-by: emdneto <[email protected]>
1 parent 0db4d0b commit dc37a53

File tree

17 files changed

+62
-58
lines changed

17 files changed

+62
-58
lines changed

.github/workflows/core_contrib_test_0.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ jobs:
112112
- name: Run tests
113113
run: tox -e py38-test-instrumentation-vertexai-latest -- -ra
114114

115-
py38-test-resource-detector-container:
116-
name: resource-detector-container
115+
py38-test-resource-detector-containerid:
116+
name: resource-detector-containerid
117117
runs-on: ubuntu-latest
118118
timeout-minutes: 30
119119
steps:
@@ -133,7 +133,7 @@ jobs:
133133
run: pip install tox-uv
134134

135135
- name: Run tests
136-
run: tox -e py38-test-resource-detector-container -- -ra
136+
run: tox -e py38-test-resource-detector-containerid -- -ra
137137

138138
py38-test-resource-detector-azure-0:
139139
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: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -712,8 +712,8 @@ jobs:
712712
- name: Run tests
713713
run: tox -e py313-test-instrumentation-google-genai-latest -- -ra
714714

715-
py38-test-resource-detector-container_ubuntu-latest:
716-
name: resource-detector-container 3.8 Ubuntu
715+
py38-test-resource-detector-containerid_ubuntu-latest:
716+
name: resource-detector-containerid 3.8 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 py38-test-resource-detector-container -- -ra
732+
run: tox -e py38-test-resource-detector-containerid -- -ra
733733

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

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

753-
py310-test-resource-detector-container_ubuntu-latest:
754-
name: resource-detector-container 3.10 Ubuntu
753+
py310-test-resource-detector-containerid_ubuntu-latest:
754+
name: resource-detector-containerid 3.10 Ubuntu
755755
runs-on: ubuntu-latest
756756
timeout-minutes: 30
757757
steps:
@@ -767,10 +767,10 @@ jobs:
767767
run: pip install tox-uv
768768

769769
- name: Run tests
770-
run: tox -e py310-test-resource-detector-container -- -ra
770+
run: tox -e py310-test-resource-detector-containerid -- -ra
771771

772-
py311-test-resource-detector-container_ubuntu-latest:
773-
name: resource-detector-container 3.11 Ubuntu
772+
py311-test-resource-detector-containerid_ubuntu-latest:
773+
name: resource-detector-containerid 3.11 Ubuntu
774774
runs-on: ubuntu-latest
775775
timeout-minutes: 30
776776
steps:
@@ -786,10 +786,10 @@ jobs:
786786
run: pip install tox-uv
787787

788788
- name: Run tests
789-
run: tox -e py311-test-resource-detector-container -- -ra
789+
run: tox -e py311-test-resource-detector-containerid -- -ra
790790

791-
py312-test-resource-detector-container_ubuntu-latest:
792-
name: resource-detector-container 3.12 Ubuntu
791+
py312-test-resource-detector-containerid_ubuntu-latest:
792+
name: resource-detector-containerid 3.12 Ubuntu
793793
runs-on: ubuntu-latest
794794
timeout-minutes: 30
795795
steps:
@@ -805,10 +805,10 @@ jobs:
805805
run: pip install tox-uv
806806

807807
- name: Run tests
808-
run: tox -e py312-test-resource-detector-container -- -ra
808+
run: tox -e py312-test-resource-detector-containerid -- -ra
809809

810-
py313-test-resource-detector-container_ubuntu-latest:
811-
name: resource-detector-container 3.13 Ubuntu
810+
py313-test-resource-detector-containerid_ubuntu-latest:
811+
name: resource-detector-containerid 3.13 Ubuntu
812812
runs-on: ubuntu-latest
813813
timeout-minutes: 30
814814
steps:
@@ -824,10 +824,10 @@ jobs:
824824
run: pip install tox-uv
825825

826826
- name: Run tests
827-
run: tox -e py313-test-resource-detector-container -- -ra
827+
run: tox -e py313-test-resource-detector-containerid -- -ra
828828

829-
pypy3-test-resource-detector-container_ubuntu-latest:
830-
name: resource-detector-container pypy-3.8 Ubuntu
829+
pypy3-test-resource-detector-containerid_ubuntu-latest:
830+
name: resource-detector-containerid pypy-3.8 Ubuntu
831831
runs-on: ubuntu-latest
832832
timeout-minutes: 30
833833
steps:
@@ -843,7 +843,7 @@ jobs:
843843
run: pip install tox-uv
844844

845845
- name: Run tests
846-
run: tox -e pypy3-test-resource-detector-container -- -ra
846+
run: tox -e pypy3-test-resource-detector-containerid -- -ra
847847

848848
py38-test-resource-detector-azure-0_ubuntu-latest:
849849
name: resource-detector-azure-0 3.8 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"
@@ -30,14 +30,14 @@ dependencies = [
3030
]
3131

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

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

3939
[tool.hatch.version]
40-
path = "src/opentelemetry/resource/detector/container/version.py"
40+
path = "src/opentelemetry/resource/detector/containerid/version.py"
4141

4242
[tool.hatch.build.targets.sdist]
4343
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: 14 additions & 6 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",
@@ -52,7 +53,7 @@ def test_container_id_detect_from_cgroup_file(self, mock_cgroup_file):
5253
)
5354

5455
@patch(
55-
"opentelemetry.resource.detector.container._get_container_id_v1",
56+
"opentelemetry.resource.detector.containerid._get_container_id_v1",
5657
return_value=None,
5758
)
5859
@patch(
@@ -93,7 +94,7 @@ def test_container_id_detect_from_mountinfo_file(
9394
)
9495

9596
@patch(
96-
"opentelemetry.resource.detector.container._get_container_id",
97+
"opentelemetry.resource.detector.containerid._get_container_id",
9798
return_value=MockContainerResourceAttributes[
9899
ResourceAttributes.CONTAINER_ID
99100
],
@@ -116,7 +117,7 @@ def test_container_id_as_span_attribute(self, mock_cgroup_file):
116117
)
117118

118119
@patch(
119-
"opentelemetry.resource.detector.container._get_container_id",
120+
"opentelemetry.resource.detector.containerid._get_container_id",
120121
return_value=MockContainerResourceAttributes[
121122
ResourceAttributes.CONTAINER_ID
122123
],
@@ -128,11 +129,11 @@ def test_container_id_detect_from_cgroup(self, mock_get_container_id):
128129
)
129130

130131
@patch(
131-
"opentelemetry.resource.detector.container._get_container_id_v1",
132+
"opentelemetry.resource.detector.containerid._get_container_id_v1",
132133
return_value=None,
133134
)
134135
@patch(
135-
"opentelemetry.resource.detector.container._get_container_id_v2",
136+
"opentelemetry.resource.detector.containerid._get_container_id_v2",
136137
return_value=MockContainerResourceAttributes[
137138
ResourceAttributes.CONTAINER_ID
138139
],
@@ -144,3 +145,10 @@ def test_container_id_detect_from_mount_info(
144145
self.assertDictEqual(
145146
actual.attributes.copy(), MockContainerResourceAttributes
146147
)
148+
149+
def test_container_id_entrypoint(self):
150+
(entrypoint,) = entry_points(
151+
group="opentelemetry_resource_detector", name="container"
152+
)
153+
detector = entrypoint.load()()
154+
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{8,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{8,9,10,11,12,13}-test-resource-detector-azure-{0,1}
@@ -685,8 +685,8 @@ deps =
685685
lint-sdk-extension-aws: -r {toxinidir}/sdk-extension/opentelemetry-sdk-extension-aws/test-requirements-0.txt
686686
benchmark-sdk-extension-aws: -r {toxinidir}/sdk-extension/opentelemetry-sdk-extension-aws/benchmark-requirements.txt
687687

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

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

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

918918
test-resource-detector-azure: pytest {toxinidir}/resource/opentelemetry-resource-detector-azure/tests {posargs}
919919
lint-resource-detector-azure: sh -c "cd resource && pylint --rcfile ../.pylintrc opentelemetry-resource-detector-azure"
@@ -1048,6 +1048,6 @@ deps =
10481048
{toxinidir}/instrumentation-genai/opentelemetry-instrumentation-vertexai[instruments]
10491049
{toxinidir}/instrumentation-genai/opentelemetry-instrumentation-google-genai[instruments]
10501050
{toxinidir}/instrumentation/opentelemetry-instrumentation-asyncclick[instruments]
1051-
1051+
10521052
commands =
10531053
pyright

0 commit comments

Comments
 (0)