Metrics-Based Alerting Configuration for Web Applications

Our company is engaged in the development, support and maintenance of sites of any complexity. From simple one-page sites to large-scale cluster systems built on micro services. Experience of developers is confirmed by certificates from vendors.

Development and maintenance of all types of websites:

Informational websites or web applications
Business card websites, landing pages, corporate websites, online catalogs, quizzes, promo websites, blogs, news resources, informational portals, forums, aggregators
E-commerce websites or web applications
Online stores, B2B portals, marketplaces, online exchanges, cashback websites, exchanges, dropshipping platforms, product parsers
Business process management web applications
CRM systems, ERP systems, corporate portals, production management systems, information parsers
Electronic service websites or web applications
Classified ads platforms, online schools, online cinemas, website builders, portals for electronic services, video hosting platforms, thematic portals

These are just some of the technical types of websites we work with, and each of them can have its own specific features and functionality, as well as be customized to meet the specific needs and goals of the client.

Showing 1 of 1All 2062 services
Metrics-Based Alerting Configuration for Web Applications
Medium
~2-3 days
Frequently Asked Questions

Our competencies:

Development stages

Latest works

  • image_website-b2b-advance_0.webp
    B2B ADVANCE company website development
    1362
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1253
  • image_websites_belfingroup_462_0.webp
    Website development for BELFINGROUP
    958
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1190
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    931
  • image_bitrix-bitrix-24-1c_fixper_448_0.webp
    Website development for FIXPER company
    949

Alerting without a well-thought-out methodology turns into noise: 200 notifications per night, half of which are 'resolved' in 2 minutes. The team stops responding—and that's when the real problem hits. On one project, we got 150 alerts in an hour due to an incorrectly set CPU threshold. After implementing the burn rate methodology, there were only 5. The goal of configuration is alerts only for situations requiring human action. Properly configured alerting is not just notification; it is a system that allows you to identify problems before they affect users. We have been doing this for over 5 years and have set up monitoring for 50+ web applications—from startups to enterprise. Below is an engineering approach without fluff.

What Metrics to Monitor First?

Start with the four golden signals described in Site Reliability Engineering: latency, traffic, errors, saturation. For a web application, latency (P95), errors (5xx), traffic (RPS), and saturation (CPU, memory) are sufficient. Additionally, queue length, SSL certificate, and business metrics (conversion, registrations). SLO (Service Level Objective) is the target availability level, e.g., 99.9% uptime. SLI (Service Level Indicator) is the actual metric we measure. Alerts with burn rate allow quick response when deviation from SLO threatens the budget.

Principles of Effective Alerting

Alert on symptoms, not causes. An alert like 'Site is unavailable to users' is more important than 'CPU > 80%'. High CPU is a cause that may not affect users. This principle is described in the Google SRE Book.

The rule of four golden signals: latency, traffic, errors, saturation. Start with the first three. Burn rate instead of thresholds: 'Error rate > 5% for 5 minutes' is better than '1 error per 1 minute'. Burn rate shows how fast you are consuming the SLO error budget and allows early detection of anomalies.

Why Burn Rate is Better Than Thresholds?

Threshold-based alerts produce many false positives. Example: an error on one out of a hundred requests is 1%, but if it lasts an hour, the error budget (SLO 99.9%) will be exhausted in 4 days. Burn rate = 10. An alert with this value will fire in 5 minutes, not in an hour. This reduces noise by 10 times.

How to Avoid Noisy Alerts?

Use burn rate, grouping, and deduplication in Alertmanager. Configure group_wait (30s), group_interval (5m), repeat_interval (4h). Alerts should be on symptoms, not causes. If CPU > 80% does not affect users, it is not an alert.

Stack Configuration: Prometheus + Alertmanager + Grafana

Example docker-compose.yml
services:
  prometheus:
    image: prom/prometheus:v2.51.0
    volumes:
      - ./prometheus.yml:/etc/prometheus/prometheus.yml
      - ./rules:/etc/prometheus/rules
      - prometheus_data:/prometheus
    command:
      - '--config.file=/etc/prometheus/prometheus.yml'
      - '--storage.tsdb.retention.time=30d'
    ports:
      - "9090:9090"

  alertmanager:
    image: prom/alertmanager:v0.27.0
    volumes:
      - ./alertmanager.yml:/etc/alertmanager/alertmanager.yml
    ports:
      - "9093:9093"

  grafana:
    image: grafana/grafana:11.0.0
    environment:
      - GF_SECURITY_ADMIN_PASSWORD=admin
    volumes:
      - grafana_data:/var/lib/grafana
    ports:
      - "3000:3000"

volumes:
  prometheus_data:
  grafana_data:

Application Metrics (Laravel) and Configuration

For Laravel, install the package spatie/laravel-prometheus and register custom metrics:

// app/Providers/AppServiceProvider.php
use Prometheus\CollectorRegistry;

public function boot(): void
{
    $registry = app(CollectorRegistry::class);

    // Counter — number of HTTP requests
    $httpRequests = $registry->getOrRegisterCounter(
        'app', 'http_requests_total', 'Total HTTP requests', ['method', 'route', 'status']
    );

    // Histogram — response time
    $httpDuration = $registry->getOrRegisterHistogram(
        'app', 'http_request_duration_seconds', 'HTTP request duration', ['method', 'route'],
        [0.05, 0.1, 0.25, 0.5, 1.0, 2.5, 5.0, 10.0]
    );

    // Gauge — queue length
    $queueSize = $registry->getOrRegisterGauge(
        'app', 'queue_size', 'Current queue size', ['queue']
    );
}

Prometheus configuration:

# prometheus.yml
global:
  scrape_interval: 15s
  evaluation_interval: 15s

alerting:
  alertmanagers:
    - static_configs:
        - targets: ['alertmanager:9093']

rule_files:
  - 'rules/*.yml'

scrape_configs:
  - job_name: 'web-app'
    static_configs:
      - targets: ['app:9000']
    metrics_path: /metrics

Example Alerting Rules

# rules/web-app.yml
groups:
  - name: web-app
    rules:
      # High error rate (5xx)
      - alert: HighErrorRate
        expr: |
          sum(rate(app_http_requests_total{status=~"5.."}[5m]))
          /
          sum(rate(app_http_requests_total[5m])) > 0.05
        for: 2m
        labels:
          severity: critical
        annotations:
          summary: "Error rate {{ $value | humanizePercentage }}"
          description: "5xx rate exceeded 5% for 2 minutes"

      # Slow responses (P95 > 2 seconds)
      - alert: HighLatencyP95
        expr: |
          histogram_quantile(0.95,
            sum by (le) (rate(app_http_request_duration_seconds_bucket[5m]))
          ) > 2
        for: 5m
        labels:
          severity: warning
        annotations:
          summary: "P95 latency {{ $value | humanizeDuration }}"

      # Traffic drop (anomalous fall)
      - alert: TrafficDrop
        expr: |
          sum(rate(app_http_requests_total[5m])) < 0.1
          and sum(rate(app_http_requests_total[1h] offset 1h)) > 1
        for: 5m
        labels:
          severity: critical
        annotations:
          summary: "Traffic almost zero — possible outage"

      # Large queue backlog
      - alert: QueueBacklog
        expr: app_queue_size{queue="default"} > 1000
        for: 10m
        labels:
          severity: warning
        annotations:
          summary: "Queue backlog: {{ $value }} jobs"

      # SSL certificate expiring soon
      - alert: SSLCertExpiringSoon
        expr: probe_ssl_earliest_cert_expiry - time() < 14 * 24 * 3600
        for: 1h
        labels:
          severity: warning
        annotations:
          summary: "SSL cert expires in {{ $value | humanizeDuration }}"

Routing and Deduplication in Alertmanager

# alertmanager.yml
global:
  resolve_timeout: 5m

route:
  group_by: ['alertname', 'severity']
  group_wait: 30s
  group_interval: 5m
  repeat_interval: 4h
  receiver: 'telegram-critical'

  routes:
    - match:
        severity: critical
      receiver: 'telegram-critical'
      continue: false
    - match:
        severity: warning
      receiver: 'telegram-warning'
      group_interval: 15m
      repeat_interval: 12h

receivers:
  - name: 'telegram-critical'
    telegram_configs:
      - bot_token: 'your_bot_token'
        chat_id: -1001234567890
        message: |
          🔴 *{{ .CommonLabels.alertname }}*
          {{ range .Alerts }}
          {{ .Annotations.summary }}
          {{ if .Annotations.description }}{{ .Annotations.description }}{{ end }}
          {{ end }}

  - name: 'telegram-warning'
    telegram_configs:
      - bot_token: 'your_bot_token'
        chat_id: -1001234567890
        message: |
          ⚠️ *{{ .CommonLabels.alertname }}*
          {{ range .Alerts }}{{ .Annotations.summary }}{{ end }}

inhibit_rules:
  - source_match:
      severity: 'critical'
    target_match:
      severity: 'warning'
    equal: ['alertname']

Comparison of Prometheus and Cloud Services

Criterion Prometheus + Alertmanager Cloud Services (CloudWatch, Stackdriver)
Flexibility Full control, any metrics Limited capabilities
Cost Free, only hardware Pay per metric
Vendor lock-in None Full

Prometheus + Alertmanager provides flexibility and control. Unlike CloudWatch or Stackdriver, you are not tied to a vendor and the cost is significantly lower at scale. On one project, we reduced monitoring costs by 3 times by moving from Datadog to a self-built stack. Such a configuration pays for itself in a few months by reducing infrastructure costs.

Work Process and Indicative Timelines

Stage Duration Result
Analytics 0.5–1 day List of golden signals, SLO/SLI
Design 0.5 day Alert scheme, burn rate, routes
Implementation 1–2 days Prometheus, Alertmanager, Grafana
Testing 0.5–1 day Simulation, chaos testing
Deployment 0.5 day Production, team training

Basic setup (8–12 rules) takes 1–2 business days. If custom metrics and complex routing are needed, up to 4 days.

What’s Included

  • Audit of current application metrics (APM, logs, infrastructure)
  • Deployment of Prometheus + Alertmanager + Grafana
  • Creation of 8–12 alert rules with burn rate
  • Integration with Telegram, Slack, or email
  • Basic Grafana dashboards (error rate, latency, RPS, queue)
  • Documentation and team training
  • Result guarantee and 1 month support

If you have a similar task, contact us for a consultation. We will assess the scope of work within 1 day. Order monitoring setup to get rid of noise and sleep soundly. Get a free consultation on alerting configuration.

Setup Web Analytics: GA4, GTM, Yandex.Metrica, and Amplitude

We often see: conversion rate 1.2%, traffic grows, but conversion stays flat. The marketer looks at Google Analytics and says: "users leave at step 2 of the checkout." The developer opens the same step — no errors, Sentry is silent. So it's not a JS bug, but a UX issue or skewed data from analytics. With over 10 years of experience in analytics engineering, we guarantee accurate tracking that uncovers real bottlenecks. Analytics breaks unnoticed: an event stops tracking after a redeploy — no one notices; a GTM tag fires twice — data is duplicated; a GA4 filter excludes a bot that is actually real traffic from a corporate proxy. An audit of your current tags will find the cause within a week.

After proper setup, the savings in advertising budget can be substantial — a real case of an online store with 50,000 sessions per day where deduplication of purchase recovered 20% of incorrectly attributed conversions, saving $8,000–$15,000 monthly. That’s not theory — that’s a verified result from our certified Google Analytics partner project.

Why do GA4 events duplicate and how to fix it?

Universal Analytics is gone, replaced by GA4's event-based model. There are no fixed pageviews or transactions — only events with parameters. This is more flexible but requires proper event design. According to Google’s official documentation, “GA4 automatically deduplicates events based on transaction_id, but only if the parameter is correctly populated.” Many implementations miss this.

Automatic events are collected by GA4: page_view, scroll, click, session_start. Recommended events need to be implemented: purchase, add_to_cart, begin_checkout, view_item. Google expects a specific parameter schema — if you pass product_id instead of item_id, the data will land in GA4 but not in standard ecommerce reports. Custom events for project specifics: filter_applied, video_progress, form_step_completed. Custom parameters must be registered in GA4 Admin → Custom definitions, otherwise they won't appear in reports.

A common mistake is the purchase event being duplicated. Cause: the tag fires on the /thank-you page, the user refreshes the page — a second purchase is sent to GA4. Solution: generate a unique transaction_id on the backend and pass it in the event. In our experience, 80% of e-commerce stores have this issue. GA4 deduplicates based on it (in theory — verify with DebugView). Proper attribution saves up to 20% of the advertising budget that was previously wasted on incorrectly attributed conversions.

How to set up the data layer to avoid data loss?

GTM is a tool for managing tags without code deployment. But "no code" doesn't mean "no architecture." The data layer is the foundation. We pass data from the application to GTM via dataLayer.push(). Structure: event + contextual data. For e-commerce: before opening a product page — push with product data. GTM tag reads from the data layer, not from the DOM.

window.dataLayer = window.dataLayer || [];
dataLayer.push({
  event: 'view_item',
  ecommerce: {
    items: [{
      item_id: 'SKU-12345',
      item_name: 'Product name',
      price: 1990.00,
      currency: 'USD'
    }]
  }
});

Bad practice: GTM tag parses the DOM — looks for the price in span.price, the name in h1. This breaks with any layout change. Good practice: always use the data layer. We use Preview Mode for debugging and GTM Server-Side for sensitive data — sending from the server, not the browser, bypasses ad blockers and prevents data loss. A properly implemented data layer reduces tracking errors by 95%.

How does Yandex.Metrica complement web analytics?

For a Russian audience, Metrica is a must — especially Webvisor. Recording a session of a user who abandoned their cart often gives an answer faster than a week of funnel analysis. Goals in Metrica: event-based (via ym(COUNTER_ID, 'reachGoal', 'GOAL_NAME')) or automatic (button click, page visit). Integration with CRM via Metrica Plus — passing offline conversions. Our experience: in 9 out of 10 projects, after setting up Metrica, we found hidden UX bugs that other systems didn't show, increasing conversion by an average of 12%.

What does product analytics give in Amplitude?

Amplitude is a product tool, unlike marketing-oriented GA4 and Metrica. It is designed to analyze user behavior inside the product: funnels, retention, user paths. Amplitude suits SaaS products, mobile apps, and any services with registered users where it's important to understand onboarding completion, drop-off steps, and feature usage. Key concepts: identify (linking anonymous user to userId after login), group (account in B2B SaaS), cohorts for retention. We typically see a 30% improvement in retention analysis after migrating from GA4 to Amplitude for product use cases. Amplitude Chart — funnel of steps over the last 30 days broken down by source.

Monitoring Data Quality

Analytics without monitoring is a black box. We set up:

  • GA4 Realtime — check after every deploy that key events are coming in
  • Alerting in GA4 — anomaly in the number of purchase events (sharp drop = something broke)
  • GTM Preview in staging before production
  • Manual funnel tests once a week — simply go through the buyer journey and verify everything is tracked
What we check after each deploy
  • All recommended events present in DebugView
  • No duplicates (count purchase per 100 sessions)
  • Data layer structure unchanged after frontend update

What the work includes

Component Description
Audit of existing tags Check current GTM tags, data layer, duplicates, and errors
Event schema design Documentation: event list, parameters, triggers
GA4 + GTM setup Create configuration, tags, custom definitions
Yandex.Metrica Install counter, create goals, set up Webvisor
Amplitude (optional) Set up client and server SDK, cohorts
QA and monitoring Testing in Preview Mode, alerting
Training and handover Access, instructions for adding new events, console

Process and timeline

  1. Audit of existing tags and data (2 days)
  2. Event schema design (2 days)
  3. Data layer development and tag setup (3–5 days)
  4. QA in Preview Mode and staging (2 days)
  5. Deploy and dashboard setup (1 day)
Scenario Timeline
Basic GA4 + GTM setup 1 week
Full e-commerce tracking + Metrica 2–3 weeks
Server-side GTM + Amplitude 3–5 weeks

Cost is calculated individually. Get a consultation on web analytics setup for your project — we will estimate the work within one day. Contact us to get started with a free audit of your current tracking.