Skip to main content
Altcraft Docs LogoAltcraft Docs Logo
User guide iconUser guide
Developer guide iconDeveloper guide
Admin guide iconAdmin guide
English
  • Русский
  • English
Login
    Getting StartedAdministrator documentationFunctional characteristics
      Technology descriptionarrow
    • Architecture OverviewComponent Description
        Deployment schemesarrow
      • Basic schemeFail-safe schemeTypical Placement in Infrastructure
    System requirements
      Admin Panelarrow
      • Account areaarrow
        • Accountsarrow
        • Account UsersAccount Virtual SendersAccount Database Indexes
        TariffsExternal data configurationLDAPTasksSchedule JobsGlobal Stop ListsWebversion Store PoliciesIn-App Storage Settings
        Settingsarrow
      • Databases
          Accessarrow
        • AdminsAPI tokens
        Notifiers
          MTAarrow
        • Default rulesRetry rulesLock rulesBounce patternsStrategiesKeysISPsPools
      Nodes
        Sendersarrow
      • EmailSMSEvent generatorIntegration with Altcraft Cloud SMTPAmazon SES integrationIntegration with Sendsay
        Reportsarrow
      • Audit JournalData Usage
        Toolsarrow
      • ARF decoderURL decoderSMID decoderLicense
      Platform installationarrow
    • Automatic installationManual installationRunning the platform in a Docker container
      Platform configurationarrow
    • Configuration fileDomain settingsLDAP access configurationSending Email via SMTP relayPixel and push domain configurationCluster and Replication SetupSystem notifications configurationProcesses UNIX sockets configurationHTTPS ConfigurationMigrating from MongoDB Community to Percona ServerAdding sender IP addressesData Encryption in Percona Server for MongoDBDeduplication request settingsBackup with Percona Backup for MongoDBPostgreSQL database for Market dataProxy server settingsKeycloak Integration with AltcraftGetting HTTP service statusesConfiguring MongoDB log rotation
        Configuration of system constants and directoriesarrow
      • Filtering bot actionsDirectory of gender markers
      Custom Channelsarrow
    • Creating a Channel
        Pipelinesarrow
      • MessageScheduleListenerModerateStop
          Pipesarrow
        • HTTP RequestPackUnpackEventerSchedulerSelectorSQLStore SetStore GetLogResultErrorRMQ Publisher
      External Objects (Entities)Templating LanguageSending FilesPresets (Field Sets)DebuggingTechnical Limitations
      Platform maintenancearrow
    • Personnel requirementsPlatform maintenance processesPlatform updatingBackup and recoveryTransferring the platform to a new serverCreating, deleting, and populating tables for statistics in ClickHouseUsing the aktool utilityUsers and directories engaged by the platformEvent Processing Monitoring (procevent)Platform service monitoringProcess and mailing monitoring via Prometheus
      Extraarrow
    • System page customizationSend Message IDClickHouse History Migration GuideInstructions for migrating history to ClickHouseUtility for importing push subscriptions to Firebase projectUtility for importing push subscriptions to Firebase projectENS: настройка интеграции
    Processing HTTP/HTTPS traffic
      Administrator APIarrow
      • Accounts admin apiarrow
        • Restricted accessarrow
        • Account Activation and DeactivationAccount Freeze and Unfreeze
        Get accounts listAdd a new accountDelete the account
        Account usersarrow
      • Update an Existing AccountAdd a new userDelete a userGet a list of usersSending a Welcome Email
        Nodesarrow
      • Synchronize node MTA configurationGet nodes listGet node MTA statusActivate node MTADeactivate node MTA
        Senders admin apiarrow
      • Create or update AKMTA senderGet AKMTA sender informationAssign account to senderGet senders listDelete senderRestore sender
          Sender queuearrow
        • Get sender queue informationHold sender queueRelease sender queueClear sender queue
        Virtual sendersarrow
      • Get virtual senders listGet virtual sender informationCreate virtual senderUpdate virtual senderClone virtual senderDelete virtual sender
    Documentation Archive
  • Platform maintenance
  • Event Processing Monitoring (procevent)

Event Processing Monitoring (procevent)

procevent is the Altcraft process that handles events (clicks, opens, deliveries, hooks, and others) arriving via the ak_proc_event RabbitMQ queue. The process supports Prometheus metrics, batch processing mode, and batch event insertion into ClickHouse — tools for diagnosing and optimizing performance under high load.

Metrics setup​

To enable procevent metrics, add the process to the PROMETHEUS_METRICS.PROCESSES list and specify the host and port of the metrics HTTP server:

{
"PROMETHEUS_METRICS": {
"ENABLE": true,
"PROCESSES": ["procevent"]
},
"PROC_EVENT_METRIC_HOST": "0.0.0.0",
"PROC_EVENT_METRIC_PORT": 8916
}
ParameterTypeDefaultDescription
PROC_EVENT_METRIC_HOSTstringlocalhostHost of the Prometheus metrics HTTP server
PROC_EVENT_METRIC_PORTint8916Port of the Prometheus metrics HTTP server

Add a scrape job to the Prometheus configuration:

scrape_configs:
- job_name: 'procevent'
metrics_path: /metrics
static_configs:
- targets:
- '<procevent-server>:8916'

All metrics use the altcraft_procevent_ prefix.

Available metrics​

Duration metrics​

MetricTypeLabelsWhat it measures
event_processing_duration_secondsHistogramgroupTotal time to process an event, from RabbitMQ delivery to the batch writer write
find_lead_duration_secondsHistogram—MongoDB lookup on lead cache miss
unique_action_duration_secondsHistogramaction_typeUnique action insert (delivery or popup dedup)
hook_check_duration_secondsHistogram—Hook existence check in the action cache
hook_send_duration_secondsHistogramhook_groupSending a hook action to actionSender (blocks if the queue is full)
mongo_update_send_duration_secondsHistogram—Sending a profile update to the mgoUpdater channel (blocks if the channel is full)
ssdb_hb_send_duration_secondsHistogram—Sending a heartbeat to the ssdbHBSupp channel (blocks if the channel is full)
trigger_write_duration_secondsHistogramtrigger_typeWriting a trigger to trigCache
ch_batch_insert_duration_secondsHistogrambatcherInserting a batch into ClickHouse (prepare + exec per event + commit)
ch_insert_send_duration_secondsHistogrambatcherSending an event to the batch writer insertChan (blocks if the channel is full)
ch_batch_sizeHistogrambatcherBatch size at flush time
ack_call_duration_secondsHistogram—Time spent in the consumer.Ack() call (RabbitMQ acknowledgment)
cache_refresh_duration_secondsHistogramcacheTime spent refreshing cache data from MongoDB

Counters​

MetricTypeLabelsWhat it counts
events_processed_totalCountergroup, resultProcessed events by group and result (ok / error / retry)
lead_cache_lookup_totalCounterresultLead cache lookups (hit / miss)
gcg_cache_lookup_totalCounterresultgcg cache lookups (hit / miss)
hook_check_totalCounterresult, event_typeHook checks (hit / miss) by event type
custom_channel_lookup_totalCounterresultCustom channel cache lookups (hit / miss)
hook_send_totalCounterhook_groupHook actions sent by group
trigger_writes_totalCountertrigger_typeTriggers written by type
unique_action_duplicates_totalCounteraction_typeDuplicates on unique action insert (expected dedup, not an error)
rmq_events_totalCounterqueueEvents consumed from RabbitMQ
rmq_nack_totalCounterqueueEvents returned to RabbitMQ (nack, will be retried)
ch_tx_retries_totalCounterbatcherClickHouse transaction retries (reconnection attempts)
ch_event_errors_totalCounterbatcherPer-event exec failures during ClickHouse batch insert
ch_commit_errors_totalCounterbatcherClickHouse transaction commit failures

Batch processing mode​

Batch mode collects messages from the queue into batches of up to 4000 events and processes them as a group.

Disabled by default: false

ParameterTypeDefaultDescription
PROC_EVENT_ENABLE_RMQ_BATCH_MODEboolfalseEnables batch processing mode for events

Enabling changes the processing pipeline:

  • Default (stable mode): each event is processed individually: queue → 1 event → processing → write to the insertChan → asynchronous batch insertion into ClickHouse.
  • Batch mode: messages are collected into a batch: queue → batch → batch find-lead (1 MongoDB query) → process each event → synchronous batch insert into ClickHouse (1 transaction) → split ACKs.
warning

In batch mode the PROC_EVENT_WORKER_COUNT parameter is ignored — the worker count is forced to 1. Parallelism is achieved only via PROC_EVENT_CONSUME (the number of independent consumers).

Batch mode metrics​

MetricTypeLabelsWhat it measures
batch_events_totalCounterresultEvents processed in batch mode by result
batch_ch_insert_secondsHistogram—Time to insert a batch into ClickHouse
batch_mongo_find_secondsHistogram—Time of the batch find-lead in MongoDB
batch_rmq_collect_secondsHistogram—Time to collect the batch from the queue
batch_ack_secondsHistogram—Time of the split ACKs
batch_sizeHistogram—Batch size
batch_ack_groups_totalCountertypeNumber of ACK/NACK groups
batch_mongo_groups_totalHistogram—Number of batch find groups
batch_mongo_queries_totalHistogram—Number of batch find queries
resolve_lead_totalCountersourceLead source (cache, MongoDB, etc.)

Native ClickHouse batch​

The native batch switches the batch event insertion into ClickHouse from the SQL protocol to the native binary protocol.

ParameterTypeDefaultDescription
PROC_EVENT_ENABLE_NATIVE_BATCHboolfalseSwitches batch event insertion into ClickHouse to the native binary protocol

Mechanism difference:

  • SQL protocol (default): transaction begin → prepare → exec loop per event → commit.
  • Native binary protocol: PrepareBatch → Append → Send (ClickHouse binary protocol) — no per-event exec commands.

Recommended configuration for high load​

Based on load testing:

{
"PROC_EVENT_CONSUME": 4,
"PROC_EVENT_PREFETCH_SIZE": 64000,
"PROC_EVENT_WORKER_COUNT": 8,
"CLICKHOUSE_BATCH_WORKERS_SIZE": 4,
"RMQ_CLICKHOUSE_BLOCK_SIZE": 8000,
"SEGMENT_ACTION_GROUP_OPTIMIZATION": true,
"PROC_PIPER_MESSAGES_PREFETCH_SIZE": 32000,
"PIPE_ROUTER_WORKER_SIZE": 32,
"PIPE_WORKER_SIZE": 64,
"FIREBASE_PUSH_CONSUMER_PREFETCH_SIZE": 16000
}
ParameterTypeDefaultDescription
PROC_EVENT_CONSUMEint1Number of independent queue consumers
PROC_EVENT_PREFETCH_SIZEint-1Consumer prefetch window size
PROC_EVENT_WORKER_COUNTint—Number of processing workers (ignored in batch mode)
CLICKHOUSE_BATCH_WORKERS_SIZEint8Number of ClickHouse batch writer workers
RMQ_CLICKHOUSE_BLOCK_SIZEint—RabbitMQ → ClickHouse block size
SEGMENT_ACTION_GROUP_OPTIMIZATIONboolfalseSegment action grouping optimization
PROC_PIPER_MESSAGES_PREFETCH_SIZEint500Piper messages queue prefetch window
PIPE_ROUTER_WORKER_SIZEint1Number of pipe router workers
PIPE_WORKER_SIZEint1Number of pipe processing workers
FIREBASE_PUSH_CONSUMER_PREFETCH_SIZEint-1Firebase Push consumer prefetch window

Problem diagnostics​

ProblemIndicators
Channel blockinghook_send_duration_seconds p95 > 1 s, mongo_update_send_duration_seconds p95 > 1 s, ssdb_hb_send_duration_seconds p95 > 1 s
MongoDB problemshigh find_lead_duration_seconds p99, low hit rate in lead_cache_lookup_total
ClickHouse problemshigh ch_batch_insert_duration_seconds, growing ch_tx_retries_total, growing ch_commit_errors_total
Batch writer lagch_insert_send_duration_seconds > 0, small ch_batch_size
Throughputrate of events_processed_total broken down by group

Grafana dashboard​

A ready-made Grafana dashboard for procevent metrics is available: procevent-dashboard-en.json.

To import it:

1. Open Grafana → Dashboards → New → Import.

2. Upload the procevent-dashboard-en.json file.

3. Select your Prometheus data source in the Prometheus field.

4. Click Import.

Last updated on Sep 30, 2026
Previous
Users and directories engaged by the platform
Next
Platform service monitoring
  • Metrics setup
  • Available metrics
    • Duration metrics
    • Counters
  • Batch processing mode
    • Batch mode metrics
  • Native ClickHouse batch
  • Recommended configuration for high load
  • Problem diagnostics
  • Grafana dashboard
© 2015 - 2026 Altcraft, LLC. All rights reserved.