0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

部分文字列による InfluxDB Flux クエリグループ

Posted at

列名のプレフィックスでグループ化しようとしているので、次のことを試すことができます。

  1. プレフィックスに基づいて新しい列を作成します
  2. 新しい列でグループ化

サンプルコードは次のとおりです:

from(bucket: v.bucket)
|> range(start: v.timeRangeStart, stop:v.timeRangeStop)
|> filter(fn: (r) => r._measurement == "Processors")
|> map(fn: (r) => ({r with newProc: strings.substring(v: r._value, start: 0, end: 7)}))
|> group(columns: ["newProc"])
|> aggregateWindow(every: v.windowPeriod, fn: mean)

注意: |> aggregateWindow(column: "_value", every: v.windowPeriod, fn: mean) この方法で列を指定できます。これを試す前に、この行をコメントアウトして、集計前の結果、特に列名を確認してください。

map 関数と部分文字列関数、aggregateWindow 関数の詳細を参照してください。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?