Actors Monitoring avatar

Actors Monitoring

Under maintenance

Pricing

Pay per usage

Go to Apify Store
Actors Monitoring

Actors Monitoring

Under maintenance

Pricing

Pay per usage

Rating

0.0

(0)

Developer

Hamza Alwan

Hamza Alwan

Maintained by Community

Actor stats

0

Bookmarked

3

Total users

2

Monthly active users

7 days ago

Last modified

Categories

Share

Actor Monitoring System

A monitoring and reporting Actor for Apify Actors and Tasks. Compare recent runs to detect regressions, or generate multi-sheet Excel reports over configurable time periods.

For a stakeholder overview see README-business.md. For full technical coverage see README-mixed.md. For architecture and process flows see Process.md. For field strategies and custom dimensions see FIELD_COMPARISON_AND_CUSTOM_DIMENSIONS_GUIDE.md. For copy-paste inputs and local smoke testing see examples/README.md.

Features

  • Run comparison with multiple strategies (last2, lastVsBaseline, lastVsAverage, or explicit run IDs)
  • Monthly Excel reports with executive dashboard, metrics, aggregation, exceptions, and cost breakdown
  • Intelligent field comparison with 25 strategies and automatic strategy detection
  • Email alerts — consolidated or per-comparison, with significance filtering and health-check fallback
  • Status alerts for non-successful latest runs
  • Trend and anomaly analysis over historical runs
  • Monitoring state to avoid duplicate alerts across scheduled runs
  • Flexible output routing — email, dataset-only, or both
  • Webhooks, compare Excel export, and HTML dashboard artifacts
  • Client billing — optional pricePerItem adds Total Billed and Margin alongside Apify cost in Excel, email, and dataset

Architecture

main.ts validates input, builds config, and delegates to services created by ServiceFactory:

ServiceRole
InputValidatorZod validation and email filtering
DataFetcherServiceRun collection orchestration
RunCollectionServiceActor/task discovery and concurrent fetching
ComparisonServiceComparisons, significance filtering, emails
EnrichmentServiceRun enrichment and actor name caching
ReportServiceMonthly report pipeline
EmailServiceHTML email generation
StorageManagerKV store artifacts
AppLoggerStructured logging

Report Types

Compare Mode (actorMode: "compare")

Detects meaningful changes between runs at two levels:

  • Run-level: items count, runtime, cost, memory, CPU
  • Dataset-level: per-field analysis using fieldsAndCompareStrategy

Compare strategies (compareMode):

StrategyDescription
last2Latest vs previous run (default)
lastVsBaselineLatest vs a fixed baselineRunId
lastVsAverageLatest vs average of baselineRunCount recent runs
Explicit IDscompareRunId1 + compareRunId2 bypasses discovery

Email delivery:

  • combineEmails: true (default) — one email with all comparisons
  • combineEmails: false — separate email per comparison
  • notifyOnSignificantChange — email only when thresholds are exceeded
  • alwaysSendSummary — health-check email when nothing significant changed

Monthly Mode (actorMode: "monthly")

Generates a multi-sheet Excel workbook for a configurable period (1–24 months, default 3) or custom date range.

Excel sheets:

  • Executive Dashboard (KPIs, period diff, health rankings, trends)
  • Aggregated Metrics, Aggregated Insights
  • Failed Runs / Succeeded With 0 Items (when applicable)
  • Resource Usage, Threshold Breaches
  • All Runs, Category sheets, Cost Breakdown, Contents

Also produces categorized runs JSON, report manifest, optional product aggregation, and monthly email.

Client billing (pricePerItem)

Set a global USD rate per scraped item to show Total Billed (items × price) and Margin (billed minus Apify cost) in monthly Excel, email, dataset summary, and compare reports. Leave unset to disable billing columns (default). Example: examples/16-client-billing.json.

Intelligent Field Comparison

Automatic Strategy Detection

When no strategy is configured, the system analyzes data types, distributions, and field names to select the best comparison approach.

User-Defined Strategies

{
"actorMode": "compare",
"fieldsAndCompareStrategy": {
"product.price": "average",
"reviews": "array_length",
"product.description": "coverage",
"total_sales": "sum"
}
}

Each field can also use an extended object: { "strategy": "average", "label": "Avg Price", "lowerIsBetter": false, "threshold": { "warning": 10, "critical": 25 } }.

Available Strategies

CategoryStrategies
Basiccount, sum, average, array_length, coverage, distinct_count, boolean_rate
Statisticalmin, max, median, percentile_95, percentile_99, variance, stddev, range, iqr
Advancedset_difference, set_overlap, deep_equality, avg_length, null_rate, mode, completeness, uniqueness, ratio

Strategy Priority

  1. User-defined strategy in fieldsAndCompareStrategy
  2. Automatic detection from data characteristics
  3. Field discovery report saved to KV as field-discovery-report.v2.{entity} when no config is provided

Configuration

Core Input Parameters

ParameterTypeDefaultDescription
actorModestringmonthlycompare or monthly
useDirectActorRunsbooleanfalseFetch runs from actors directly (ignores task filters)
outputModestringemailemail, dataset, or both
compareModestringlast2last2, lastVsBaseline, lastVsAverage
compareRunId1 / compareRunId2stringExplicit run pair (overrides discovery)
baselineRunIdstringRequired for lastVsBaseline
baselineRunCountinteger5Runs to average for lastVsAverage (2–20)
monthsToAnalyzeinteger3Calendar months for monthly reports (1–24)
includeCurrentMonthbooleantrueInclude in-progress month
dateRangeStart / dateRangeEndstringISO dates; override month window
maxRunsinteger100Max runs per actor/task (1–50000)
maxDatasetItemsinteger1000Dataset items per run for field comparison
combineEmailsbooleantrueConsolidate comparison emails
notifyOnSignificantChangebooleantrueEmail only on significant changes
alwaysSendSummarybooleanfalseHealth-check when no significant changes
significanceThresholdnumber5Min % change to flag significance
enableTrendAnalysisbooleanfalseMulti-run trend analysis
enableAnomalyDetectionbooleanfalseZ-score anomaly detection
enableCompareExcelbooleanfalseExport compare Excel to KV
enableAggregationbooleantrueProduct volume aggregation in monthly
saveHtmlDashboardbooleanfalseSave monthly HTML to KV
webhookUrlstringPOST JSON on report completion
dryRunbooleanfalseSave email HTML to KV instead of sending
emailRecipientsarray[]Report recipients
fieldsAndCompareStrategyobjectPer-field comparison strategies; omit to enable field auto-discovery (do not pass {}; runtime normalizes empty object to unset)
excludeFieldsarray[]Fields to skip in comparison
alertThresholdsobjectWarning/critical tiers per metric
customDimensionsarrayMonthly grouping dimensions (max 5)
topNActorsinteger5Top actors in monthly rankings
healthScoreWeightsobjectMonthly health score weights (must sum to 1.0)
actorNameInclude / ExcludearrayActor name substring filters
actorNamePatternstringActor name regex (overrides substrings)
taskNameInclude / ExcludearrayTask name filters (ignored when direct actor runs)
taskNamePatternstringTask name regex
actorIdsarrayExplicit actor IDs (8–64 alphanumeric; skip discovery)
monthlyFilterStatusarrayall statusesStatus filter for monthly mode
compareFilterStatusarraySUCCEEDEDStatus filter for compare mode
emailSubjectstringTemplate: {mode}, {date}, {actorCount}, {status}
emailSectionsobjectall trueToggle email sections
emailFooterTextstringCustom footer
concurrencyLimitinteger5Parallel actor/task processing (1–20)
circuitBreakerThresholdinteger3Abort after consecutive collection failures (1–50)
tokenstringOptional Apify API token
debugbooleanfalseVerbose logging

Configuration Examples

Copy-paste inputs for fifteen real-world scenarios live in examples/ (task-based pg- portfolio, explicit run IDs, monthly date ranges). Refresh run fixtures with npm run discover:examples.

ScenarioExample file
Daily production compareexamples/01-daily-production-monitoring.json
Incident / explicit runsexamples/04-incident-investigation.json
Field auto-discoveryexamples/12-field-discovery-auto-config.json
Average baseline compareexamples/13-compare-average-baseline.json
Monthly date-range exportexamples/15-monthly-date-range-export.json

Minimal starting points:

{ "actorMode": "monthly" }
{
"actorMode": "compare",
"useDirectActorRuns": false,
"actorNamePattern": "pg-",
"taskNameInclude": ["amazon-de"],
"maxRuns": 2,
"dryRun": true
}

Direct Actor Runs vs Task-Based

Direct Actor Runs (useDirectActorRuns: true)

  • Monitors all runs from matching actors regardless of task.
  • Task filters are ignored.
  • Best for actor-level performance monitoring.

Task-Based (useDirectActorRuns: false — default)

  • Organizes monitoring by tasks.
  • Supports task name include/exclude/pattern filters.
  • Best for task-category analysis.

Custom Dimensions (Monthly)

Group runs by any field path with optional transforms and buckets:

{
"customDimensions": [
{ "field": "actorName", "label": "Actor", "fallback": "Unknown" },
{ "field": "status", "label": "Status", "transform": "successFailure" },
{
"field": "stats.runTimeSecs",
"label": "Runtime Bucket",
"buckets": [
{ "max": 60, "label": "< 1 min" },
{ "max": 300, "label": "1–5 min" },
{ "label": "> 5 min" }
],
"sort": "count"
}
]
}

Data Flow

graph TD
A[Input] --> B[Validate + buildConfig]
B --> C[ServiceFactory]
C --> D{actorMode}
D -->|compare| E[RunCollectionService]
E --> F[ComparisonService buffer]
F --> G[flushCompareOutputs dataset rows]
G --> H[Compare Excel + manifest KV]
H --> I[finalizeCompareNotifications emails]
I --> J[Optional Webhook]
D -->|monthly| K[RunCollectionService]
K --> L[categorizeRuns]
L --> M[ExcelReportBuilder]
M --> N[KV Artifacts + Manifest]
N --> O[Monthly Email / Webhook]
N --> P[Dataset Metadata]

Email Reports

Compare Email Sections

  • Executive summary cards
  • Comparison table with unified delta styling and run links
  • Report artifact links (dataset, manifest, compare Excel when generated)
  • Top regressions, build changes, schema changes
  • Cost breakdown; trend analysis and anomaly detection in collapsible Technical details
  • Field discovery suggestions (when no strategy configured)
  • Status alerts for failed latest runs

Monthly Email Sections

  • KPI grid, executive summary, watchlist
  • Period-over-period diff (when prior report exists)
  • Monthly trends and product volume aggregation
  • Artifact download links

Health-Check Email

Sent when alwaysSendSummary is true and no significant changes were detected. Confirms monitoring scope and all-clear status.

Outputs

OutputCompareMonthly
Dataset comparison/monthly records
Performance metrics
last-report-summary (KV)
compare-manifest.v1 (KV)
field-discovery-report.v2.* (KV)
Excel workbookoptional
Emailoptionaloptional
Webhook (with retry)optionaloptional
monitoring-state (KV)
HTML dashboard (KV)optional

Performance

  • Parallel processing with configurable concurrency (concurrencyLimit, default 5)
  • Circuit breaker after consecutive collection failures (circuitBreakerThreshold, default 3)
  • Paginated API fetching with retry for transient errors
  • Bounded dataset item fetching (maxDatasetItems)

Examples and Local Smoke Testing

Fifteen task-based examples using real pg- portfolio filters live in examples/. Refresh Apify run fixtures and batch-test locally:

npm run discover:examples # writes examples/_fixtures.json (gitignored)
npm run test:examples:smoke # runs all 15 examples (~5 min)

See examples/README.md for per-example bindings and pass criteria.

Deployment

Build and push to Apify, then run with token in Actor secrets (not committed input):

npm run build
apify push
apify actor run actors-monitoring --input-file examples/12-field-discovery-auto-config.json

Verify KV artifacts: field-discovery-report.v2.*, compare-manifest.v1, last-report-summary.

Troubleshooting

IssueLikely causeAction
No email receivedNo recipients, significance filter, or outputMode: datasetCheck emailRecipients, notifyOnSignificantChange, outputMode
Partial reportCircuit breaker trippedCheck logs for failed actors/tasks; increase threshold or fix API access
Duplicate alertsMonitoring state not persistingVerify KV store access; avoid explicit run ID mode for scheduled monitoring
Slow runsHigh maxRuns / maxDatasetItemsReduce volume limits or narrow filters