monitoring
integrations

getMonitoringStatsV2

Changed on

Get aggregated statistics from the unified erp_monitoring_v2 table. Returns combined metrics for all event types with optional breakdowns.

post/v2/integrations/{integrationId}/monitoring/stats

Request

  • Base URL
    https://integration-toolkit.sls.epilot.io
  • URL
    https://integration-toolkit.sls.epilot.io/v2/integrations/{integrationId}/monitoring/stats
  • Auth
    HTTP bearer

Path parameters

integrationIdstring uuid required

The integration ID

Request body

from_datestring date-time

Start of the time range

to_datestring date-time

End of the time range

correlation_idstring

Count only the events of ONE run. Every span a run produces carries its correlation_id (for a file import, the import_id), so this turns the stats call into an exact per-run readout — no time range to guess at, no pagination, and no 2000-span cap as on /monitoring/traces/{correlationId}. Applies to the monitoring source; the incoming feed is counted per received event and ignores it.

correlation_idsstring[]

Count the events of THESE runs (matches any). Takes precedence over correlation_id when both are present. With group_by=correlation_id this returns one row per run, which is how a list of jobs gets a per-row readout in a single query instead of one call per row.

use_case_type'inbound' | 'outbound' | 'file_proxy' | 'managed_call' | 'secure_proxy'

Filter stats by a single use case type

use_case_typesstring[]

Filter stats to this set of use case types (matches any). Takes precedence over use_case_type when both are present. Used by the notification producers to scope alerts/digests to the integration's monitoredUseCases.

group_by'use_case_id' | 'use_case_type' | 'level' | 'code' | 'correlation_id' | 'date'

Field to group the breakdown by. correlation_id gives one row per run — pair it with correlation_ids to bound the result to the runs on screen.

source'monitoring' | 'incoming'

Data source for the stats. "monitoring" (default) aggregates processed events from erp_monitoring_v2 — this counts every event produced throughout the processing tree (fan-out children, post-actions, relation resolutions, etc.). "incoming" counts only the initial inbound events actually received (distinct event_id from erp_incoming_events); only group_by=use_case_id is supported and status/level breakdown is not available for this source (success/error/warning/skipped counts are returned as 0).

Example request

{
  "from_date": "2025-01-01T00:00:00Z",
  "to_date": "2025-01-31T23:59:59Z",
  "correlation_id": "imp_01M3799K98B6TG7GV7Q2DQT554",
  "correlation_ids": [
    "imp_01M3799K98B6TG7GV7Q2DQT554",
    "imp_01M374YPQ0E7ZB0VYJZSK72M4E"
  ]
}

Response

Monitoring statistics retrieved successfully

total_eventsinteger required

Total number of events in the period

success_countinteger required

Number of successful events

error_countinteger required

Number of error events

warning_countinteger required

Number of warning events

skipped_countinteger required

Always 0. The v2 pipeline has no skipped level; v1 skipped is normalised to info. Retained for backward compatibility — use info_count.

info_countinteger required

Number of info-level events (ACK lifecycle, poll-queue MSG_*, duplicate events, fan-out anchors). Info events are counted in total_events but are excluded from success_rate.

ack_timeout_countinteger

Number of ACK_TIMEOUT events (acknowledgement timed out)

success_ratenumber float

Success rate as percentage (0-100)

last_error_atstring date-time nullable

Timestamp of the most recent error

last_event_atstring date-time nullable

Timestamp of the most recent event of ANY level — "is this still moving?", which is a different question from when it last broke. Null when the filter matched nothing.

breakdownobject[]

Statistics breakdown by requested group_by field

Changes

    • info

      added the non-success response with the status

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new correlation_id enum value to the request property

    • info

      added the optional property to the response with the status