Create multi time series from CSV data ignores renaming of columns

  • What Grafana version and what operating system are you using?
    10.2.2 (docker image in Docker Desktop)
    Host OS Windows 10

  • What are you trying to achieve?
    I want to display csv data as multi time series.

  • How are you trying to achieve it?
    I use the CSV data source to retrieve my data from Victoria Metrics using the export api endpoint
    https://docs.victoriametrics.com/#how-to-export-csv-data. The returned csv data does not have a header, hence the columns are called Field 1, Field 2,… To rename the columns I use the organize fields transformation and then apply the Prepare time series (Multi-frame time series) transformation.

  • What happened?
    The data is displayed as expected but the naming of the series still uses the initial column names e.g. Field 6 {Field 1=“59”, Field 2=“2”, Field 3=“1”, Field 4=“105”, Field 5=“{\r\n "input1": 1\r\n}”}

  • What did you expect to happen?
    The naming of the series uses the correct field names e.g.
    Execution Time {Deployment=“59”, Function=“2”, Resource=“1”, Resource Deployment=“105”, Request Body=“{\r\n "input1": 1\r\n}”}

  • Can you copy/paste the configuration(s) that you are having problems with?
    Example Data:

Example Data
59,2,1,105,"{\r\n    \"input1\": 4\r\n}",4.0045208931,2024-01-12T07:42:55Z
59,2,1,105,"{\r\n    \"input1\": 4\r\n}",4.004529476165,2024-01-12T07:43:22Z
59,2,1,105,"{\r\n    \"input1\": 3\r\n}",3.003444910049,2024-01-12T07:35:10Z
59,2,1,105,"{\r\n    \"input1\": 3\r\n}",3.003635406494,2024-01-12T07:43:16Z
59,2,1,105,"{\r\n    \"input1\": 3\r\n}",3.003527879714,2024-01-12T08:17:00Z
59,2,1,105,"{\r\n    \"input1\": 1\r\n}",1.0014128685,2024-01-12T07:35:23Z
59,2,1,105,"{\r\n    \"input1\": 1\r\n}",1.001668453216,2024-01-12T07:45:21Z
59,2,1,105,"{\r\n    \"input1\": 1\r\n}",1.001548767089,2024-01-12T08:16:55Z
59,2,1,105,"{\r\n    \"input1\": 7\r\n}",7.00076007843,2024-01-12T07:35:20Z
59,2,1,105,"{\r\n    \"input1\": 10\r\n}",10.006876230239,2024-01-12T07:36:13Z
59,2,1,105,"{\r\n    \"input1\": 15\r\n}",15.0089175701,2024-01-12T08:17:16Z
59,2,1,105,"{\r\n    \"input1\": 15\r\n}",15.015579462051,2024-01-12T08:26:11Z

This is the panel json:

Panel JSON
{
  "datasource": {
    "uid": "fbce2b04-0de4-4979-98d5-af04b2b6c66a",
    "type": "marcusolsson-csv-datasource"
  },
  "fieldConfig": {
    "defaults": {
      "custom": {
        "drawStyle": "points",
        "lineInterpolation": "linear",
        "barAlignment": 0,
        "lineWidth": 1,
        "fillOpacity": 100,
        "gradientMode": "none",
        "spanNulls": true,
        "insertNulls": false,
        "showPoints": "always",
        "pointSize": 7,
        "stacking": {
          "mode": "none",
          "group": "A"
        },
        "axisPlacement": "auto",
        "axisLabel": "",
        "axisColorMode": "text",
        "axisBorderShow": true,
        "scaleDistribution": {
          "type": "linear"
        },
        "axisCenteredZero": false,
        "hideFrom": {
          "tooltip": false,
          "viz": false,
          "legend": false
        },
        "thresholdsStyle": {
          "mode": "off"
        },
        "axisSoftMin": 0
      },
      "color": {
        "mode": "palette-classic"
      },
      "mappings": [
        {
          "options": {
            "Null": {
              "index": 0
            }
          },
          "type": "value"
        }
      ],
      "thresholds": {
        "mode": "absolute",
        "steps": [
          {
            "color": "green",
            "value": null
          }
        ]
      },
      "decimals": 3,
      "unit": "s"
    },
    "overrides": []
  },
  "gridPos": {
    "h": 9,
    "w": 24,
    "x": 0,
    "y": 18
  },
  "id": 6,
  "options": {
    "tooltip": {
      "mode": "single",
      "sort": "none"
    },
    "legend": {
      "showLegend": true,
      "displayMode": "list",
      "placement": "bottom",
      "calcs": []
    }
  },
  "pluginVersion": "10.2.2",
  "targets": [
    {
      "datasource": {
        "type": "marcusolsson-csv-datasource",
        "uid": "fbce2b04-0de4-4979-98d5-af04b2b6c66a"
      },
      "decimalSeparator": ".",
      "delimiter": ",",
      "header": false,
      "ignoreUnknown": false,
      "params": [
        [
          "format",
          "deployment,function,resource,resource_deployment,requestBody,__value__,__timestamp__:rfc3339"
        ],
        [
          "match",
          "function_execution_duration_seconds"
        ],
        [
          "start",
          "$__from"
        ],
        [
          "end",
          "$__to"
        ]
      ],
      "path": "/api/v1/export/csv",
      "refId": "A",
      "schema": [
        {
          "name": "Field 1",
          "type": "string"
        },
        {
          "name": "Field 2",
          "type": "string"
        },
        {
          "name": "Field 3",
          "type": "string"
        },
        {
          "name": "Field 4",
          "type": "string"
        },
        {
          "name": "Field 5",
          "type": "string"
        },
        {
          "name": "Field 6",
          "type": "number"
        },
        {
          "name": "Field 7",
          "type": "time"
        }
      ],
      "skipRows": 0,
      "timezone": "UTC"
    }
  ],
  "title": "Previous Execution Times (last 30 min)",
  "transformations": [
    {
      "id": "organize",
      "options": {
        "excludeByName": {
          "Field 1": false
        },
        "indexByName": {},
        "renameByName": {
          "Field 1": "Deployment",
          "Field 2": "Function",
          "Field 3": "Resource",
          "Field 4": "Resource Deployment",
          "Field 5": "Request Body",
          "Field 6": "Execution Time",
          "Field 7": "Timestamp"
        }
      }
    },
    {
      "id": "prepareTimeSeries",
      "options": {
        "format": "multi"
      }
    }
  ],
  "type": "timeseries",
  "interval": "1s",
  "timeFrom": null
}
  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
    No

  • Did you follow any online instructions? If so, what is the URL?
    CSV Datasource Documentation

Hi matthig,

is that what you expect.?

This is the result when I use the “infinity datasource” plugin.
Here you can parse and rename in the plugin.

If you can’t use it, I will test it with the csv plugin.

Jo

Hi joachimschiewek,
I was not aware that this plugin existed.
Thank you for the quick help. That did the trick.