-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Add namespace k8s tagger #3384
Add namespace k8s tagger #3384
Conversation
1e313a9
to
514fb9a
Compare
2e0f035
to
7c8b447
Compare
I think we should re-think the config changes this introduces. Instead of a new
This works well if we always want to support extacting data from objects that are related to a pod. In the example above, w'd extract the annotations from the namespace that the pod is in. In future we could have
the new I feel this allows for a much nicer config pattern that can be extended in future as we add support for newer types. Open to other ideas as well. |
@owais Should we follow the same pattern for metadata and labels?
|
Yes. I used annotations just as an example. We should support all feature we can/want for every k8s resources we add support for. I'd wait to see what others think about these config options before going ahead with the implementation. Tagging some people who might be interested in this. @dmitryax @pmm-sumo @ericmustin @tigrannajaryan @pmatyjasek-sumo @dashpole |
I like both options that Owais suggested, the option 2 looks probably a bit better to me. Having a default value |
@dmitryax agree. It also makes it easier to deal with config if we don't have to split and compare strings. |
I think the option 2 looks better. It is inline with for example |
Option #2 looks good to me as a way to specify where from to extract annotations. Question: does extracted data get added as a Resource attribute or as a Span/LogRecord attribute? |
What do we do with the additional well-know fields? Do they go under the existing "metadata" setting? e.g.:
Do we believe that this single list of fields is sufficient for future needs? Do we expect field name clashes that make it impossible to disambiguate which entity the metadata should be extracted from? For example is "startTime" the pod start time or node start time (hypothetically speaking)? |
don't have super strong opinions here, but #2 seems a bit cleaner generally speaking |
No strong opinion here either. Option 2 seems cleaner but option 1 is less verbose.
I think that in principle, this processor should impact Resource-level attributes only and it seems it wasn't changed here. If attributes are on a record-level, they can be extracted level up using groupbyattrsprocessor |
@tigrannajaryan These are added as resource attributes. "startTime" is distinct for all object types like pods, namespaces etc, so they all need to be distinct in some way. Also "namespace" and "namespaceName" are the same but extracted from different objects, pods, and namespace respectively. |
Should we use Otel-compliant names for fields that we extract? So for example instead of: extract:
metadata:
# extract the following well-known metadata fields
# these are pod fields:
- podName
- podUID
- deployment
- cluster
- namespace
- node
- startTime we do: extract:
metadata:
# extract the following well-known metadata fields
# these are pod fields:
- k8s.pod.name # this comes from a pod
- k8s.pod.uid
- k8s.deployment.name # where does this come from? from pod or the associated deployment? Or it is the same thing?
- k8s.namespace.name # this comes from a namespace
- k8s.pod.start_time # pod's start time.
- k8s.node.start_time # node's start time.
- startTime # alias for k8s.pod.start_time
- etc ... This way it is more apparent what is it that we are populating. This way we can also disambiguate fields which may be present in more than one entity. Thoughts? I understand this means changing already existing field names, but we can do it in a backward compatible way by supporting old names as aliases for the fields that we start supporting new canonical Otel names. |
@tigrannajaryan that actually makes it really easy for the users to understand what they want and configure appropriately. |
@tigrannajaryan makes sense for the "metadata" section which is static list of well-known fields. One implication of this is that if we need support for new fields, we'll first need to go and update the semantic conventions (which is probably a good thing anyway). But I think this should be done in a separate PR. @chaitanyaphalak this reminds me that I think we should split this into multiple PRs:
If you only need or want to work on 3. let's create an issue to track what Tigran suggested. We should do it before GA. WDYT? |
@owais I am cool working on all the 3 things along with adding the namespace metadata fields to the semantic conventions here - |
@chaitanyaphalak One more thing. If you add support for new metadata fields, try to restrict them in a way so they can be extracted from the pod spec and won't require watching resources other than pods. If we do add support for some fields that can't be extracted from pods and need additional API calls, let's not turn them on by default. |
This PR was marked stale due to lack of activity. It will be closed in 7 days. |
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.
Thanks. Overall direction looks good. Took a quick look and left some comments. Will review again in detail in the morning.
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.
Looks good but I can't find where we are setting default value for "from" to "pod". If we aren't yet, let's add that.
@owais The PR is ready. |
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.
Looks good but left 2 minor comments. I trust you to take care of those before getting it merged :)
Thanks for the contribution. great work!
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.
Please update the documentation in doc.go to show how the new functionality can be used.
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
Description: Add feature to fetch namespace metadata, labels and annotations
Link to tracking Issue: Feature request - #3430 and use-case - #3031
Testing:
Documentation: