Skip to content
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

using opentelemetry.io* namespace for extracing resource and attribute labels from k8s Api #2330

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

Horiodino
Copy link

Description:
i have added recognizeUserDefinedValues() that will recognize the pods with pentelemetry.io/ prefix
#2181

Testing: i haven't tested it yet , im not sure is it right so please tell any changes to made

@Horiodino Horiodino requested a review from a team as a code owner November 9, 2023 07:45
Copy link

linux-foundation-easycla bot commented Nov 9, 2023

CLA Signed

The committers listed above are authorized under a signed CLA.

return true, err
}
if err != nil {
return false, err
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this line is not reachable

Copy link
Contributor

@jaronoff97 jaronoff97 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Horiodino looks like some import failures. Also, please sign the CLA when you get a chance :)

@@ -402,6 +402,54 @@ func chooseServiceVersion(pod corev1.Pod, index int) string {
return tag
}

// create/reserve namespace

func (i *sdkInjector) createReservedNamespace(ctx context.Context) (bool, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need to create a namespace here?

}

// recognizeUserDefinedValues recognizes user defined values assigned with opentelemetry.io/ prefix
func (i *sdkInjector) recognizeUserDefinedValues(ctx context.Context, ns corev1.Namespace, pod corev1.Pod, deployment appsv1.Deployment, index int) map[string]string {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you add some tests in? and make it so that this function is used as part of the injection process

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok 👍

@Horiodino
Copy link
Author

Horiodino commented Jan 29, 2024

@jaronoff97 @frzifus i have implemented it for mostly all resources, like pod , deply,statefulset, replicas etc..., but what i have done is i created a one main function that returns all info in map but the thing is in function arguments i need k8s client , should i separate create all functions for all resources ?
op : [pod/default = grafana-68dcc6497d-zs6f4] [deployment/default = grafana]

Copy link
Contributor

@jaronoff97 jaronoff97 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Horiodino per my last comment (link) there is no need to reach out to the kube API for any of this. Further, you're not using the functions you wrote and they are currently untested. If you'd like, I'd be happy to pair with you on this PR and we can work through it together.

@Horiodino
Copy link
Author

@Horiodino per my last comment (link) there is no need to reach out to the kube API for any of this. Further, you're not using the functions you wrote and they are currently untested. If you'd like, I'd be happy to pair with you on this PR and we can work through it together.

sure ✨

@jaronoff97
Copy link
Contributor

feel free to reach out via the CNCF slack and we can set up some time

@@ -30,11 +30,13 @@ import (
"go.opentelemetry.io/otel/attribute"
semconv "go.opentelemetry.io/otel/semconv/v1.7.0"
appsv1 "k8s.io/api/apps/v1"
v1obj "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.

@jaronoff97
Copy link
Contributor

@Horiodino would you be able to fix the merge conflicts, fix the unit tests, and add a changelog? I would love to get this merged in, it's looking pretty good!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants