CHECKING STATUS
I AM LISTENING TO
|

Day 41:  WorkAdventure – Synthetic Monitoring on Your Own Server – 7 Days of Docker

27. October 2025
.SHARE

Table of Contents

Ever wondered if your website is actually working for your users right now? Like, not just “is the server responding” but “can someone actually log in, click through pages, and do the things they’re supposed to do?” That’s where synthetic monitoring comes in, and it’s pretty neat.

What’s Synthetic Monitoring Anyway?

Think of synthetic monitoring as having a robot that pretends to be your user. Every few minutes, this robot visits your site, clicks around, fills out forms, and basically does all the things a real person would do. If something breaks, you know about it before your actual users start complaining. It’s like having a really dedicated QA person who never sleeps, never gets bored, and tests your site 24/7.

The “synthetic” part just means it’s simulated behavior rather than watching real users. You’re creating fake but realistic traffic to monitor how your application performs.

Enter Playwright and WorkAdventure’s Tool

Playwright is Microsoft’s end-to-end testing framework. It can control browsers (Chrome, Firefox, Safari) and interact with websites just like a human would. It’s powerful, fast, and surprisingly easy to use.

WorkAdventure took Playwright and wrapped it up in a Docker container that runs your tests continuously and exposes the results through handy HTTP endpoints. So instead of just running tests when you remember to, they run automatically and feed data to your monitoring tools.

Here’s what makes it cool:

  • Runs your Playwright tests every 5 minutes (configurable)
  • Exposes a /metrics endpoint for Prometheus
  • Provides a /healthcheck endpoint that returns HTTP 200 if tests pass, HTTP 500 if they fail
  • Shows a /last-error page with the full Playwright report when things go wrong
  • Keeps the error report even after tests recover, so you can investigate what happened

Getting Started with Docker Compose

First things first, you need to write some Playwright tests. Don’t worry, they’re pretty straightforward. Here’s a simple example:

Save your tests in a directory called tests and make sure they end with .spec.ts or .spec.js.

Now here’s the basic Docker Compose setup:

This mounts your test directory as read-only into the container and exposes the web interface on port 3000.

Environment Variables Explained

Want to customize how it runs? Here are the environment variables you can play with:

MONITORING_INTERVAL

This controls how often your tests run. The default is 300 seconds (5 minutes).

Important note: Make sure your tests can actually finish within this interval. If they take longer, they’ll be killed and marked as failed.

BASE_URL

If your tests use relative URLs or you want to test different environments easily, set a base URL:

Then in your tests, you can use relative paths:

PERSIST_TRACE_DIRECTORY

Want to keep traces of failed tests for later investigation? Set this to a directory name:

Failed test traces will be saved as ZIP files with timestamps like 2025-04-24T14:57:49.662Z.zip.

Complete Docker Compose Example

Here’s a more complete setup with all the bells and whistles:

Using the Endpoints

Once it’s running, you’ve got several useful endpoints:

Main Dashboard: http://localhost:3000/

This shows the status of your last test run and links to all the other pages. It’s your monitoring home base.

Health Check: http://localhost:3000/healthcheck

This is what you hook up to UptimeRobot or whatever monitoring tool you use. It returns:

  • HTTP 200 if all tests passed
  • HTTP 500 if any test failed

Prometheus Metrics: http://localhost:3000/metrics

If you’re running Prometheus, point it here. You’ll get:

  • playwright_synthetic_monitoring_status: 1 if tests passed, 0 if failed
  • playwright_synthetic_monitoring_test_duration_seconds: How long the tests took

Last Error Report: http://localhost:3000/last-error

When tests fail, this shows the full Playwright HTML report. The cool thing is it stays available even after tests recover, so you can investigate what went wrong at 3 AM without having to recreate it.

Writing Good Synthetic Tests

Here are some tips for writing tests that’ll actually catch problems:

Test Critical User Journeys

Focus on the paths users actually take. Login, checkout, signup, whatever matters for your business.

Keep Tests Fast

Remember, these run every few minutes. Keep each test under 30 seconds if possible.

Make Tests Resilient

Use good selectors that won’t break when someone changes a CSS class:

Test Both Happy and Sad Paths

Don’t just test that things work. Test that errors show up correctly too:

Running It

Start everything up:

Check the logs to make sure it’s working:

Open http://localhost:3000 in your browser and you should see the status page.

If you want to run tests once manually to see what happens:

Integrating with Monitoring Tools

UptimeRobot

Create a new HTTP(s) monitor pointing to http://your-server:3000/healthcheck. Set it to check every 5 minutes (or whatever your MONITORING_INTERVAL is). UptimeRobot will alert you if it gets a 500 response.

Prometheus + Grafana

Add this to your prometheus.yml:

Then create Grafana dashboards using the metrics. You can track success rates, test duration, and set up alerts when tests fail.

Troubleshooting Common Issues

Tests are taking too long and timing out

Increase your MONITORING_INTERVAL or optimize your tests. Look for unnecessary waits and slow page loads.

Tests pass locally but fail in Docker

Timing issues are common. Add explicit waits for elements:

Container keeps restarting

Check the logs for errors. Make sure your test files are valid TypeScript/JavaScript and that they’re mounted correctly.

Useful Links

Thoughts

Synthetic monitoring is one of those things that seems like overkill until the one time it catches a critical bug before your users do. With WorkAdventure’s Playwright Synthetic Monitoring, you get a zero-config solution that just works. Write your tests, spin up the container, hook it to your monitoring stack, and forget about it.

The beauty of this setup is that it’s completely isolated in Docker, runs automatically, and integrates with all the standard monitoring tools you’re probably already using. Plus, Playwright tests are actually useful beyond just monitoring – you can run the same tests in your CI/CD pipeline, during development, or whenever you need them.

Now go write some tests and catch those bugs before your users do.

Some Playwright Test Examples

Here’s a collection of practical Playwright test examples you can use for synthetic monitoring. These cover common scenarios you’ll want to monitor on your websites and applications.

Basic Page Load Tests

Simple Homepage Check

Check Multiple Pages Load

Verify Page Speed

Authentication Tests

Login Flow

Failed Login Handling

Session Persistence

Form Submission Tests

Contact Form

Form Validation

File Upload

E-commerce Tests

Add to Cart

Checkout Flow

Search Functionality

API Health Checks

REST API Endpoint

API with Authentication

Navigation Tests

Menu Navigation

Breadcrumb Navigation

Mobile Menu

Content Verification Tests

Check for Specific Text

Verify Images Load

Check Links Are Valid

Multi-Step User Flows

Complete Registration Flow

Profile Update Flow

Error Handling Tests

404 Page Exists

Handle Network Errors Gracefully

Performance Tests

Check Page Weight

Check Number of Requests

Accessibility Tests

Check for Alt Text on Images

Check Form Labels

Third-Party Integration Tests

Social Media Login

Payment Integration

Using Environment Variables

Tips for Better Tests

Use Data Attributes for Stable Selectors

Add Explicit Waits for Dynamic Content

Take Screenshots on Failure

Group Related Tests

These examples should give you a solid foundation for monitoring all the critical parts of your web application. Pick the ones that match your use case and customize them for your specific needs.

FAQ

What is synthetic monitoring?

Synthetic monitoring is a proactive testing method that simulates user interactions with websites and applications using automated scripts. It runs scheduled tests from various global locations to measure performance, availability, and functionality before real users encounter issues.

How does synthetic monitoring differ from Real User Monitoring (RUM)?

Synthetic monitoring is proactive and uses scripted tests in controlled environments, while RUM passively collects data from actual users. Synthetic monitoring runs on predetermined schedules and can test even when no users are present, whereas RUM captures real user behavior and experiences. Both approaches complement each other for comprehensive monitoring.

What are the main benefits of synthetic monitoring?

Key benefits include proactive issue detection before users are affected, performance optimization through detailed metrics, consistent testing in controlled environments, 24/7 monitoring even during low traffic periods, ability to test from multiple global locations, and early detection of third-party service failures.

How often should synthetic monitoring tests run?

Test frequency depends on business criticality. High-priority transactions like checkout flows may run every 1-5 minutes, while lower-priority functions might run hourly or daily. The goal is to balance insight with system overhead and reduce mean time to detect (MTTD).

What types of tests can synthetic monitoring perform?

Synthetic monitoring can perform browser-based testing (simulating user clicks and navigation), API monitoring (testing endpoints and response times), transaction monitoring (testing complete user journeys like login and checkout), uptime checks, SSL certificate validation, and multi-location performance testing.

Can synthetic monitoring test applications in pre-production?

Yes, synthetic monitoring excels at pre-production testing. Unlike RUM which requires actual user traffic, synthetic monitoring can test staging environments, establish performance baselines, and catch issues before they reach production, making it invaluable for CI/CD pipelines.

What are common challenges with synthetic monitoring?

Common challenges include script maintenance when applications change frequently, alert fatigue from false positives, limited coverage of uncommon user paths, and the predictability of tests which may miss edge cases. Using resilient selectors, dynamic waits, and modularized scripts helps address these issues.

How do you reduce false alerts in synthetic monitoring?

Best practices include running concurrent monitoring from multiple locations to confirm true failures, setting alert thresholds to trigger only after multiple consecutive failures (e.g., 3 failures over 15 minutes), and aligning alerts with business impact to prioritize critical transactions.

What makes a good synthetic monitoring tool in 2025?

Essential features include browser-based testing capabilities, API monitoring, mobile app testing, custom script support, comprehensive alerting systems, global testing locations (230+ checkpoints), AI-powered anomaly detection, integration with CI/CD pipelines, detailed visualization and reporting, and historical data analysis.

Can synthetic monitoring help with SEO and Core Web Vitals?

Yes, synthetic monitoring tools can track Core Web Vitals (LCP, FID, CLS), Lighthouse scores, and page speed metrics that directly impact SEO rankings. They provide detailed performance recommendations and can alert you to regressions that might harm search rankings.

How does synthetic monitoring help with third-party service monitoring?

Synthetic monitoring can verify third-party SLAs, detect when external services (payment gateways, CDNs, analytics) fail or slow down, and measure their impact on your application. You can create tests that include or exclude third-party assets to quantify their performance impact.

What scripting languages are commonly used for synthetic monitoring?

Popular frameworks include Playwright and Puppeteer (JavaScript/TypeScript), Cypress (JavaScript), and Selenium. Modern tools like Checkly are built on Playwright, offering code-based test creation with ultimate flexibility for complex workflows.

How do you write maintainable synthetic monitoring scripts?

Best practices include using resilient selectors (data attributes instead of auto-generated IDs), incorporating intelligent dynamic waits instead of hardcoded timeouts, modularizing scripts into reusable components, and integrating script updates into your CI/CD pipeline for automatic maintenance.

Can synthetic monitoring simulate global user interactions?

Yes, synthetic monitoring tools run tests from multiple global locations (often 90+ countries with 800+ testing nodes) to identify regional issues, test geofencing, evaluate performance worldwide, and ensure consistent experiences for users in different geographic locations.

What role does AI play in modern synthetic monitoring?

AI capabilities enable automated root cause analysis, predictive performance analytics, anomaly detection without manual threshold configuration, self-healing tests that adapt to UI changes automatically, and predictive alerts that identify potential issues before they impact users.

How do you set up alerting for synthetic monitoring?

Define acceptable response times and availability benchmarks for each transaction, specify failure conditions (like 3 consecutive failures or 10-second delays), and route alerts to appropriate teams via integrations like Slack, email, or Teams. This ensures actionable alerts reach the right people quickly.

Should synthetic monitoring be used with other monitoring types?

Absolutely. A comprehensive monitoring strategy combines synthetic monitoring with RUM for complete visibility. Synthetic provides proactive testing and controlled environments, while RUM offers real user insights. Together, they provide a 360-degree view of application health and user experience.

How can synthetic monitoring improve competitive advantage?

Synthetic monitoring enables competitor benchmarking by testing their websites without code injection, helps prepare for traffic spikes (Black Friday, Cyber Monday), validates performance across different markets, and ensures your critical user journeys are faster and more reliable than competitors.

What is the difference between synthetic monitoring and journey monitoring?

They are essentially the same thing. Journey monitoring focuses on testing complete user paths (login to checkout), while synthetic monitoring is the broader term. The terminology “synthetic monitoring” is more commonly used across leading web monitoring solutions.

How do open-source synthetic monitoring tools compare to commercial ones?

Open-source tools like Playwright, Cypress, and Prometheus Blackbox Exporter offer ultimate flexibility and are completely free but require technical expertise, self-hosting, and manual integration with schedulers and alerting. Commercial tools provide user-friendly interfaces, managed infrastructure, global testing networks, and comprehensive support.

Example: Basic synthetic monitoring test script

Here’s a simple example using Playwright to test a login flow:

Let’s Talk!

Looking for a reliable partner to bring your project to the next level? Whether it’s development, design, security, or ongoing support—I’d love to chat and see how I can help.

Get in touch,
and let’s create something amazing together!

RELATED POSTS

mosparo’s rule packages are a powerful way to protect your forms from spam without relying on external services. As an open-source spam protection solution, mosparo puts you in control of your form security through customizable rule sets that analyze submitted content in real-time. One of mosparo’s standout features is its rule package system, which not […]

YOURLS is a free, open-source set of PHP scripts that lets you run your own URL shortening service. Released under the MIT license, it gives you complete control over your links, detailed analytics, and the freedom to customize everything. The latest version, YOURLS 1.10.2, was released in July 2025 and comes with improvements to the […]

Or: How I Learned to Stop Worrying and Love the Underscore Remember when you could just tell your computer what to do, in plain English, and it would actually do it? No? Well, grab your DeLorean, because we’re going back to the future with _hyperscript (yes, that underscore is part of the name, and yes, […]

Alexander

I am a full-stack developer. My expertise include:

  • Server, Network and Hosting Environments
  • Data Modeling / Import / Export
  • Business Logic
  • API Layer / Action layer / MVC
  • User Interfaces
  • User Experience
  • Understand what the customer and the business needs


I have a deep passion for programming, design, and server architecture—each of these fuels my creativity, and I wouldn’t feel complete without them.

With a broad range of interests, I’m always exploring new technologies and expanding my knowledge wherever needed. The tech world evolves rapidly, and I love staying ahead by embracing the latest innovations.

Beyond technology, I value peace and surround myself with like-minded individuals.

I firmly believe in the principle: Help others, and help will find its way back to you when you need it.