Match_id用于扫描操作员

发布于 2025-02-05 16:45:22 字数 988 浏览 3 评论 0原文

我正在尝试使用“扫描”操作员来分析Azure Fleet遥测中的状态过渡。这是我试图建立会话的数据的修剪版本(每个会话基本上都是“准备就绪”和“ HumanInvestigate”之间的节点状态)。我无法理解下面输出中突出显示的行的M_ID值。

datatable(Ts: timespan, nodeState:string)
[
    0m, "Ready",
    1m, "Raw",
    2m, "Ready",
    3m, "HumanInvestigate",
    4m, "Ready",
    5m, "Raw",
    6m, "HumanInvestigate", 
    7m, "Ready",
    8m, "Raw",
    9m, "HumanInvestigate"
]
| sort by Ts asc
| scan with_match_id=m_id with 
(
        step s1: nodeState == "Ready";
        step s2: nodeState != "Ready" and nodeState != "HumanInvestigate";
        step s3: nodeState == "HumanInvestigate";
)

这是我的预期输出。您能为如何实现这一目标提供帮助。

I’m trying to use “scan” operator for analyzing state transitions in Azure fleet telemetry. Here is a trimmed down version of data where I’m trying to establish sessions (Each session is basically node states between “Ready” and “HumanInvestigate”). I couldn’t understand the m_id values for the rows highlighted in my output below.

datatable(Ts: timespan, nodeState:string)
[
    0m, "Ready",
    1m, "Raw",
    2m, "Ready",
    3m, "HumanInvestigate",
    4m, "Ready",
    5m, "Raw",
    6m, "HumanInvestigate", 
    7m, "Ready",
    8m, "Raw",
    9m, "HumanInvestigate"
]
| sort by Ts asc
| scan with_match_id=m_id with 
(
        step s1: nodeState == "Ready";
        step s2: nodeState != "Ready" and nodeState != "HumanInvestigate";
        step s3: nodeState == "HumanInvestigate";
)

enter image description here

Here is my expected output. Can you please help on how to achieve this.

enter image description here

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

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

发布评论

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

评论(1

红玫瑰 2025-02-12 16:45:22

“扫描”实现线性状态机。它针对速度和内存进行了优化,因此它可以通过数据进行一次通过,并保留存储状态的内存,仅限于单个记录的大小x的状态数。该限制意味着状态转变仅是向前的,并且在重叠序列的情况下,行为更为复杂,有时不直观。在您的情况下,状态过渡是从“准备”到“原始”到“人类投资”的。在1M时,第一匹匹配(M_ID == 0)移动到Step'S2',而Step's1'是空的,可以进行新的比赛。在2M时,“就绪”匹配“ S1”,开始新的比赛(M_ID == 1)。在这一点上,我们必须进行活动序列:m_id == 0 at's2'和m_id == 1 at's1'。在3m时,有一个匹配M_ID == 0,将其从“ S2”移至“ S3”。
为了达到预期的产出,您应该使用2个状态:

datatable(Ts: timespan, nodeState:string)
[
    0m, "Ready",
    1m, "Raw",
    2m, "Ready",
    3m, "HumanInvestigate",
    4m, "Ready",
    5m, "Raw",
    6m, "HumanInvestigate", 
    7m, "Ready",
    8m, "Raw",
    9m, "HumanInvestigate"
]
| sort by Ts asc
| scan with_match_id=m_id with 
(
        step s1: iff(nodeState == '', nodeState == "Ready", nodeState != "HumanInvestigate");   // a new sequence must start with 'Ready'
        step s2: nodeState == "HumanInvestigate";                                               // a sequence ends with 'HumanInvestigate'
)
 
Ts          nodeState           m_id
00:00:00    Ready               0
00:01:00    Raw                 0
00:02:00    Ready               0
00:03:00    HumanInvestigate    0
00:04:00    Ready               1
00:05:00    Raw                 1
00:06:00    HumanInvestigate    1
00:07:00    Ready               2
00:08:00    Raw                 2
00:09:00    HumanInvestigate    2

‘scan’ implements a linear state machine. It is optimized for speed and memory, so it does a single pass over the data and keeps the memory for storing the states limited to the number of states x the size of a single record. This limitation means that state transitions are forward only, and in case of overlapping sequences the behavior is more complex, sometimes not intuitive. In your case the state transitions are from ‘Ready’ to ‘Raw’ to ‘HumanInvestigate’. At 1m the first match (m_id == 0) moves to step ‘s2’, and step ‘s1’ is empty, ready for a new match. At 2m, the ‘Ready’ matches ‘s1’, starting a new match (m_id == 1). At this point we have to active sequences: m_id==0 at ‘s2’ and m_id==1 at ‘s1’. At 3m there is a match for m_id ==0, moving it from ‘s2’ to ‘s3’.
To achieve your expected output, you should use 2 states:

datatable(Ts: timespan, nodeState:string)
[
    0m, "Ready",
    1m, "Raw",
    2m, "Ready",
    3m, "HumanInvestigate",
    4m, "Ready",
    5m, "Raw",
    6m, "HumanInvestigate", 
    7m, "Ready",
    8m, "Raw",
    9m, "HumanInvestigate"
]
| sort by Ts asc
| scan with_match_id=m_id with 
(
        step s1: iff(nodeState == '', nodeState == "Ready", nodeState != "HumanInvestigate");   // a new sequence must start with 'Ready'
        step s2: nodeState == "HumanInvestigate";                                               // a sequence ends with 'HumanInvestigate'
)
 
Ts          nodeState           m_id
00:00:00    Ready               0
00:01:00    Raw                 0
00:02:00    Ready               0
00:03:00    HumanInvestigate    0
00:04:00    Ready               1
00:05:00    Raw                 1
00:06:00    HumanInvestigate    1
00:07:00    Ready               2
00:08:00    Raw                 2
00:09:00    HumanInvestigate    2
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文