-
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 k8s service discovery resource attributes #9416
Merged
codeboten
merged 2 commits into
open-telemetry:main
from
dashpole:kubernetes_resource_discovery
Apr 29, 2022
Merged
Add k8s service discovery resource attributes #9416
codeboten
merged 2 commits into
open-telemetry:main
from
dashpole:kubernetes_resource_discovery
Apr 29, 2022
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dashpole
force-pushed
the
kubernetes_resource_discovery
branch
2 times, most recently
from
April 24, 2022 17:45
126b9c2
to
c181f1b
Compare
dashpole
changed the title
WIP Add k8s service discovery resource attributes
Add k8s service discovery resource attributes
Apr 24, 2022
cc @open-telemetry/wg-prometheus |
Changelog conflict resolved. |
Aneurysm9
approved these changes
Apr 27, 2022
jaronoff97
reviewed
Apr 27, 2022
dashpole
force-pushed
the
kubernetes_resource_discovery
branch
from
April 28, 2022 14:04
88ccd34
to
c85830d
Compare
jaronoff97
approved these changes
Apr 28, 2022
codeboten
approved these changes
Apr 29, 2022
djaglowski
pushed a commit
to djaglowski/opentelemetry-collector-contrib
that referenced
this pull request
May 10, 2022
* Add k8s service discovery resource attributes * address feedback
6 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description:
I've found myself writing relabel rules to take labels from prometheus service discovery and then wondering how to convert from metric labels to resource labels. In GKE, we even wrote a custom processor to do this for us. I realized the other day that we actually have all of these labels available to us in the prometheus receiver.
This PR converts some of the service discovery
__meta
labels from prometheus' kubernetes service discovery into otel semantic conventions. This could be extended to include other service discovery implementations (e.g. gce, aws, azure, docker swarm, etc.), or we could even add configuration to allow users to define their own map for prom service discovery labels to prometheus resource attributes.This is most useful when specifying
- role: pod
(Used by the PodMonitor prom-operator resource) or- role: node
inkubernetes_sd_configs
, as OpenTelemetry k8s attributes map well to the set of prometheus service discovery labels. In particular,- role: endpoints
(used by ServiceMonitor resource) and-role: service
(used by Probe resource) doesn't add any particularly useful attributes.Example
With this collector config:
You get the following resource labels in the output: