AI 资讯
PostgreSQL Indexing Deep Dive - Choosing the Right Index
In the earlier posts of this series, we looked at practical query tuning tips and how to read and interpret query plans . A recurring theme in both was: "add an index here." But "add an index" is a bit like saying "use the right tool" — the interesting part is which one. PostgreSQL ships with several index types, each tuned for a different kind of data and query. Picking the wrong one means PostgreSQL quietly ignores your index and goes back to a sequential scan. In this post, we'll walk through the main index types, when each shines, and the special index variations (composite, partial, covering, expression) that often matter more than the type itself. Setting the Scene: Schema and Sample Data We'll reuse the same schema from the previous posts, with one small addition — a metadata JSONB column and a tags array on orders , so we can explore the more exotic index types. CREATE TABLE customers ( id SERIAL PRIMARY KEY , customer_name VARCHAR ( 255 ), email VARCHAR ( 255 ), created_at TIMESTAMPTZ DEFAULT NOW () ); CREATE TABLE orders ( id SERIAL PRIMARY KEY , customer_id INT REFERENCES customers ( id ), order_date TIMESTAMPTZ DEFAULT NOW (), total_amount NUMERIC ( 10 , 2 ), status VARCHAR ( 20 ), tags TEXT [], metadata JSONB ); -- Insert sample customers INSERT INTO customers ( customer_name , email ) SELECT 'Customer ' || i , 'customer' || i || '@example.com' FROM generate_series ( 1 , 1000000 ) AS s ( i ); -- Insert sample orders INSERT INTO orders ( customer_id , order_date , total_amount , status , tags , metadata ) SELECT ( RANDOM () * 1000000 ):: INT , NOW () - interval '1 day' * ( RANDOM () * 365 ):: int , ( RANDOM () * 500 + 20 ), ( ARRAY [ 'pending' , 'shipped' , 'delivered' , 'cancelled' ])[ FLOOR ( RANDOM () * 4 + 1 )], ARRAY [( ARRAY [ 'gift' , 'priority' , 'fragile' , 'bulk' ])[ FLOOR ( RANDOM () * 4 + 1 )]], jsonb_build_object ( 'channel' , ( ARRAY [ 'web' , 'mobile' , 'store' ])[ FLOOR ( RANDOM () * 3 + 1 )]) FROM generate_series ( 1 , 1000000 ) AS s ( i
AI 资讯
Use Unix Domain Sockets on Windows Python: Building an AF_UNIX Compatibility API
Python provides socket.AF_UNIX , asyncio.open_unix_connection() , and asyncio.start_unix_server() for working with Unix Domain Sockets on Unix-like operating systems. On Windows, however, support for Unix Domain Sockets tends to depend on the Python version and runtime environment. In particular, differences become apparent when trying to use the higher-level asyncio APIs in the same way as on Unix. To address this, I created a compatibility layer that hides the differences between Unix and Windows and allows AF_UNIX sockets to be used through a largely identical API. This article covers two types of APIs: An asyncio -based AF_UNIX compatibility API A synchronous socket -based AF_UNIX compatibility API Goal The objective is straightforward. On Unix, use the standard library APIs as-is. On Windows, fill in the missing functionality so that application code can remain as unified as possible. For example, on Unix you can write: reader , writer = await asyncio . open_unix_connection ( path ) And on the server side: server = await asyncio . start_unix_server ( handle_client , path ) The goal is to preserve this style of programming on Windows as much as possible. What Was Built The compatibility layer consists of two major components. 1. Asyncio Version This is the asynchronous implementation designed to match the asyncio Unix Domain Socket APIs. The main APIs are: await open_unix_connection ( path , * , limit = ...) await start_unix_server ( callback , path , * , limit = ..., backlog = ...) await create_unix_connection ( protocol_factory , path , ...) await create_unix_server ( protocol_factory , path , ...) install () On Unix-like systems, these simply delegate to the standard asyncio implementation. On Windows, they use Winsock AF_UNIX sockets and combine WSAEventSelect with event-loop handle waiting to implement asynchronous operations. 2. Synchronous Socket Version This version provides a traditional blocking-socket-style API without using asyncio . The main APIs ar
AI 资讯
Three post-deploy checks I run after every Cloudflare Pages build
After spending two weeks debugging issues that only showed up in production — a sitemap _redirects rule that was blocking my own sitemap-index.xml and a Bluesky image upload race against Cloudflare Pages deploy lag — I added three post-deploy checks to my workflow. They're fast and specific to the failure modes I've actually hit, not a full end-to-end test suite. Three sites (aiappdex.com, findindiegame.com, ossfind.com) on Cloudflare Pages with Astro 5 SSG. Here's what I check. Check 1: Sitemap reachability The simplest check and the one I should have had from day one. After a Cloudflare Pages deploy, I verify that sitemap-index.xml is reachable and returning 200 on all three domains: for domain in aiappdex.com findindiegame.com ossfind.com ; do status = $( curl -s -o /dev/null -w "%{http_code}" "https:// $domain /sitemap-index.xml" ) echo " $domain /sitemap-index.xml → $status " if [ " $status " != "200" ] ; then echo "FAIL: $domain sitemap unreachable" fi done I also check sitemap-0.xml — the actual URL sub-sitemap that @astrojs/sitemap generates — and assert that it contains at least a minimum expected URL count. For aiappdex.com that threshold is 1,000; if it drops below that after a deploy, the ETL data pipeline probably broke silently. The reason this check exists: I had a _redirects rule rewriting sitemap-index.xml → sitemap-0.xml as an emergency workaround that turned out to be wrong. It was live for five days before I found it. The rule was blocking the real sitemap-index.xml from reaching crawlers while appearing fine in the browser (which followed the redirect). Curl with -o /dev/null -w "%{http_code}" doesn't follow redirects by default, so it would have caught this immediately. Check 2: IndexNow batch submission After every successful sitemap check, I run node scripts/indexnow.mjs . The script reads the live sitemap XML from each domain, collects all URLs, and POSTs them to the IndexNow endpoint for Bing, Yandex, Naver, and Seznam using site-specific k
AI 资讯
Three post-deploy checks I run after every Cloudflare Pages build
After spending two weeks debugging issues that only showed up in production — a sitemap _redirects rule that was blocking my own sitemap-index.xml and a Bluesky image upload race against Cloudflare Pages deploy lag — I added three post-deploy checks to my workflow. They're fast and specific to the failure modes I've actually hit, not a full end-to-end test suite. Three sites (aiappdex.com, findindiegame.com, ossfind.com) on Cloudflare Pages with Astro 5 SSG. Here's what I check. Check 1: Sitemap reachability The simplest check and the one I should have had from day one. After a Cloudflare Pages deploy, I verify that sitemap-index.xml is reachable and returning 200 on all three domains: for domain in aiappdex.com findindiegame.com ossfind.com ; do status = $( curl -s -o /dev/null -w "%{http_code}" "https:// $domain /sitemap-index.xml" ) echo " $domain /sitemap-index.xml → $status " if [ " $status " != "200" ] ; then echo "FAIL: $domain sitemap unreachable" fi done I also check sitemap-0.xml — the actual URL sub-sitemap that @astrojs/sitemap generates — and assert that it contains at least a minimum expected URL count. For aiappdex.com that threshold is 1,000; if it drops below that after a deploy, the ETL data pipeline probably broke silently. The reason this check exists: I had a _redirects rule rewriting sitemap-index.xml → sitemap-0.xml as an emergency workaround that turned out to be wrong. It was live for five days before I found it. The rule was blocking the real sitemap-index.xml from reaching crawlers while appearing fine in the browser (which followed the redirect). Curl with -o /dev/null -w "%{http_code}" doesn't follow redirects by default, so it would have caught this immediately. Check 2: IndexNow batch submission After every successful sitemap check, I run node scripts/indexnow.mjs . The script reads the live sitemap XML from each domain, collects all URLs, and POSTs them to the IndexNow endpoint for Bing, Yandex, Naver, and Seznam using site-specific k
AI 资讯
Cara Cepat Menambahkan MIT License di Repositori GitHub yang Sudah Ada
Pernahkah kamu membuat sebuah proyek perangkat lunak, mengunggahnya ke GitHub, lalu menyadari bahwa kamu belum menambahkan lisensi apa pun di repositori tersebut? Banyak developer pemula yang mengira bahwa menaruh kode di GitHub otomatis membuatnya menjadi open-source . Padahal, secara default , proyek tanpa fail lisensi memiliki hak cipta yang tertutup ( exclusive copyright ). Artinya, orang lain atau developer penerus secara teknis tidak boleh menyalin, mendistribusikan, atau memodifikasi kodemu. Agar proyek tersebut aman untuk dilanjutkan dan dimodifikasi oleh pengembang selanjutnya, kita wajib menambahkan lisensi terbuka. MIT License adalah pilihan paling aman dan populer karena sifatnya yang sangat membebaskan. Berikut adalah cara kilat menyematkan MIT License pada repositori GitHub yang sudah telanjur berjalan tanpa perlu menggunakan command line : Langkah 1: Buat Fail Baru di Repositori Buka halaman utama repositori GitHub kamu. Di bagian atas daftar fail dan folder kodemu, klik tombol Add file , kemudian pilih Create new file . Langkah 2: Pancing Fitur "License Template" Pada kolom pengisian nama fail, ketikkan kata LICENSE (pastikan menggunakan huruf kapital semua). Begitu kamu selesai mengetikkan kata tersebut, GitHub akan otomatis memunculkan sebuah tombol baru di sebelah kanan bernama Choose a license template . Klik tombol tersebut. Langkah 3: Pilih MIT License Kamu akan dibawa ke halaman yang berisi daftar berbagai jenis lisensi open-source . Pilih MIT License dari menu di sebelah kiri. GitHub akan otomatis meracik draf teks lisensinya, lengkap dengan nama akun GitHub kamu dan tahun saat ini. Klik tombol hijau Review and submit di pojok kanan atas. Langkah 4: Lakukan Commit Gulir ke bagian bawah halaman. Tulis pesan commit yang singkat dan jelas (misalnya: "Add MIT License for future development" ), lalu klik tombol hijau Commit changes... . Selesai! Sekarang proyek lama kamu sudah memiliki "payung" yang jelas dan resmi berstatus open-source . Reposito
产品设计
Founders Fund’s outlier bet on humanely killed fish
Shinkei makes a refrigerator-sized robot called Poseidon to kill fish quickly and humanely.
AI 资讯
while Loop, break & continue, Lists (Creation, Mutability, Methods, List Comprehension)
📌 Key Concepts Overview Concept One-Line Definition while loop Repeats code as long as a condition is True while True Infinite loop — needs break to stop break Immediately exits the loop continue Skips current iteration, moves to next List Ordered, mutable collection — heterogeneous elements allowed List Comprehension One-line way to build a list using a loop + condition List Mutability Lists can be changed in place — id() stays the same 🔁 Part 1 — while Loop The 3 Components (Critical Pattern) # 1. Initialisation 2. Condition 3. Increment/Decrement a = 1 # 1. Initialisation while a <= 10 : # 2. Condition print ( ' Devops ' ) a += 1 # 3. Increment # Without increment → INFINITE LOOP (condition never becomes False) How it works: Condition is checked before each iteration. As soon as it's False , the loop stops. Miss the increment/decrement → infinite loop (a real production hazard — can hang a script or burn CPU). while — Practical Patterns # Countdown (decrement) a = 10 while a > 0 : print ( ' Devops ' ) a -= 1 # Sum of 1 to 20 total = 0 a = 1 while a <= 20 : total += a a += 1 print ( total ) # 210 # Product (factorial-style) of 1 to 20 product = 1 a = 1 while a <= 20 : product *= a a += 1 print ( product ) # Pattern using while + string repetition str1 = ' Devops ' i = 0 while i < len ( str1 ): print ( str1 [ i ] * ( i + 1 )) i += 1 # D # ee # vvv # oooo # ppppp # ssssss for vs while — When to Use Which Use for Use while You know the iterable / number of repetitions You don't know how many times — depends on a condition Looping over list, string, range Retry logic, polling, waiting for a state # DevOps: retry logic — classic while True use case max_attempts = 5 attempt = 0 while attempt < max_attempts : print ( f ' Attempt { attempt + 1 } : Connecting to server... ' ) # if connection succeeds: break attempt += 1 while True — Infinite Loop Pattern # Always True — runs forever until break is hit # Used for: retry logic, polling, menu-driven scripts, password validati
AI 资讯
Inside Atlassian’s Forge Billing Architecture for Distributed Usage Tracking at Scale
Atlassian details the Forge billing platform built for usage-based pricing across its cloud ecosystem. It processes large-scale usage events with correct attribution, deduplication, and aggregation using a streaming pipeline, idempotent processing, and layered storage to enable accurate billing, near real-time visibility, and reliable reconciliation across distributed services. By Leela Kumili
开发者
Remote File Inclusion: How a Single URL Parameter Can Give Attackers Full Control of Your Server
Remote File Inclusion (RFI) is a web vulnerability where an application accepts a URL from user input, fetches the file at that URL, and executes it. When there is no validation on what URLs are allowed, an attacker can point the application to a malicious script on their own server and get it executed remotely. This pattern shows up in automation tools, plugin systems, and CI/CD pipelines. The idea of loading scripts from a URL seems useful, but without strict controls, it becomes a direct path to remote code execution. Here is a simplified example of vulnerable server-side code: // Vulnerable automation runner - DO NOT USE IN PRODUCTION const express = require ( ' express ' ); const http = require ( ' http ' ); const https = require ( ' https ' ); const app = express (); app . get ( ' /api/automation/run ' , ( req , res ) => { const scriptUrl = req . query . scriptUrl ; const startTime = Date . now (); const parsedUrl = new URL ( scriptUrl ); const client = parsedUrl . protocol === ' https: ' ? https : http ; client . get ( scriptUrl , ( response ) => { let data = '' ; response . on ( ' data ' , ( chunk ) => { data += chunk ; }); response . on ( ' end ' , () => { // VULNERABLE: executes fetched script without sandboxing or validation const output = eval ( data ); const executionTime = Date . now () - startTime ; res . json ({ status : ' success ' , output : output , executionTimeMs : executionTime }); }); }); }); app . listen ( 8080 , () => { console . log ( ' Server running on port 8080 ' ); }); The core problem with the code above: It accepts any URL from user input without validation It fetches and runs that URL's content using eval() There is no sandboxing or restriction on what the script can do The code runs with the same privileges as the application itself Ethical Considerations This is for educational purposes only. You should only test for RFI on systems you own or have explicit permission to test. Unauthorized testing is illegal and can lead to serious
AI 资讯
AI Model Failover Drills: Keep Agents Useful When Providers Break
A model fallback that only works in a diagram is not resilience. It is a TODO with better branding. If your product depends on AI agents, one slow provider, rate-limit spike, regional restriction, malformed response, or model behavior change can turn a useful workflow into a confusing user experience. The dangerous part is not always a clean outage. The dangerous part is a half-working fallback that silently changes schemas, drops tool state, skips citations, or gives users lower-confidence output without saying so. This guide shows how to run practical AI model failover drills before production traffic teaches you the lesson the hard way. The goal is not to make every model interchangeable. The goal is to keep the user workflow safe, honest, and recoverable when the primary model cannot do the job. Why model failover needs drills, not just retries Most teams start with a simple fallback chain: try the primary model, then a backup model, then show an error. That is better than nothing, but it misses the real problems in AI applications. Traditional APIs usually fail in obvious ways: timeout, 500, bad credentials, quota exceeded. AI systems can fail more subtly: The backup model returns valid JSON with different field meanings. A cheaper model ignores part of the tool policy. A provider accepts the request but streams tokens too slowly. A fallback model does not support the same function-calling format. A regional policy or access rule changes availability. The model completes the answer but loses citation discipline. The agent retries and burns the tenant budget. The final response looks polished but skipped the expensive verification step. Recent AI infrastructure conversations are pointing in the same direction: the system around the model now matters as much as the model. Agent benchmarks, provider reliability, AI cost pressure, and model routing are all active developer concerns. Search results also show many broad posts about LLM fallback strategy, but fewer pr
AI 资讯
The CFO's AI Playbook: 5 Finance Automations Every Indian Business Should Run in 2026
Over 60% of APAC finance leaders say AI-led automation is their top priority for 2026. For Indian businesses, that stat hides a quieter truth: most SMBs have no idea which automation to start with. They hear "AI for finance" and picture an enterprise suite with a six-figure licence fee. Wrong picture. I've built finance automations for CA firms, D2C brands, trading desks, family-run manufacturers, and a few fintech startups. The pattern is always the same. Five finance processes eat the most hours, hide the most errors, and respond best to a simple Python layer on top of whatever ledger you already use. This is the playbook. No enterprise suite. No subscriptions you don't need. Each automation is something I've shipped for real clients using Python, free APIs, and a ledger that's usually Tally or Zoho Books. 1. Bank Reconciliation — The Single Biggest Time Sink in Indian Finance Every finance team I meet has the same nightmare. Statements from three or four banks. Tally or Zoho on the other side. An Excel sheet in the middle. Eight hours a month — sometimes more — matching rows. A CA friend was losing two sleepless nights before every GST deadline on exactly this. We replaced it with a Python script that pulls statements from email attachments, categorizes transactions using keyword rules, cross-references entries with Tally, and flags only the mismatches in a clean Excel file. Eight hours dropped to fifteen minutes of review. "Tu 2 saal pehle kyu nahi mila?" (Why didn't I meet you two years ago?) If your team is still opening each bank statement manually, start here. It's the highest-ROI automation in Indian finance. I've written the full workflow in how a weekend Python script saved a CA firm 209 hours during ITR season . 2. Cash Application — Matching Payments to Invoices at Indian Speeds Globally, AI-driven cash application handles up to 90% of invoice matching without human touch. In India, it's harder — money arrives in more shapes than most tools expect: UPI,
AI 资讯
Python for Beginners — Part 1: Getting Started & Syntax
A beginner-friendly series on learning Python from scratch, one concept at a time. If you've ever wanted to learn programming but felt intimidated by curly braces, semicolons, and confusing syntax — Python is where you start breathing easy. It reads almost like English, and it's one of the most in-demand languages in the world today, used everywhere from web apps to data science to automation scripts. This is Part 1 of a beginner series that will take you from "what even is Python" to writing real, working programs. Let's begin. What is Python? Python is a general-purpose programming language created by Guido van Rossum and first released in 1991. It's popular because of three big reasons: It's beginner-friendly. The syntax is clean and close to natural language. It's versatile. You can build websites, automate tasks, analyze data, train machine learning models, or write small scripts — all with Python. It has a massive ecosystem. Thousands of ready-made libraries mean you rarely build things from scratch. Python runs on Windows, macOS, and Linux, and it's free and open source. Installing Python Most systems can run Python after a quick install: Go to python.org/downloads and grab the latest stable version. During installation on Windows, make sure to check "Add Python to PATH" — this saves you a lot of headaches later. Verify the install by opening your terminal (Command Prompt, PowerShell, or your Mac/Linux terminal) and typing: python --version If you see something like Python 3.13.0 , you're good to go. Tip: On some systems (especially macOS/Linux), you might need to type python3 instead of python . Your First Python Program Open a terminal, type python , hit Enter, and you'll land inside the Python interactive shell . Try this: print ( " Hello, World! " ) You should see: Hello, World! Congratulations — you just wrote your first Python program. print() is a built-in function that displays output on the screen. For anything beyond one-liners, you'll want to write
AI 资讯
Parsing and Rebuilding EPUB Files in Python: Lessons Learned from Building an AI Translation Service
How we extract, translate, and reconstruct entire ebooks with Python while preserving every detail At LectuLibre, we built a service that translates entire books using large language models. Our users upload EPUB files, and our backend pipeline parses them, extracts the text, sends it to an LLM for translation, and then rebuilds the EPUB with the translated content—all while preserving the original formatting, images, and metadata. This sounded straightforward until we looked inside a real EPUB. EPUB is essentially a ZIP file containing a structured set of XHTML, CSS, and XML files. The content.opf file defines the reading order (spine), metadata, and manifest. The toc.ncx holds the table of contents. The actual text lives in XHTML documents, often split per chapter. To translate a book, we needed to: 1) reliably parse the EPUB, 2) locate all translatable text, 3) send it chunk by chunk to the LLM, and 4) rebuild the EPUB with the translated text while keeping every byte of the formatting intact. The Problem with Off-the-Shelf Libraries We initially reached for ebooklib , the most popular Python library for EPUB manipulation. It worked great for simple EPUBs—until we threw a few hundred real-world files at it. We quickly hit issues: Metadata loss : ebooklib didn’t fully preserve custom metadata or namespace-prefixed properties in the OPF. Namespace handling : When modifying XHTML, it could strip or mangle xmlns attributes, breaking rendering on some devices. TOC and spine sync : After rebuilding, the table of contents and spine often got out of sync unless we manually repaired them. Large files : Processing a 200‑chapter book consumed surprising memory because ebooklib loaded everything at once. We could have used a heavyweight tool like Calibre’s command-line interface, but that introduced external dependencies and wasn’t as programmatically flexible. Instead, we decided to stick with ebooklib for high-level book structure and augment it with lxml for precise XML c
AI 资讯
Supervised vs. Unsupervised Machine Learning: How to Choose the Right Approach
Supervised vs. Unsupervised Machine Learning: How to Choose the Right Approach Supervised learning trains a model on data that's already labeled with the correct answer, so it learns to predict outcomes for new, unseen examples. Unsupervised learning works on unlabeled data and finds patterns or groupings on its own, without being told what the "right answer" looks like. Use supervised learning when you have historical examples of the outcome you want to predict; use unsupervised learning when you're trying to discover structure in data you don't yet understand. That's the short version. Here's what it actually means in practice, and how to know which one your project needs. What is supervised learning? In supervised learning, every training example comes with a label — the "correct answer" the model is trying to learn to predict. Feed a model thousands of emails, each tagged "spam" or "not spam," and it learns the patterns that separate the two. Once trained, it can label emails it's never seen before. The defining trait: you already know the outcome for your training data. You're not asking the model to discover something new — you're asking it to learn a pattern well enough to apply it to fresh cases. Common supervised tasks: Classification — sorting things into categories (spam vs. not spam, fraudulent vs. legitimate transaction) Regression — predicting a number (home price, next month's revenue) What is unsupervised learning? Unsupervised learning gets raw, unlabeled data and is asked to find structure in it — without anyone telling it what to look for. There's no "correct answer" to check against during training. The defining trait: you don't know the outcome in advance — you're trying to find it. A retailer might feed customer purchase histories into an unsupervised model not because they have a label called "customer segment" already assigned, but because they want the model to discover natural groupings on its own. Common unsupervised tasks: Clustering — gr
AI 资讯
Event-Handling-Basics
Event Handling Basics in euv Project Code: https://github.com/euv-dev/euv euv is a Rust + WASM frontend UI framework that enables developers to build interactive web applications using the power of reactive signals and the html! macro. One of the most critical aspects of any UI framework is how it handles user interactions. In this article, we will take a deep dive into euv's event handling system — from inline closures to native event handlers, from input events to form changes, and from the comprehensive list of supported event names to utility functions that simplify common patterns. Table of Contents Inline Closure Events NativeEventHandler Input Events Form Change Events Supported Event Names Accessing Event Data Utility Functions for Event Handling Putting It All Together Inline Closure Events The most straightforward way to handle events in euv is through inline closures. You define the event handler directly within the html! macro using the move |event: Event| { ... } syntax. html! { button { onclick : move | event : Event | { } "Click me" } } This pattern is ideal for simple, self-contained event handlers that don't need to be reused across multiple components. The move keyword ensures that any captured variables (like signals) are moved into the closure, which is essential for the Rust ownership model. Inline closures work with any event type — not just onclick . You can use them for keyboard events, focus events, mouse events, and more. The closure receives an Event object that you can inspect to extract relevant data. NativeEventHandler For more complex scenarios where you need reusable event handlers or want to define handlers outside the html! macro, euv provides the NativeEventHandler type. This allows you to create named, parameterized event handler functions. pub fn counter_on_increment ( counter : Signal < i32 > ) -> NativeEventHandler { NativeEventHandler :: create ( "click" , move | _event : Event | { let current : i32 = counter .get (); counter
AI 资讯
Encryption, spyware, and now Mythos: History shows why cyber export control doesn’t work
For the last 30 years, stopping the flow of cybersecurity-related software has proven to be ineffective. It's unclear why it would work now with Anthropic’s cybersecurity model Mythos.
AI 资讯
Go eyes robotaxis and acquisitions after Japan’s biggest IPO of 2026. Here’s why it matters
Go’s IPO — Japan’s biggest so far this year — has done more than provide a much-needed boost to the country’s languishing listing season. It has also supplied the taxi-hailing app with the capital required to address an existential issue: Japan’s shortage of drivers. Go, which went public Tuesday, plans to use the ¥88.6 billion […]
AI 资讯
Synthetic Monitoring vs Real User Monitoring (RUM): The Difference
Two monitoring approaches answer two different questions. Synthetic monitoring answers "would the checkout flow work right now if someone tried it?" Real user monitoring answers "what did the checkout flow actually do for the 4,000 people who tried it today?" The first is a robot testing a path on a schedule; the second is instrumentation recording reality as it happens. Teams reach for one when they need the other, then conclude monitoring "doesn't work." The fix is understanding what each is structurally good at — and where each is blind. Synthetic monitoring: proactive, scripted, continuous Synthetic monitoring runs scripted checks against your application from the outside, on a fixed schedule. An HTTP check hits an endpoint and asserts on the response; a browser check drives a headless Chromium through a journey — log in, add to cart, pay — and asserts on what the user would see. The defining property is that it does not need real traffic. The check runs every 30 seconds whether or not anyone is using the app, from datacenters you choose, testing exactly the journeys you scripted. When a deploy breaks checkout at 3 AM, a synthetic check catches it at 3 AM — not at 9 AM when the first customer wakes up. Real user monitoring: passive, real, traffic-dependent RUM instruments your actual frontend with a JavaScript snippet that reports back what real visitors experience: page load times, Core Web Vitals (LCP, INP, CLS), JavaScript errors, the device and network and geography of every session. It is a recording of reality with perfect fidelity — these are real people, real conditions, real outcomes. The cost of that fidelity is that RUM is entirely traffic-dependent and entirely retrospective. It can only report on paths real users took, after they took them. A page nobody visited generates no RUM data. A broken deploy at 3 AM is invisible to RUM until a real user hits it and the error is recorded. The core difference, side by side Dimension Synthetic monitoring Real
AI 资讯
Synthetic Monitoring Best Practices: What to Monitor and How Often
Most synthetic monitoring setups fail in one of a few predictable ways. They monitor everything and alert on nothing useful. They assert on status code 200 and miss the empty response body. They run flaky browser checks that page someone at 2 AM for a problem that fixed itself by 2:01. Or they go stale — the checkout flow changed three months ago and the check has been failing-then-being-ignored ever since. These are not exotic failures. They are the default outcome of setting up synthetic monitoring without a discipline. Here is the discipline. 1. Monitor the journeys that cost money, not everything Every browser check costs compute and, more importantly, costs maintenance. A check on a path that does not matter is worse than no check — it generates noise that trains your team to ignore alerts. Rank your journeys by cost of silent failure and monitor the top of the list: Authentication — login, signup. The gate to everything else. The revenue path — checkout, upgrade, add payment method. The core product action — the one thing your product exists to do. Critical third-party handoffs — OAuth redirects, payment iframes, SSO. Leave static pages, read-only endpoints, and admin screens to cheaper uptime and API checks . A good rule: if a path breaking would not generate a support ticket or lose revenue, it does not need a browser check. 2. Assert on what the user sees, not just the status code The entire point of synthetic monitoring is catching the failure that a 200 OK hides. So your assertions have to go past the status code. // Weak: passes even when the page renders an error await page . goto ( " https://shop.example.com/checkout " ); expect ( page . url ()). toContain ( " /checkout " ); // Strong: asserts the user can actually complete the action await page . getByRole ( " button " , { name : " Pay now " }). click (); await expect ( page . getByText ( " Order confirmed " )). toBeVisible ({ timeout : 10000 , }); await expect ( page . getByTestId ( " order-number "
AI 资讯
Metadata Routing
Stop Fighting Scikit-Learn Pipelines: How Metadata Routing Fixes Sample Weights & Groups A couple of months ago, I stumbled upon this video by Vincent D. Warmerdam about metadata routing in scikit-learn. I'll be honest, I had no idea what "metadata routing" even meant, but Vincent's explanation completely changed how I think about building ML pipelines. The video showed me that one of the most frustrating problems in scikit-learn; passing sample weights and groups through complex pipelines finally had an elegant solution. It piqued my curiosity enough that I dove deep into the feature, tested it extensively, and honestly, I was surprised by how little coverage this gets in technical blogs and articles. So I figured, why not write about it myself and share what I learned? If you've ever struggled with imbalanced datasets, grouped cross-validation, or just wanted to pass custom information through your pipelines, this article is for you. Let's start from the very beginning. What is "Metadata" in Machine Learning? Let's start with a concrete example. You're building a credit card fraud detection model with this data: # Your training data X = transaction_features # Amount, merchant, time, location, etc. y = is_fraud # 0 = legitimate, 1 = fraud # But you also have additional information: sample_weights = [ 1.0 , 1.0 , 10.0 , 1.0 , ...] # Fraud transactions weighted 10x customer_ids = [ 101 , 102 , 101 , 103 , ...] # Which customer made each transaction Metadata is the "extra information" beyond your features (X) and labels (y): sample_weight : How important is each transaction? (Fraud = 10x more important) groups : Which customer does each transaction belong to? (For proper cross-validation) Custom metadata : Transaction timestamps, confidence scores, data quality flags, etc. Why Metadata Matters: The Credit Card Fraud Problem Imagine you're building a fraud detection system for a financial company. You have: Imbalanced data : 99% legitimate transactions, 1% fraudulent T