InfluxDB v2.1 - 任务已执行,但目标存储桶中没有写入任何内容

发布于 2025-01-16 16:32:24 字数 779 浏览 6 评论 0原文

我正在使用 InfluxDB v2.1。

我有这个任务:

option task = {
   name: "DOWNSAMPLE APRILIA UTILITIES",
   cron: "0 * * * *",
}

from(bucket: "homeassistant-aprilia")
   |> range(start: -2h, stop: -1h)
   |> filter(fn: (r) => r["_measurement"] == "kWh")
   |> filter(fn: (r) => r["_field"] == "value")
   |> filter(fn: (r) => r.entity_id == "shellyem_c45bbe5fed52_channel_1_energy")
   |> aggregateWindow(every: 1h, fn: max, createEmpty: false)
   |> difference()
   |> to(bucket: "downsample-utility-aprilia", org: "sineverba")

它每小时执行一次,但是......它不会在目标存储桶中写入任何内容。

我有所有成功日志,但目标存储桶中没有任何内容。

如果我直接在源存储桶中启动任务,我可以看到我感兴趣的价值。

其他,如果我不省略“to”值,则从存储桶手动启动它会写入数据。

为什么?

I'm working with InfluxDB v2.1.

I have this task:

option task = {
   name: "DOWNSAMPLE APRILIA UTILITIES",
   cron: "0 * * * *",
}

from(bucket: "homeassistant-aprilia")
   |> range(start: -2h, stop: -1h)
   |> filter(fn: (r) => r["_measurement"] == "kWh")
   |> filter(fn: (r) => r["_field"] == "value")
   |> filter(fn: (r) => r.entity_id == "shellyem_c45bbe5fed52_channel_1_energy")
   |> aggregateWindow(every: 1h, fn: max, createEmpty: false)
   |> difference()
   |> to(bucket: "downsample-utility-aprilia", org: "sineverba")

it being executed every hour but... it doesn't write anything in the destination bucket.

I have all success logs but nothing in my destination bucket.

If I launch the task directly in source bucket, I can see the value of my interest.

Other, if I don't omit the "to" value, manually launched from bucket it writes the data.

Why?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

我乃一代侩神 2025-01-23 16:32:24

有时,InfluxDB 无法写入,但不响应错误。在这些情况下,成功状态并不意味着数据已写入。这意味着数据已被接受写入,但稍后可能会失败。尝试检查 _monitoring 存储桶。该存储桶存储被拒绝的数据点和错误消息。

例如,就我而言,这是架构不匹配。预期是一种类型,但收到的是另一种类型。我使用的是隐式模式,这意味着模式是由 InfluxDB 本身根据我放在那里的数据决定的。我通过明确模式解决了这个问题。在这种情况下,InfluxDB 在写入时立即返回错误。

Sometimes InfluxDB fails to write but doesn't respond with an error. In those cases, success status doesn't mean that the data was written. It means that data was accepted for writing but it might fail later. Try checking the _monitoring bucket. That bucket stores rejected data points with the error message.

For example, in my case, it was a schema mismatch. One type was expected but another was received. I was using implicit schema which means that schema was decided by the InfluxDB itself based on the data I put there. I resolved this by making schema explicit. In this case, InfluxDB returns an error right away at the moment of writing.

天冷不及心凉 2025-01-23 16:32:24

最后,我现在用 stop 解决了:

option task = {
    name: "DOWNSAMPLE APRILIA UTILITIES",
    cron: "0 * * * *",
}

option entity_id = "shellyem_c45bbe5fed52_channel_1_energy"

data = from(bucket: "homeassistant-aprilia")
    |> range(start: -2h, stop: now())
    |> filter(fn: (r) => r["_measurement"] == "kWh")
    |> filter(fn: (r) => r["_field"] == "value")
    |> filter(fn: (r) => r.entity_id == entity_id)
    |> aggregateWindow(every: 1h, fn: last, createEmpty: false)
    |> difference()
    |> to(bucket: "downsample-utilities-aprilia", org: "sineverba")

At the end, I solved with stop at now:

option task = {
    name: "DOWNSAMPLE APRILIA UTILITIES",
    cron: "0 * * * *",
}

option entity_id = "shellyem_c45bbe5fed52_channel_1_energy"

data = from(bucket: "homeassistant-aprilia")
    |> range(start: -2h, stop: now())
    |> filter(fn: (r) => r["_measurement"] == "kWh")
    |> filter(fn: (r) => r["_field"] == "value")
    |> filter(fn: (r) => r.entity_id == entity_id)
    |> aggregateWindow(every: 1h, fn: last, createEmpty: false)
    |> difference()
    |> to(bucket: "downsample-utilities-aprilia", org: "sineverba")
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文