-
Notifications
You must be signed in to change notification settings - Fork 641
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
collector: pass Context #634
Conversation
5de5aea
to
ebddca9
Compare
Make it easier to embed the snmp_exporter into other systems. * Update metric registration to use promauto. * Update minimum version to Go 1.14. (required for exporter-toolkit) * Update snmp.yml with latest mibs. Re-implementation of #456 Signed-off-by: Ben Kochie <[email protected]>
Ahh, yes, it would be useful use the I'm not sure how useful it is to stub this out, without implementing any use of the context is. Are you planning to add more to this PR? |
We use collector directly as a library so we pass our own context therefore I marked the main.go context as TODO. I you want I can add support for |
Yes, with normal use, no context is necessary, as the scrape drops the HTTP connection on timeout, which cancels the walk. I was wrong, we don't need to explicitly handle the |
Signed-off-by: Alexey Ivanov <[email protected]>
ebddca9
to
8c78a12
Compare
Ok. I've added context propagation from the original HTTP request to the underlying collector. This should ensure cancelation in following scenarios:
|
Thanks, it looks like I screwed up the context here. This puts it back to where it was. |
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.
* [CHANGE] Update to exporter-toolkit v0.8.1 (#810) * [FEATURE] Support chained lookups in the generator (#757) * [ENHANCEMENT] Add per-SNMP packet statistics. (#656) * [ENHANCEMENT] Add support for aes192c and aes256c privacy protocol (#657) * [ENHANCEMENT] Support responding from different source address (#702) * [BUGFIX] Fixes dropped context passing (#634) * [BUGFIX] Add version flag (#717) * [BUGFIX] Fix retries in generator (#786) Signed-off-by: SuperQ <[email protected]>
* [CHANGE] Update to exporter-toolkit v0.8.1 (#810) * [FEATURE] Support chained lookups in the generator (#757) * [ENHANCEMENT] Add per-SNMP packet statistics. (#656) * [ENHANCEMENT] Add support for aes192c and aes256c privacy protocol (#657) * [ENHANCEMENT] Support responding from different source address (#702) * [BUGFIX] Fixes dropped context passing (#634) * [BUGFIX] Add version flag (#717) * [BUGFIX] Fix retries in generator (#786) Signed-off-by: SuperQ <[email protected]>
* [CHANGE] Update to exporter-toolkit v0.8.1 (#810) * [FEATURE] Support chained lookups in the generator (#757) * [ENHANCEMENT] Add per-SNMP packet statistics. (#656) * [ENHANCEMENT] Add support for aes192c and aes256c privacy protocol (#657) * [ENHANCEMENT] Support responding from different source address (#702) * [BUGFIX] Fixes dropped context passing (#634) * [BUGFIX] Add version flag (#717) * [BUGFIX] Fix retries in generator (#786) Signed-off-by: SuperQ <[email protected]> Signed-off-by: SuperQ <[email protected]>
This diff adds an ability to pass custom Context to the collector. This is inline with some other exporter's like the mysqld_exporter.