431 Request Header Fields Too Large

Hi, getting this error on Grafana table panel.

431 Request Header Fields Too Large

Object

message:“InfluxDB Error: Request Header Fields Too Large”

data:Object

error:“Request Header Fields Too Large”

response:“431 Request Header Fields Too Large”

message:“431 Request Header Fields Too Large”

config:Object

method:“GET”

url:“api/datasources/proxy/39/query”

params:Object

data:null

precision:“ms”

inspect:Object

type:“influxdb”

paramSerializer:function(e){…}

headers:Object

X-Grafana-Org-Id:1

retry:0

hideFromInspector:false

This was working before, I don’t think anything changed.
I have other Grafana dashboards using the same Influx server without a problem.
Grafana v7.4.0 , InfluxDB shell version: 1.8.1

The issue is with the Variable VMName. I have setup show tag values with key =“VMName” in the variable setup, i have multi-value and include all options enabled. The preview seems to work.
When I use the ALL drop down from the panel, it bombs out with the error.

query looks like this:
SELECT last(“CPU”), “MemoryGB”, “ProvisionedSpaceGB” FROM “VMInfo” WHERE (“ClientName” =~ /^$ClientName$/ AND “VCenterName” =~ /^$VCenterName$/ AND “Clustername” =~ /^$Clustername$/ AND “VMName” =~ /^$VMName$/ AND “OSFullName” =~ /^$OSFullName$/ AND “PowerState” =~ /^$PowerState$/ AND “CIStatusVM” =~ /^$CIStatusVM$/) AND $timeFilter GROUP BY “ClientName”, “VCenterName”, “Clustername”, “VMName”, “OSFullName”, “PowerState”, “CIStatusVM”

Info about the VMInfo tag:

show tag values cardinality with key =“VMName”
name: VMInfo
count


43049

thanks

So your tag has 43049 different values. Default All behaviour concatenates all these values into one string with “OR” operator between values → so that will be really long string which will be queried as GET parameter by default.
URL can’t have infinite size. Size is determined by buffer, which is processing request and you are aparently hitting this limit.

Solutions:
1.) Increase that buffer on the influxdb side if it is possible - but what will be correct buffer size for any tag cardinality which you may have now or in the future, so this is IMHO not a good solution
2.) Switch from GET request to POST requests (it is avaible in the datasource config) - POST buffers are usually bigger, better you may still reach buffer limits at some points
3.) The best solution is to customize All value to .*, so you it will use regexp syntax efficiently and you will have standard request size in all possible tag cardinality.

perfect, I changed the variable VMName to add the .* in the custom all value, and we’re back in business.
I also added the custom all value to my other variables, the query is so much smaller without all the values in it.
thanks