-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Description
Use Case
Internal statistics related to an input plugin only add alias or _id as additional info to identify the plugin when they are set in the config. This is mostly not enough to query them afterwards in the database.
An option to also add the labels or tags configured on the plugin to these statistics would help.
Example
I have an inputs.snmp for each device I collect info from. They are grouped by addition of a role tag. I also added the device name as alias value to have distinct logs and internal_gather metrics.
[[inputs.snmp]]
alias = "fw001"
agents = ["10.0.0.1:161"]
[inputs.snmp.tags]
hostname = "fw001"
role = "firewall"When I want to see error counters from all the firewalls, then I need to do the following:
- Gather all hostnames where role equals firewall.
- Prepare a huge query with all the retrieved names: (pseudo code)
SELECT errors FROM internal_gather
WHERE input = 'snmp' AND REGEXP_LIKE(alias, '^(fw001|fw002|fw003|...)$');You can imagine this could be a lot more performant when a query like this would be possible instead:
SELECT errors FROM internal_gather
WHERE input = 'snmp' AND role = 'firewall';Expected behavior
A global config option to enable addition of plugin-level defined tags or labels:
- internal_gather,alias=fw001,input=snmp,version=1.36.4 errors=0i,gather_time_ns=0i,gather_timeouts=0i,metrics_gathered=0i
+ internal_gather,alias=fw001,input=snmp,role=firewall,version=1.36.4 errors=0i,gather_time_ns=0i,gather_timeouts=0i,metrics_gathered=0iActual behavior
No additional info on internal plugin metrics.
Additional info
Related spec TSD-011 Internal plugin statistics collection says:
The injected collector instance must add all relevant model-level information such as an optional alias setting or tags settings.
However, it was requested in #17749 (comment) to remove tags copy, rendering the current implementation to not adhere to the spec.