feat(inventory): add metric history dashboards
Heimdall Gitea / Build and tests (pull_request) Failing after 3m28s
Heimdall Gitea / Build and scan server image (pull_request) Skipped
Heimdall Gitea / Build and scan agent image (pull_request) Skipped
Heimdall Gitea / Publish Docker Hub latest tags (pull_request) Skipped
Heimdall Gitea / Publish versioned release (pull_request) Skipped

This commit is contained in:
Arnaud Dartois committed 2026-10-25 02:19:01 +02:00
1 parent 9cf995383f
commit c8c84f0e2c
24 files changed
+841 -1

No files matched your search

@@ -7,6 +7,7 @@ using Heimdall.Application.Agents.Queries.GetAgentsBySite;
using Heimdall.Application.Agents.Queries.GetAllAgents;
using Heimdall.Application.AgentLogs.Commands.SubmitAgentLogs;
using Heimdall.Application.AgentLogs.Queries.GetAgentLogs;
using Heimdall.Application.Inventory.Queries.GetAgentMetricHistory;
using Heimdall.Application.Cameras.Commands.ReportCameraStatus;
using Heimdall.Application.DTOs;
using Heimdall.Domain.Enums;
@@ -218,6 +219,18 @@ public class AgentsController : ControllerBase
return Ok(result.Data);
}
/// <summary>Get bounded historical metrics for an Agent.</summary>
[Authorize(AuthenticationSchemes = "JwtBearer,Cookies", Policy = AppPermissions.SiteRead)]
[HttpGet("{id:guid}/metrics/history")]
[ProducesResponseType(typeof(IReadOnlyList<AgentMetricHistoryPoint>), StatusCodes.Status200OK)]
public async Task<IActionResult> GetMetricHistory(Guid id, [FromQuery] string range = "24h", CancellationToken ct = default)
{
var result = await _mediator.Send(new GetAgentMetricHistoryQuery(id, range), ct);
if (!result.IsSuccess)
return StatusCode(result.StatusCode ?? 400, new { error = result.Error });
return Ok(result.Data);
}
/// <summary>List all agents across all sites.</summary>
[Authorize(AuthenticationSchemes = "JwtBearer,Cookies", Policy = AppPermissions.SiteRead)]
[HttpGet]