-
Notifications
You must be signed in to change notification settings - Fork 634
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
Container detector module kubernetes properties (pod.uid) #1489
base: main
Are you sure you want to change the base?
Container detector module kubernetes properties (pod.uid) #1489
Conversation
resource/opentelemetry-resource-detector-kubernetes/pyproject.toml
Outdated
Show resolved
Hide resolved
...etry-resource-detector-kubernetes/src/opentelemetry/resource/detector/kubernetes/__init__.py
Outdated
Show resolved
Hide resolved
...etry-resource-detector-kubernetes/src/opentelemetry/resource/detector/kubernetes/__init__.py
Outdated
Show resolved
Hide resolved
resource/opentelemetry-resource-detector-kubernetes/tests/test_kubernetes.py
Outdated
Show resolved
Hide resolved
…hulmukherjee68/opentelemetry-python-contrib into container-detector-kubernetes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add entries to eastdist.ini file as well
try: | ||
pod_resource = Resource.get_empty() | ||
try: | ||
pod_uid = ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- this line will give pod_uid as a tuple which we dont want. you should get pod_uid as a string
- Also
get_kubenertes_pod_uid_v1() and get_kubenertes_pod_uid_v2()
is also not required. If we get the pod_id from the v1() then there is no need to get it from v2(). so there should beor
operator instead ofand
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tuple is used since it is not acceptable by lint with out the braces and for the second point i have changed the logic in next commits
...etry-resource-detector-kubernetes/src/opentelemetry/resource/detector/kubernetes/__init__.py
Outdated
Show resolved
Hide resolved
resource/opentelemetry-resource-detector-kubernetes/tests/test_kubernetes.py
Outdated
Show resolved
Hide resolved
resource/opentelemetry-resource-detector-kubernetes/tests/test_kubernetes.py
Outdated
Show resolved
Hide resolved
resource/opentelemetry-resource-detector-kubernetes/tests/test_kubernetes.py
Outdated
Show resolved
Hide resolved
… to span attributes with trace provider
…hulmukherjee68/opentelemetry-python-contrib into container-detector-kubernetes
def test_k8_id_as_span_attribute_with_cgroup_v2( | ||
self, mock_get_kubenertes_pod_uid_v2 | ||
): | ||
tracer_provider, exporter = self.create_tracer_provider( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you dont need to create span for this test case.
"opentelemetry.resource.detector.kubernetes.get_kubenertes_pod_uid_v1", | ||
return_value=f"{MockKubernetesResourceAttributes[ResourceAttributes.K8S_POD_UID]}", | ||
) | ||
def test_k8_id_as_span_attribute_with_mountinfo_v1( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you dont need a span creation for this test case
I think this detector could have false-positives on container runtimes outside of Kubernetes. I would add a preliminary check whether the |
Thanks for the info @mmanciop . Will be doing that in next commits. |
If it can help, I have a backport of this PR on lumigo-io/opentelemetry-python-distro#226 (we are waiting to upgrade to a newer Otel SDK version by a bug on the MySQL instrumentation). |
hey @mmanciop are the following commit was merged in 2018 kubernetes/kubernetes@fd72938 |
GitHub makes it easy to see in terms of tags: The change shipped with |
Container detector module kubernetes properties
With this module customer can independently detect the k8s properties like pod.id as a part of span resource attributes and further can be used to correlate any problem with infra instrumentation
Fixes #1474
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Does This PR Require a Core Repo Change?
Checklist:
See contributing.md for styleguide, changelog guidelines, and more.