-
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
[receiver/receiver_creator] Add support for enabling receivers/scrapers from K8s hints #35617
base: main
Are you sure you want to change the base?
Conversation
790635e
to
d939e0b
Compare
18378d6
to
6d876f2
Compare
@dmitryax I have opened this for review, please feel free to take a look when you get the chance. Since #35544 was merged I could also add the Logs' part here if that's easier for you to review, however that would make the PR significantly bigger. Let me know what you prefer. Update Logs included-> https://github.com/open-telemetry/opentelemetry-collector-contrib/compare/main...ChrsMark:opentelemetry-collector-contrib:logs_hints?expand=1 |
5b8845d
to
7c65ab2
Compare
dbb83aa
to
451da6c
Compare
13adc90
to
cd85cdd
Compare
@dmitryax based on the discussion at #35617 (comment) I have changed the PTAL. |
} | ||
return k8sHintsBuilder{ | ||
logger: logger, | ||
config: config, |
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.
Why do we need to store the full config if we have a separate field for ignoreReceivers
? Can be just enabled right?
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.
Even enabled seems like not being used...
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.
Must be a leftover after some of the re-designs, good catch! Removed that at
ddc4655, thank's!
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.
LGTM with a nit
Thank's @dmitryax, I've removed the redundant config field. It should be good to go now. |
type hintsTemplatesBuilder interface { | ||
createReceiverTemplateFromHints(env observer.EndpointEnv) (*receiverTemplate, error) | ||
} |
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 interface doesn't seem like being used anywhere, right?
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.
Right now it's only implemented by the k8sHintsBuilder
. The idea is to give the option for implementing it in the various different environments like k8s, docker etc. This feature would make sense for docker as well.
return userConfigMap{} | ||
} | ||
|
||
if !strings.Contains(confEndpoint, defaultEndpoint) { |
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.
I have a couple of questions here:
- Will this work for annotation with
"`endpoint`"
string in it? like the one we have in the readme
io.opentelemetry.discovery.metrics/config: |
endpoint: "http://`endpoint`/nginx_status"
- I think "contains" isn't a strong enough check. Someone can configure the annotation to be
"http://another-endpoint/nginx_status?my-endpoint:8888" and if collector will scrape "another-endpoint". I think we should use URI pattern check here instead
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.
Right to both. The validation had to be improved indeed. Fixed that in the last commit(9f4ebcb).
Signed-off-by: ChrsMark <[email protected]>
Signed-off-by: ChrsMark <[email protected]>
Signed-off-by: ChrsMark <[email protected]>
Signed-off-by: ChrsMark <[email protected]>
cefeaa5
to
5029812
Compare
Signed-off-by: ChrsMark <[email protected]>
Description
This PR implements the metrics' part suggested at #34427 (comment). The current implementation only supports hints coming from Pods (wip with Logs included-> https://github.com/open-telemetry/opentelemetry-collector-contrib/compare/main...ChrsMark:opentelemetry-collector-contrib:logs_hints?expand=1)This PR implements what it was decided at #34427 (comment).
See the README docs for the description of this feature: https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/35617/files#diff-4127365c4062a7510fb7fede0fa239e9232549732898303d94c12fef0433d39d
TODOs:
Link to tracking issue
Part of #34427
Testing
Added unit-tests.
Documentation
Added
How to test this locally
More testing target Pods
busybox-multi-logs.txt
busybox-single-logs.txt
redis-nginx-mutli.txt
redis-single.txt
redis-single-logs.txt