Skip to content

Conversation

@fixedit-olatz
Copy link
Collaborator

@fixedit-olatz fixedit-olatz commented Nov 4, 2025

This commit adds configuration and helper files for event support in the time-in-area example. These files will monitor AOA detections and send a stateful event when a detection has been in the monitored zone for too long (expressed as active=1), as well as when the detection leaves the monitored area (expressed as active=0).

Summary by CodeRabbit

  • New Features

    • Implemented event-driven alert workflow with intermediate alarm state validation before delivery
    • New event handler for alert output routing
  • Updates

    • Documentation updated to reflect two-stage alerting sequence

Note

Introduce event-based alerting with stateful active/inactive events, heartbeat-driven inactivity detection, and updated processor wiring/docs.

  • Analytics Pipeline:
    • Alarming state detection: Add config_process_alarming_state.conf with 1 Hz heartbeat (alarming_state_heartbeat) and Starlark to emit alerting_state_change on state transitions using alerting_frame_two.
    • Threshold branching: Update config_process_threshold_filter.conf to emit both alerting_frame and alerting_frame_two for downstream processors.
    • Processor scoping: Add namepass filters in config_process_rate_limit.conf (alerting_frame) and config_process_overlay_transform.conf (rate_limited_alert_frame).
  • Event Output:
    • Add config_output_events.conf to send alerting_state_change via ${EXECUTABLES_DIR}/output_event with stateful event config.
  • Documentation:
    • Update README.md flow diagram, compatibility, and setup to include event pipeline (config_process_alarming_state.conf, config_output_events.conf); replace MQTT TODO with event-based alerts.

Written by Cursor Bugbot for commit 77c6dc0. This will update automatically on new commits. Configure here.

@coderabbitai
Copy link

coderabbitai bot commented Nov 4, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

The pull request restructures the alerting pipeline from direct MQTT output to a two-stage, event-driven workflow. It introduces heartbeat-based alarm state monitoring via a new Starlark processor, adds metric duplication to emit both primary and secondary alerting frames, applies namepass filters to existing processors, and routes state changes through an event-producer binary.

Changes

Cohort / File(s) Summary
Documentation
README.md
Updated flowchart and setup instructions to reflect two-stage alerting workflow with alarm-state checking and event output; added references to new config files and event-producer binary.
New Configuration Files
config_output_events.conf, config_process_alarming_state.conf
Added event output routing via execd to event-producer binary and new heartbeat-driven Starlark processor that monitors inactivity of alerting_frame_two metrics and emits alerting_state_change only on state transitions.
Updated Processors
config_process_overlay_transform.conf, config_process_rate_limit.conf
Added namepass filters (rate_limited_alert_frame and alerting_frame respectively) to restrict metric processing scope at configuration load time.
Threshold Logic
config_process_threshold_filter.conf
Modified to emit two duplicated alerting metrics (alerting_frame and alerting_frame_two) instead of one; now explicitly returns None when threshold is not met.

Sequence Diagram(s)

sequenceDiagram
    participant Input as Input Metrics
    participant Threshold as Threshold Filter
    participant RateLimit as Rate Limiter
    participant Overlay as Overlay Transform
    participant AlarmState as Alarm State Processor
    participant EventOutput as Event Output
    participant EventBinary as Event Producer
    
    Input->>Threshold: time_in_area metric
    activate Threshold
    Threshold->>Threshold: Check threshold
    Threshold->>RateLimit: alerting_frame, alerting_frame_two
    deactivate Threshold
    
    activate RateLimit
    RateLimit->>Overlay: rate_limited_alert_frame
    deactivate RateLimit
    
    activate Overlay
    Overlay->>AlarmState: overlay transformed metric
    deactivate Overlay
    
    activate AlarmState
    AlarmState->>AlarmState: Heartbeat-driven state tracking
    alt State changed
        AlarmState->>EventOutput: alerting_state_change
    else No state change
        AlarmState->>AlarmState: Suppress metric
    end
    deactivate AlarmState
    
    activate EventOutput
    EventOutput->>EventBinary: JSON via execd
    EventBinary->>EventBinary: Process event
    deactivate EventOutput
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Heartbeat-driven state tracking logic in config_process_alarming_state.conf requires careful verification of the state machine transitions and timing guarantees.
  • Metric duplication pattern in config_process_threshold_filter.conf must be validated to ensure both alerting_frame and alerting_frame_two flow correctly through downstream processors.
  • Integration points across five configuration files need to be verified for consistency—namepass filters must align with metric names emitted upstream.

Possibly related PRs

Pre-merge checks and finishing touches

✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding configuration and helper files for event support to the time-in-area analytics project.

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0f6a6e9 and 77c6dc0.

📒 Files selected for processing (6)
  • project-time-in-area-analytics/README.md (5 hunks)
  • project-time-in-area-analytics/config_output_events.conf (1 hunks)
  • project-time-in-area-analytics/config_process_alarming_state.conf (1 hunks)
  • project-time-in-area-analytics/config_process_overlay_transform.conf (1 hunks)
  • project-time-in-area-analytics/config_process_rate_limit.conf (1 hunks)
  • project-time-in-area-analytics/config_process_threshold_filter.conf (1 hunks)

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link

github-actions bot commented Nov 4, 2025

🎨 Code Formatting Required

Prettier Formatting Issues

Some files need to be formatted with Prettier (JSON, YAML, Markdown).

Files that need prettier formatting:

  • project-time-in-area-analytics/README.md

To fix prettier issues:

npx prettier@3.6.0 --write "**/*.{json,yml,yaml,md}" ".github/**/*.{json,yml,yaml,md}" ".*.{yml,yaml,json,md}" --ignore-unknown

Trailing Whitespace Issues

Some files have trailing whitespace (spaces/tabs at end of lines).

Files with trailing whitespace:

  • ./project-time-in-area-analytics/config_output_events.conf

To fix: Remove the trailing spaces/tabs at the end of lines in your favorite editor.

After fixing:

  1. Commit and push the changes
  2. The formatting check will automatically pass

@fixedit-olatz fixedit-olatz marked this pull request as draft November 4, 2025 11:02
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (2)
project-time-in-area-analytics/config_output_events.conf (1)

9-10: Clarify the configuration format terminology.

The comment states "GKeyFile-formatted input" but the inline configuration uses TOML syntax with [topics], [settings], and [item.active] sections. Consider updating the comment to "TOML-formatted" or "TOML-style GKeyFile" for clarity, as the syntax shown is more aligned with TOML than traditional GKeyFile format.

project-time-in-area-analytics/README.md (1)

136-137: Reminder: Complete the TODO placeholders before merging.

Two TODO placeholders need values:

  • Minimum Data Agent version: <TODO: TBD> (line 136)
  • Required features version note: <TODO: TBD> (line 137)

These should be filled in with the actual minimum version that includes the event handler binary support.

Do you want me to help track down the correct minimum version requirement, or would you like to open an issue to track this task?

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 827ea3d and 0f6a6e9.

📒 Files selected for processing (4)
  • project-time-in-area-analytics/README.md (6 hunks)
  • project-time-in-area-analytics/config_output_events.conf (1 hunks)
  • project-time-in-area-analytics/config_process_inactivity_monitor.conf (1 hunks)
  • project-time-in-area-analytics/inactivity_monitor.star (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
project-*/**

⚙️ CodeRabbit configuration file

project-*/**: Each example project for the FixedIT Data Agent should be self-contained and designed as a standalone example / tutorial showing how to use the FixedIT Data Agent. The project should be well documented and include all the necessary files to run the example. A reader should be able to understand the background and the purpose of the project, and be able to understand the implementation details and how to use it. If the project includes a dashboard, it should be placed in a new folder in the repo-root/dashboard-deployments/ directory instead of being included in the project folder. In the README for the project, the first time the FixedIT Data Agent is mentioned, we should link to the product page: https://fixedit.ai/products-data-agent/ Emphasize that these solutions are accessible to system integrators and IT professionals without requiring complex C/C++ ACAP development. Highlight that custom edge intelligence can be implemented using familiar IT tools (configuration files, shell scripts, REST APIs) rather than traditional embedded programming approaches. Note that bash does not exist on the Axis devices, so .sh scripts should be written in portable shell syntax.
README Structure: All project README files should follow the standardized template at .project_readme_template.md. This template ensures consistent documentation that serves both audiences: (1) IT professionals who want plug-and-play solutions, and (2) developers who want to customize and extend the examples. The template enforces a logical structure: 1) Introduction and background (project purpose, how it works, why choose this approach) 2) Technical explanation and quick start guide (compatibility, setup, troubleshooting) 3) Developer-oriented notes (local testing, implementation details)
Key README Requirements: - Include compatibility sections for both AXIS OS and FixedIT Data Agent versions - Explain host testing and its limitations and why certain parts require actual Axis d...

Files:

  • project-time-in-area-analytics/inactivity_monitor.star
  • project-time-in-area-analytics/config_output_events.conf
  • project-time-in-area-analytics/config_process_inactivity_monitor.conf
  • project-time-in-area-analytics/README.md
**/*

⚙️ CodeRabbit configuration file

This repository serves FixedIT Data Agent users across a spectrum from plug-and-play dashboard deployment to advanced edge device customization. Consider whether changes maintain accessibility for both DevOps professionals (server-side focus) and developers (edge customization focus). If new features are added or existing ones changed significantly, ensure documentation clearly explains the intended audience and usage level. We use prettier for formatting of common file formats like markdown, yaml, json, etc. Example projects should be placed in the repo-root in a directory named project-*/. Whenever referencing Axis device model names like "D4100-VE mk II" or "M3045", prefix it with "AXIS" in capital letters (e.g. "AXIS D4100-VE mk II"). When using Axis as a company name, use "Axis Communications", note that all-caps is only used when "AXIS" is used in their product names, not their company name. When using the name of an Axis product, google on the name to verify that it is correctly identified. Avoid using 'cameras' or 'Axis cameras' unless the solution in related to visual analytics, otherwise prefer using 'Axis devices' to show that the FixedIT Data Agent also works with strobes, speakers, door stations, etc. Images used for the README should be placed in a directory called .images/ in the affected project folder. These images might also be referred to from other sources like the top-level README.md file.

Files:

  • project-time-in-area-analytics/inactivity_monitor.star
  • project-time-in-area-analytics/config_output_events.conf
  • project-time-in-area-analytics/config_process_inactivity_monitor.conf
  • project-time-in-area-analytics/README.md
**/*.md

⚙️ CodeRabbit configuration file

**/*.md: Documentation files should clearly communicate the dual audience: (1) server-side dashboard users who want to keep agent with bundled configs, and (2) edge device developers who want to customize agent behavior. Ensure examples and instructions are appropriate for the intended skill level and use case. Since this is a public repository, we should not include any sensitive information, the instructions should be easily understandable for a wide audience, and we should avoid using any jargon or technical terms that are not commonly used.
Headings should not include special characters like emojis or backticks. The table of contents should be generated with the markdown-toc tool, meaning that we should use the <!-- toc --> and <!-- tocstop --> tags.

Files:

  • project-time-in-area-analytics/README.md
🧠 Learnings (1)
📚 Learning: 2025-10-15T11:36:24.102Z
Learnt from: daniel-falk
Repo: fixedit-ai/fixedit-data-agent-examples PR: 24
File: project-hello-world/README.md:156-179
Timestamp: 2025-10-15T11:36:24.102Z
Learning: The hello-world project (project-hello-world) for the FixedIT Data Agent has no differences between host and device behavior. It works identically on both because it only uses basic echo commands and standard Telegraf features.

Applied to files:

  • project-time-in-area-analytics/README.md
🔇 Additional comments (7)
project-time-in-area-analytics/config_output_events.conf (1)

13-27: Configuration structure looks good.

The inline event configuration is well-structured with clear namespace, topics, and stateful item definition. The boolean active item with default false aligns with the PR objective of emitting active=1/active=0 events.

project-time-in-area-analytics/inactivity_monitor.star (1)

1-7: Clear documentation of the inactivity monitoring purpose.

The docstring clearly explains the monitoring logic and use case for detecting when objects leave the monitored area.

project-time-in-area-analytics/config_process_inactivity_monitor.conf (1)

1-6: Heartbeat configuration is correct.

The exec input correctly uses portable sh -c syntax and emits a heartbeat metric every second in influx format.

project-time-in-area-analytics/README.md (4)

3-3: Good enhancement to the project description.

The updated description clearly explains the new event support functionality, including the emission of active=1 and active=0 events based on detection state.


30-33: Pipeline diagram accurately reflects the new flow.

The diagram correctly shows the new inactivity monitoring and event handler steps (E0 and E01) in the pipeline, with proper data flow from alerting_frameactive_status → event handler → MQTT output.


153-158: Quick setup instructions updated correctly.

The file concatenation command and upload instructions now include the three new files (config_process_inactivity_monitor.conf, config_output_events.conf, and inactivity_monitor.star), maintaining proper ordering in the pipeline.


638-638: Minor formatting improvement.

The added blank line improves readability in the coordinate transformation documentation section.

@fixedit-olatz fixedit-olatz force-pushed the add-event-management-files branch from 0f6a6e9 to 4151b8d Compare November 4, 2025 11:08
@github-actions
Copy link

github-actions bot commented Nov 4, 2025

🎨 Code Formatting Required

Prettier Formatting Issues

Some files need to be formatted with Prettier (JSON, YAML, Markdown).

Files that need prettier formatting:

  • project-time-in-area-analytics/README.md

To fix prettier issues:

npx prettier@3.6.0 --write "**/*.{json,yml,yaml,md}" ".github/**/*.{json,yml,yaml,md}" ".*.{yml,yaml,json,md}" --ignore-unknown

Trailing Whitespace Issues

Some files have trailing whitespace (spaces/tabs at end of lines).

Files with trailing whitespace:

  • ./project-time-in-area-analytics/config_output_events.conf

To fix: Remove the trailing spaces/tabs at the end of lines in your favorite editor.

After fixing:

  1. Commit and push the changes
  2. The formatting check will automatically pass

@fixedit-olatz fixedit-olatz force-pushed the add-event-management-files branch from 4151b8d to dc05bb5 Compare November 4, 2025 11:11
@github-actions
Copy link

github-actions bot commented Nov 4, 2025

🎨 Code Formatting Required

Trailing Whitespace Issues

Some files have trailing whitespace (spaces/tabs at end of lines).

Files with trailing whitespace:

  • ./project-time-in-area-analytics/config_output_events.conf

To fix: Remove the trailing spaces/tabs at the end of lines in your favorite editor.

After fixing:

  1. Commit and push the changes
  2. The formatting check will automatically pass

@fixedit-olatz fixedit-olatz force-pushed the add-event-management-files branch from dc05bb5 to 4ff2e04 Compare November 4, 2025 11:52
@daniel-falk daniel-falk changed the title Add files for event support Add files for event support to time-in-area project Nov 4, 2025
Copy link
Contributor

@daniel-falk daniel-falk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks generally good, but a few things:

@fixedit-olatz fixedit-olatz force-pushed the add-event-management-files branch from 4ff2e04 to 1a0b2eb Compare November 5, 2025 10:03
@github-actions
Copy link

github-actions bot commented Nov 5, 2025

🎨 Code Formatting Required

Prettier Formatting Issues

Some files need to be formatted with Prettier (JSON, YAML, Markdown).

Files that need prettier formatting:

  • project-time-in-area-analytics/README.md

To fix prettier issues:

npx prettier@3.6.0 --write "**/*.{json,yml,yaml,md}" ".github/**/*.{json,yml,yaml,md}" ".*.{yml,yaml,json,md}" --ignore-unknown

After fixing:

  1. Commit and push the changes
  2. The formatting check will automatically pass

@fixedit-olatz fixedit-olatz force-pushed the add-event-management-files branch from 1a0b2eb to be8c880 Compare November 5, 2025 10:08
Copy link
Contributor

@daniel-falk daniel-falk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything looks good apart from the Starlark script. See comments:

@fixedit-olatz fixedit-olatz force-pushed the add-event-management-files branch from be8c880 to 367b692 Compare November 5, 2025 12:32
@github-actions
Copy link

github-actions bot commented Nov 5, 2025

🎨 Code Formatting Required

Trailing Whitespace Issues

Some files have trailing whitespace (spaces/tabs at end of lines).

Files with trailing whitespace:

  • ./project-time-in-area-analytics/config_process_alarming_state.conf

To fix: Remove the trailing spaces/tabs at the end of lines in your favorite editor.

After fixing:

  1. Commit and push the changes
  2. The formatting check will automatically pass

@fixedit-olatz fixedit-olatz force-pushed the add-event-management-files branch 2 times, most recently from dc64e55 to 287917c Compare November 7, 2025 15:07
This commit adds configuration and helper files for event support in the time-in-area example.
These files will monitor AOA detections and send a stateful event when a detection has been in the monitored zone for too long (expressed as active=1), as well as when the detection leaves the monitored area (expressed as active=0).
@fixedit-olatz fixedit-olatz force-pushed the add-event-management-files branch from 287917c to 77c6dc0 Compare November 7, 2025 21:48
@sonarqubecloud
Copy link

sonarqubecloud bot commented Nov 7, 2025

@daniel-falk daniel-falk marked this pull request as ready for review November 13, 2025 11:02
@daniel-falk daniel-falk merged commit 3ffb092 into feature/time-in-area-example Nov 13, 2025
5 of 6 checks passed
@daniel-falk daniel-falk deleted the add-event-management-files branch November 13, 2025 11:02
# to two processors
alerting_metric_two = deepcopy(metric)
alerting_metric_two.name = "alerting_frame_two"
return [alerting_metric, alerting_metric_two]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Violates Single Metric Return Convention (Bugbot Rules)

The apply function returns a list of metrics [alerting_metric, alerting_metric_two], but the reviewer explicitly stated this approach is buggy and there's no need to return more than one metric. Telegraf's Starlark processor may not properly handle list returns, and this pattern isn't used anywhere else in the codebase where all processors return either a single metric or None.

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants