Skip to content

How to Build an Alert System for When Proxy Traffic Runs Low

A proxy job that silently runs out of traffic fails at the worst moment. This guide shows how to track usage, set thresholds and send alerts that people act on.

9 min readUpdated Nov 14, 2026By XPASS Editorial Team

How to Build an Alert System for When Proxy Traffic Runs Low

Few problems are as avoidable and as annoying as a proxy job that stops halfway because the traffic ran out. The job fails at an inconvenient time, the data set has a gap, and someone has to scramble to top up or reschedule. Most of the time nothing technical went wrong: nobody was watching the number. A small alert system fixes that. It does not need to be sophisticated, and you can build the first version in an afternoon.

This guide explains how to design one. We will cover what to measure, where to get the numbers, how to choose thresholds, how to project when traffic will run out, how to send messages people actually read, and what to do when an alert fires. It assumes you are running lawful data collection against public sources and respecting the rules of each target site.

What you are actually monitoring

An alert system is only as good as the signals it watches. For a traffic allowance, there are four useful signals:

  • Used traffic: the amount consumed so far in the current period.
  • Remaining traffic: the allowance minus used traffic, which is what most people look at first.
  • Burn rate: how much is consumed per hour or per day, usually averaged over a recent window.
  • Projected exhaustion: the date and time when remaining traffic reaches zero if the current burn rate continues.

The fourth signal is the most helpful for decisions. Saying "30 percent remaining" does not tell you whether you have two weeks or two hours. Saying "at the current rate, traffic runs out in about two days" does. If you have not yet estimated how much your jobs consume, start with the guide on calculating traffic from API responses; a good estimate gives you a baseline to compare the real numbers against.

Where to get the numbers

You have two sources, and the strongest setup uses both.

  1. Provider-side usage. Look at what your provider's account page or tools expose. Some services show usage in a dashboard, and some offer a way to read it programmatically. Because this is the figure that counts against your allowance, it is the authoritative number. Check the product page and the account area to see what is available; do not assume a particular feature exists.
  2. Your own counters. Add counting to your collection code. Each time a response arrives, add the byte length of the body and headers to a counter keyed by job name and date. This is not identical to the provider's figure, because of protocol overhead and rounding, but it is available in real time and can be broken down per job.

Using both lets you cross-check. If your counters say a job used a small amount but the provider's total jumped, something else is using the allowance, such as another job or a forgotten script. Per-job counters also tell you which job to pause when a threshold is reached.

Store the counters somewhere durable: a small database table, a time-series store, or even a file for a first version. A simple table with columns for timestamp, job, bytes and requests is enough.

Choose thresholds that give you time

Thresholds should reflect how long it takes you to respond, not just a percentage. A job that consumes the allowance in a week needs earlier warnings than one that consumes it over a month.

A common pattern uses three levels:

Level Purpose Typical action
Notice Early heads-up that usage is on track to be high Review the projection, no urgency
Warning Allowance is getting low relative to the time left in the period Decide whether to reduce usage or add more
Critical Exhaustion is near Pause non-essential jobs, act immediately

The percentages are yours to choose. A practical way is to work backwards. Decide how many hours you need to react, for example to approve a purchase or change a schedule, then set the warning level so that at the current burn rate you still have at least that many hours left. The critical level should leave only enough time for the quick actions you can take on your own, such as pausing jobs.

Also consider time-based alerts that do not depend on percentages. For example, "projected exhaustion is before the end of the billing period" is a clear and meaningful condition regardless of the allowance size.

A compact worked example of the threshold logic, again with illustrative values: your reaction time is 24 hours, and the allowance has 10 GB left. At a burn rate of 1 GB per hour you have 10 hours, which is already below your reaction time, so the alert is critical. At 0.2 GB per hour you have 50 hours, so a warning is enough. The same remaining amount produces different urgency, which is why a projected time left is a better trigger than a fixed percentage. Recompute the projection after every collection cycle, and write down the reaction time you assumed, so that anyone reviewing an alert later can see why it fired when it did.

Project the exhaustion date

Projection is simple arithmetic and gives alerts their power.

  1. Pick a window, such as the last 24 hours or the last 7 days.
  2. Compute the average consumption per hour over that window.
  3. Divide remaining traffic by that rate to get hours left.
  4. Compare hours left with the time until the end of the period, and with your reaction time.

For example, suppose 40 GB of an allowance remains and the last 24 hours averaged 2 GB per day. That gives roughly 20 days left. If the period ends in 10 days, you are fine. If the average climbs to 6 GB per day, you have about 7 days left and should be warned. These numbers are only an illustration of the method.

Choose the window with care. A very short window reacts quickly but is noisy: one large batch can look like a permanent trend. A long window is smooth but slow to notice a change. Many teams compute two projections, a short one and a long one, and alert when either one crosses the threshold.

Build the first version

You can build a working alert system with very few parts.

  1. A collector. A scheduled task, such as a cron job, that reads usage from the provider (if available) and from your own counters every few minutes or hourly.
  2. A store. A table with timestamp, source, job name and cumulative bytes.
  3. A rule evaluator. A script that computes remaining traffic, burn rate and projected exhaustion, then compares each with the thresholds.
  4. A notifier. Code that sends a message to email, chat or a ticketing system when a rule triggers.
  5. A state record. A small record of which alerts have already fired in this period, so you do not repeat them.

Pseudo-steps for the evaluator:

  • Read the latest cumulative usage and the usage from one hour and 24 hours ago.
  • Compute the burn rate for both windows.
  • Compute remaining traffic and projected hours left for both rates.
  • For each level, check the condition. If it is true and has not fired in this period, send the alert and record it.
  • If usage resets at the start of a new period, clear the state record.

If your collection jobs run in short-lived functions, remember that counters stored in memory disappear after each run. Write counts to durable storage at the end of every invocation. The article on using proxies with serverless functions covers other practical issues in that environment.

Write alerts people act on

A good alert answers four questions in a few lines: what happened, how bad is it, what is likely to happen next, and what should I do. Compare these two messages.

Poor: "Proxy traffic at 85%."

Better: "Proxy traffic warning: 85% of the allowance used with 9 days left in the period. At the 24-hour burn rate it will run out in about 3 days. The product-price job accounts for most of the usage. Options: reduce its schedule, enable response caching, or add more traffic from the proxy page."

Include the following in each alert:

  • The level and the time.
  • Used and remaining traffic, and the burn rate.
  • The projected exhaustion time.
  • The top consumers, by job.
  • A link to the dashboard or runbook.

Route messages sensibly. Notice-level messages can go to a chat channel or a daily digest. Critical messages should reach the on-call person through a channel they will see quickly. Avoid sending every level to every channel; people learn to ignore noisy channels.

What to do when an alert fires

An alert is useful only if there is a plan. Write a short runbook with these steps:

  1. Open the dashboard and confirm the numbers.
  2. Identify the top-consuming jobs from your per-job counters.
  3. Check for abnormal behaviour: a retry loop, a job running more often than intended, or a target site returning much larger responses.
  4. Decide on a response: pause non-critical jobs, lower the frequency, reduce the amount of data per call, or add more allowance through the proxy page.
  5. After the incident, record what happened and adjust the thresholds if they fired too late or too early.

An automatic response can help for critical situations. For example, the evaluator can set a flag that makes non-essential jobs skip their next run. Automated pausing should be conservative and reversible, and it should send a message saying what it did.

Limits and what to watch for

  • Delayed provider data. Usage figures shown by a provider may lag behind real usage. Do not rely on them alone for critical decisions; your own counters fill the gap.
  • Counting differences. Your counters and the provider's may differ because of overhead and rounding. Calibrate by comparing them over a few days, and apply the ratio when you set thresholds.
  • Spikes versus trends. A single large job can distort projections. Look at more than one window before concluding that something is wrong.
  • Alert fatigue. Too many alerts teach people to ignore them. Keep the levels few, send each alert once, and review thresholds regularly.
  • Single points of failure. If the alert system itself stops, you are blind. Add a heartbeat that notifies you when no usage data has been recorded for a while.
  • Responsible use. Alerts help you control cost and load, but they do not change your obligations. Keep collecting only public data within the target site's terms and applicable law. If you are new to this, read the introduction to web scraping and public data first.

Summary

A low-traffic alert system tracks used and remaining traffic, burn rate and projected exhaustion, using both provider-side figures and your own per-job counters. Choose a few thresholds based on how long you need to react, project when traffic will run out, and write messages that state what happened and what to do. Keep a short runbook, avoid alert fatigue, and add a heartbeat so the monitor itself is monitored. When you are ready to compare how traffic is offered and metered, take a look at the proxy page.

Frequently asked questions

At what percentage should a low-traffic alert fire?

There is no universal number. Many teams use two or three levels, such as a warning when about half the allowance is used and an urgent alert at a much higher level. Choose levels that give you enough time to react given how fast your jobs consume traffic.

Should I alert on remaining traffic or on burn rate?

Both are useful. Remaining traffic tells you where you stand, while burn rate tells you how long it will last. An alert that projects the date of exhaustion is usually more actionable than a plain percentage.

How do I get usage numbers to alert on?

Check what your provider's dashboard or account tools expose, and also keep your own counters in your collection code. Your own counters let you alert per job, even if the provider only shows an account total.

How can I avoid alert fatigue?

Limit the number of levels, send each alert once per threshold, route urgent messages to a different channel from routine ones, and review thresholds after every incident.

About the author

Bob Kanokphon Thongdee, founder of XPASS VPN

Bob Kanokphon Thongdee

  • Founder of XPASS VPN
  • Co-founder of eSIMonline.asia
  • More than 7 years in online marketing
  • Founder of Cojourney Visa and Cojourney Travel

Need a proxy for this?

XPASS Proxy sells residential proxy traffic by the gigabyte, with the price shown before you pay.

See proxy plans

Keep reading

Proxy Guides

How to Calculate Proxy Traffic from API Responses in Data Collection Jobs

Proxy traffic is measured in bytes, not requests. This guide shows how to measure API responses, add overhead and retries, and build a realistic traffic estimate.

9 min read

Proxy Guides

What Is Web Scraping, and How to Start with Public Data

Web scraping means collecting data from web pages with software. This guide explains how it works and how to start responsibly with public data and polite requests.

10 min read

Proxy Guides

Using a Proxy with Serverless Functions Without Timeouts

Serverless functions have strict time limits, and a proxy adds another hop. This guide explains how to plan time budgets, split jobs, retry safely and keep proxy calls inside the limit.

10 min read