Skip to content

Add option to add additional info to internal statistics #17962

@Hipska

Description

@Hipska

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:

  1. Gather all hostnames where role equals firewall.
  2. 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=0i

Actual 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestRequests for new plugin and for new features to existing plugins

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions