Missing labels and empty label values differ in "Prometheus to JSON" preprocessing

XMLWordPrintable

    • Type: Problem report
    • Resolution: Unresolved
    • Priority: Trivial
    • None
    • Affects Version/s: 7.0.27
    • Component/s: Frontend (F), Server (S)
    • None

      Steps to reproduce:

      1. Have LLD rule with "Prometheus to JSON" preprocessing "Parameters": {__name__=~"vector_component_.*_events_total",output=""}
      2. Test it with string vector_component_sent_events_total {component_id="trn_merge_split_lines",component_kind="transform",component_type="reduce",host="host"} 492673 1784110135542

      Result:
      Empty array, [].

      Expected:
      Discovery JSON.

      Tests

      1.
      vector_component_sent_events_total{component_id="trn_merge_split_lines",component_kind="transform",component_type="reduce",host="host"} 492673 1784110135542
      outcome: [] <- not expected

      2.
      vector_component_sent_events_total{component_id="trn_merge_streams",component_kind="transform",component_type="remap",host="host",output="_default"} 492868 1784110135542}
      outcome: [] <- expected

      3.
      vector_component_sent_events_total{component_id="trn_merge_streams",component_kind="transform",component_type="remap",host="host",output=""} 492868 1784110135542
      outcome: parsed JSON <- expected

      Testing actual discovery seems to indicate that server operates in the same way.

      Rationale

      https://prometheus.io/docs/concepts/data_model/ says: "Labels with an empty label value are considered equivalent to labels that do not exist".

      https://www.zabbix.com/documentation/current/en/manual/config/items/itemtypes/http/prometheus says that "To define the required data pattern you may use a query language that is similar to Prometheus query language (see comparison table)"

      The comparison table at https://www.zabbix.com/documentation/current/en/manual/config/items/itemtypes/http/prometheus#query-language-comparison does not mention that there is a difference in handling empty and missing values, and it seems counterproductive for it to be so.
      On top of it being unexpected, it does not allow for easy filtering on label existence.
      While this potentially has a workaround of LLD filters, it would be great to have preprocessing operate consistently with the upstream spec.

            Assignee:
            Zabbix Support Team
            Reporter:
            richlv
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: