Z.replace is not a function

Happy Graphing!

I have had a dashboarding running for some time now, that is using Infinity Plugin to pull API data from an RMM. This has been working without issue for months now, but all of a sudden today a single panel is displaying the error Z.replace is not a function and it has caused it to no longer pull the proper columns and labels as I have them filtered, but has forced all data into the visualization.


Whats odd, is a friend of mine that has a very similar dashboard feature has the same issue. He however noticed that he could resolve it by simply retyping “true” here:
image
And it sorts itself out. Any idea what could be causing this?

May be NaN instead one of your number fields, may be something else

No clue in browser console?


This is all I get in browser console.

what does the rest api return?

As I assumed eariler,‎ ‎ ‎
numeric : NaN
could be the cause of this error.

Check your input data.

1 Like

The API return is the same as it typically is. Gives back device details from our RMM. It is filtered down to show disks with more than 70% usage, using Grafana. The odd part is if you remake it, it works fine but in it’s current state just sits there errored. I have confirmed with the RMM vendor nothing has been changed on the API side, and looking at the table view, I don’t see any Null colums or rows. It’s odd.

Thank you,

~WRD0000.jpg

1 Like

I’m running into the same issue. Several of my panels with the ‘Filter data by values’ transform are displaying the ‘z.replace is not a function’ error. This is with the dashboards on Grafana Cloud v11.2.0. Thing is the same dashboard configuration is fine under Grafana OSS v11.0.0. These are both using the same datasource (Timestream).

If the transform is deleted and rebuilt, the error is resolved. I agree, this is odd.

What version of grafana are you on? can you post sample json data?

Grafana v11.2.0-72163 (1d6c9d4690) [Cloud]

Json from a panel showing the error

{
  "datasource": {
    "type": "grafana-timestream-datasource",
    "uid": "timestream-aura"
  },
  "description": "This is a list of the miners for $orgId that have experienced an elevated Control Board temperature level (${__from:date:LLL} - ${__to:date:LLL})",
  "fieldConfig": {
    "defaults": {
      "custom": {
        "align": "auto",
        "cellOptions": {
          "type": "color-background"
        },
        "inspect": false,
        "filterable": true
      },
      "mappings": [],
      "thresholds": {
        "mode": "absolute",
        "steps": [
          {
            "color": "dark-blue",
            "value": null
          },
          {
            "color": "dark-green",
            "value": 0
          },
          {
            "color": "dark-yellow",
            "value": 37
          },
          {
            "color": "dark-orange",
            "value": 42
          },
          {
            "color": "dark-red",
            "value": 48
          }
        ]
      },
      "color": {
        "mode": "thresholds"
      },
      "unit": "celsius"
    },
    "overrides": [
      {
        "matcher": {
          "id": "byName",
          "options": "Temp_Cb"
        },
        "properties": [
          {
            "id": "displayName",
            "value": "Control Board temperature"
          },
          {
            "id": "color"
          }
        ]
      },
      {
        "matcher": {
          "id": "byName",
          "options": "DeviceGroup"
        },
        "properties": [
          {
            "id": "displayName",
            "value": "Miner Group"
          },
          {
            "id": "color",
            "value": {
              "fixedColor": "text",
              "mode": "fixed"
            }
          },
          {
            "id": "mappings",
            "value": [
              {
                "options": {
                  "Teraflux Group": {
                    "index": 0,
                    "text": "Teraflux Group (default)"
                  }
                },
                "type": "value"
              }
            ]
          }
        ]
      },
      {
        "matcher": {
          "id": "byName",
          "options": "SerialNo"
        },
        "properties": [
          {
            "id": "displayName",
            "value": "Chassis Serial"
          },
          {
            "id": "color",
            "value": {
              "fixedColor": "text",
              "mode": "fixed"
            }
          }
        ]
      },
      {
        "matcher": {
          "id": "byName",
          "options": "IP"
        },
        "properties": [
          {
            "id": "displayName",
            "value": "Miner Address"
          },
          {
            "id": "color",
            "value": {
              "fixedColor": "text",
              "mode": "fixed"
            }
          }
        ]
      },
      {
        "matcher": {
          "id": "byName",
          "options": "time"
        },
        "properties": [
          {
            "id": "color",
            "value": {
              "fixedColor": "text",
              "mode": "fixed"
            }
          }
        ]
      }
    ]
  },
  "gridPos": {
    "h": 7,
    "w": 12,
    "x": 12,
    "y": 59
  },
  "id": 30,
  "options": {
    "showHeader": true,
    "cellHeight": "sm",
    "footer": {
      "show": false,
      "reducer": [
        "lastNotNull"
      ],
      "countRows": false,
      "fields": "",
      "enablePagination": false
    }
  },
  "pluginVersion": "11.2.0-72163",
  "targets": [
    {
      "database": "\"telemetry_test_data\"",
      "datasource": {
        "type": "grafana-timestream-datasource",
        "uid": "timestream-aura"
      },
      "measure": "miner_metrics",
      "rawQuery": "SELECT time, SerialNo, DeviceGroup, IP, Temp_Cb\nFROM $__database.$__table\nWHERE $__timeFilter\n   AND measure_name = '$__measure'\n   AND Org_ID = '$orgId'\n",
      "refId": "Control Board Temperature warning alerts",
      "table": "\"MinerMetricsTable\""
    }
  ],
  "title": "Control Board Temperature - WARNING",
  "transformations": [
    {
      "id": "convertFieldType",
      "options": {
        "conversions": [
          {
            "destinationType": "number",
            "targetField": "Temp_Cb"
          }
        ],
        "fields": {}
      }
    },
    {
      "id": "filterByValue",
      "options": {
        "filters": [
          {
            "config": {
              "id": "lower",
              "options": {
                "value": 48
              }
            },
            "fieldName": "Temp_Cb"
          },
          {
            "config": {
              "id": "greaterOrEqual",
              "options": {
                "value": 37
              }
            },
            "fieldName": "Temp_Cb"
          }
        ],
        "match": "all",
        "type": "include"
      }
    }
  ],
  "type": "table"
}

oh, I meant the data Infinity Plugin is pulling, so this issue also happens in other data sources, I would avoid using that filtering mechanism and use the filter provided by your data source.

Ok, so it isn’t on the API side then, it has to be something on Grafana side. You are the 4th person I’ve had confirm this and you are correct it is specific to the filter data by values it seems. I wonder if maybe something was updated that changed a function or something.

1 Like

I am using two transforms:

Convert Field Type to convert the variable’s value from a string to a number
Filter Data by Values to match conditions for the table display.

With the Filter Data by Values enabled, the data appears to be a string rather and a number. It is like the first transform has been ignored.

After deleting the Filter Data by Values transform and recreating it, this behavior is no longer present (i.e., the data remains a number)

To be clear, this is observed on Grafana v11.2.0-72163 (1d6c9d4690) [cloud]

1 Like

try to avoid grafana helpers if at all possible, they are just that helpers. I highly recommend using functions for transformations, filters etc in your data source to do data manipulation etc even for variables.

I am also using Grafana Cloud in the errored instance.

 "datasource": {
    "type": "yesoreyeram-infinity-datasource",
    "uid": "a3664529-e2dd-4eb9-bff7-765c42459902"
  },
  "fieldConfig": {
    "defaults": {
      "custom": {
        "lineWidth": 1,
        "fillOpacity": 80,
        "gradientMode": "none",
        "axisPlacement": "auto",
        "axisLabel": "",
        "axisColorMode": "text",
        "axisBorderShow": false,
        "scaleDistribution": {
          "type": "linear"
        },
        "axisCenteredZero": false,
        "hideFrom": {
          "tooltip": false,
          "viz": false,
          "legend": false
        },
        "thresholdsStyle": {
          "mode": "off"
        }
      },
      "color": {
        "mode": "palette-classic"
      },
      "mappings": [],
      "thresholds": {
        "mode": "absolute",
        "steps": [
          {
            "color": "green",
            "value": null
          },
          {
            "color": "red",
            "value": 80
          }
        ]
      },
      "unit": "percentunit"
    },
    "overrides": []
  },
  "gridPos": {
    "h": 8,
    "w": 12,
    "x": 11,
    "y": 33
  },
  "id": 14,
  "options": {
    "orientation": "horizontal",
    "xTickLabelRotation": 0,
    "xTickLabelSpacing": 0,
    "showValue": "never",
    "stacking": "none",
    "groupWidth": 0.7,
    "barWidth": 0.97,
    "barRadius": 0,
    "fullHighlight": false,
    "tooltip": {
      "mode": "single",
      "sort": "none"
    },
    "legend": {
      "showLegend": true,
      "displayMode": "list",
      "placement": "right",
      "calcs": []
    }
  },
  "pluginVersion": "11.1.0-69622",
  "targets": [
    {
      "columns": [],
      "datasource": {
        "type": "yesoreyeram-infinity-datasource",
        "uid": "a3664529-e2dd-4eb9-bff7-765c42459902"
      },
      "filters": [],
      "format": "table",
      "global_query_id": "",
      "parser": "backend",
      "refId": "A",
      "root_selector": "",
      "source": "url",
      "type": "json",
      "url": "https://app.ninjarmm.com/v2/devices-detailed?df=org+42",
      "url_options": {
        "data": "",
        "method": "GET"
      }
    }
  ],
  "title": "DIsks over 70%",
  "transformations": [
    {
      "id": "extractFields",
      "options": {
        "format": "kvp",
        "source": "volumes"
      }
    },
    {
      "id": "filterFieldsByName",
      "options": {
        "include": {
          "names": [
            "systemName",
            "capacity",
            "freeSpace",
            "name"
          ]
        }
      }
    },
    {
      "id": "calculateField",
      "options": {
        "alias": "Percent Free",
        "binary": {
          "left": "freeSpace",
          "operator": "/",
          "right": "capacity"
        },
        "mode": "binary",
        "reduce": {
          "reducer": "sum"
        }
      }
    },
    {
      "id": "calculateField",
      "options": {
        "alias": "Percent Used",
        "binary": {
          "left": "1",
          "operator": "-",
          "right": "Percent Free"
        },
        "mode": "binary",
        "reduce": {
          "reducer": "sum"
        }
      }
    },
    {
      "id": "filterFieldsByName",
      "options": {
        "include": {
          "names": [
            "systemName",
            "name",
            "Percent Used"
          ]
        }
      }
    },
    {
      "id": "filterByValue",
      "options": {
        "filters": [
          {
            "config": {
              "id": "isNull",
              "options": {}
            },
            "fieldName": "name"
          }
        ],
        "match": "any",
        "type": "exclude"
      }
    },
    {
      "id": "calculateField",
      "options": {
        "alias": "Label",
        "binary": {
          "left": "systemName",
          "right": "name"
        },
        "mode": "binary",
        "reduce": {
          "reducer": "sum"
        }
      }
    },
    {
      "id": "filterFieldsByName",
      "options": {
        "include": {
          "names": [
            "systemName",
            "Percent Used",
            "name"
          ]
        }
      }
    },
    {
      "id": "filterByValue",
      "options": {
        "filters": [
          {
            "config": {
              "id": "greater",
              "options": {
                "value": 0.7
              }
            },
            "fieldName": "Percent Used"
          }
        ],
        "match": "all",
        "type": "include"
      }
    }
  ],
  "type": "barchart"
}

Not entirely sure what you are referring to as “Grafana Helpers.” Pardon my ignorance.

Convert Field Type
Filter Data by Values

etc are what I refer to as grafana helpers

as seen in this case because they are grafana sourced helpers something seems to have changed in underlying code and it broke your dashboard. you have no control over the underlying code for these helpers. but you do have control of functions in your data source.

Convert Field Type to convert the variable’s value from a string to a number

Instead of doing the above using grafana, can you do it using your db convert to int function?

I did try using a CAST to convert the string to a Double in the query, but it is the Filter Data by Value producing the error.

Replacing the Filter Data by Value transform is more…interesting.

:laughing: yes it is interesting indeed.

try using a CAST to convert the string to a Double in the variable instead of transformation

also maybe worth also submitting a bug for this, maybe a regression bug

In my case there is no db involved, this is pulling raw data directly from a REST API. So no way of really transforming outside of Grafana features. Although, I’m working on getting to a point I can dump the data into a DB so I can retain historical data to build monthly reports.

actually there is if you are interested using uql functions