How to stateCount all tag data in one panel, one tag one stateCount time series?

measuremet like this: _time tag=err_code field=errCode
data:
t1 err_code=1 errCode = 1
t2 err_code=2 errCode = 2
t3 err_code=1 errCode = 1
t4 err_code=2 errCode = 2

How to stateCount all tag data in one panel, one tag one stateCount time series.

I am a little lost on your goal. Do you want to count the number of error codes of a particular state?

|> count()

Or do you want to calculate how long a field has been in a particular state?

I want to count the number of consecutive errors for each error.

Hi @yoursaaron,
Then if you group by err_code and perform:

count()

This should provide your answer