feat(insights): add getElementStats to MaestroProcesses and Cases [PLT-102911]#416
Conversation
|
Two issues found this run:
The implementation itself looks clean: delegation pattern (CaseInstances -> ProcessInstances) is correct, |
e5ebc19 to
74c05fc
Compare
|
Two new findings this run:
|
|
Two items from this run:
|
|
New finding this run:
|
|
Two new findings this run (all prior issues were addressed):
|
41cd94e to
43ad4d7
Compare
|
New finding this run:
|
|
Two previously-resolved threads re-opened because the requested changes were not applied:
|
|
✅ No issues found. Checked for bugs and CLAUDE.md compliance. |
|
New finding this run:
|
|
✅ No issues found. Checked for bugs and CLAUDE.md compliance. |
1 similar comment
|
✅ No issues found. Checked for bugs and CLAUDE.md compliance. |
|
1 new finding this run: Both new |
…aseInstances Add Insights RTM endpoint for retrieving per-element execution counts and duration percentile metrics (min, max, avg, p50, p95, p99) for BPMN elements. - Use Date input for startTime/endTime, convert internally via .getTime() - CaseInstancesService delegates to ProcessInstancesService - Extract getElementCountByStatusImpl to avoid double @track - Add JSDoc, type annotations, and trailing newlines PLT-102911 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…tances JSDoc Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Extract mock response data to MAESTRO_TEST_CONSTANTS - Remove redundant error/empty tests from case-instances (delegation-only) - Add shared expectValidElementCountByStatus helper for integration tests Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…on helper Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Removes ProcessInstancesService dependency from CaseInstancesService. Both services now call the shared function directly via their own BaseService.post method. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Fix CaseInstances test descriptions referencing old delegation pattern - Remove isCaseManagement absence test (field was never set) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…and Cases Move getElementCountByStatus from ProcessInstances/CaseInstances to MaestroProcesses/Cases, aligning with other Insights aggregate methods (getTopRunCount, getTopFaultedCount, etc.). - Use positional params instead of options object (all required) - Add bound methods on process/case objects (startTime, endTime, version) - Replace fetchElementCountByStatus with buildElementCountByStatusBody - Add CaseMethods interface and createCaseWithMethods factory for Cases - Update tests: comprehensive in processes, minimal in cases Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Aligns with the packageVersions field on process/case objects. The API body field remains "version" — mapped in buildElementCountByStatusBody. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Move getElementCountByStatus integration tests from instance files to processes/cases integration files - Update helper to match MaestroProcesses/Cases getAll() signature - Fix orphaned extractCaseName JSDoc in cases.ts - Add model tests for bound methods (processes.test.ts, cases.test.ts) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Skip integration tests (insightsrtm_ requires OAuth, not PAT) - Remove out-of-scope getIncidents model tests - Keep only success test for cases (minimal pattern) - Fix stale @returns JSDoc on CasesServiceModel.getAll Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…s and Processes Co-authored-by: Shreyash <ninja-shreyash@users.noreply.github.com>
caf44bb to
893788b
Compare
|
✅ No issues found. Checked for bugs and CLAUDE.md compliance. |
Rename public method and type for brevity: - getElementCountByStatus() → getElementStats() - ElementCountByStatus → ElementStats - Internal names unchanged (endpoint constant, body builder, API path) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
✅ No issues found. Checked for bugs and CLAUDE.md compliance. |
|



Method Added
maestroProcesses.getElementStats()getElementStats(processKey: string, packageId: string, startTime: Date, endTime: Date, packageVersion: string): Promise<ElementStats[]>cases.getElementStats()getElementStats(processKey: string, packageId: string, startTime: Date, endTime: Date, packageVersion: string): Promise<ElementStats[]>process.getElementStats()getElementStats(startTime: Date, endTime: Date, packageVersion: string): Promise<ElementStats[]>case.getElementStats()getElementStats(startTime: Date, endTime: Date, packageVersion: string): Promise<ElementStats[]>Endpoint Called
getElementStats()/insightsrtm_/agenticInstanceStatus/ElementCountByStatusInsights.RealTimeData Insights OR.Folders.ReadbuildElementCountByStatusBody()helper insrc/services/maestro/insights.tsconstructs the request bodyMaestroProcessesServiceandCasesServicecallthis.post()directly (no delegation between services)processKeyandpackageIdfrom the entityExample Usage
API Response vs SDK Response
Transform pipeline
No transform — response is returned as-is from the API (`data ?? []`).
Request body mapping
Sample SDK Response
getElementStats()```json
[
{
"elementId": "Event_wYlKnG",
"successCount": 1,
"failCount": 0,
"terminatedCount": 0,
"pausedCount": 0,
"inProgressCount": 0,
"minDurationMs": 652,
"maxDurationMs": 652,
"avgDurationMs": 652,
"p50DurationMs": 652,
"p95DurationMs": 652,
"p99DurationMs": 652
},
{
"elementId": "Activity_Ii3Yl0",
"successCount": 1,
"failCount": 0,
"terminatedCount": 0,
"pausedCount": 0,
"inProgressCount": 0,
"minDurationMs": 8702,
"maxDurationMs": 8702,
"avgDurationMs": 8702,
"p50DurationMs": 8702,
"p95DurationMs": 8702,
"p99DurationMs": 8702
}
]
```
Files
Refs PLT-102911