Skip to content

Permit comma-separated list of module names in "module" parameter - #949

Closed
candlerb wants to merge 1 commit into
prometheus:mainfrom
candlerb:candlerb/731
Closed

Permit comma-separated list of module names in "module" parameter#949
candlerb wants to merge 1 commit into
prometheus:mainfrom
candlerb:candlerb/731

Conversation

@candlerb

Copy link
Copy Markdown
Contributor

This is a proof-of-concept patch for discussion and review.

It allows a single scrape to specify a comma-separated list of modules, e.g. module=if_mib,mikrotik. This implements #731, and supports the breaking up of snmp.yml into independent MIB pieces as discussed in #938.

Points to note/discuss (some marked TODO in source):

  • Currently only module=foo,bar is supported. I could add module=foo&module=bar as an additional option; however, I want to keep the former, because target rewriting rules can only specify a single instance of a given parameter (i.e. __param_module in this case)
  • There's no attempt to reject duplicate modules (module=if_mib,if_mib), nor to handle distinct modules which generate overlapping metrics. In those cases, the Prometheus client library itself will barf, with an error like
    * collected metric "sysUpTime" { gauge:{value:7.102146e+08}} was collected before with the same name and label values
    
  • The modules are processed sequentially, in the order given in the request
  • Each module still has a scrape phase and an emit-metrics phase. The scrape times (and packet count / retry count) are summed, to give the same metrics
  • I have not added any additional tests - but none of the existing ones break. I believe that if you invoke this with a single module, it should behave exactly the same as today.
  • I have not updated documentation

@SuperQ

SuperQ commented Aug 16, 2023

Copy link
Copy Markdown
Member

We're already working on multiple modules in #945.

@candlerb

Copy link
Copy Markdown
Contributor Author

Closing in favour of #945 (but will leave the branch just in case)

@candlerb candlerb closed this Aug 17, 2023
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.

2 participants