You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: site/content/guides/canary-deploys.md
+72-22Lines changed: 72 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,23 +12,84 @@ Canary deployments are one of the ways we can release updates without violating
12
12
13
13
## Why We Need Canary Deployments
14
14
15
-
All teams that prioritize reliability will perform testing to make sure code works before it's deployed to real users. However, at a certain point we must admit that some problems can't be predicted by pre-release testing, no matter how complex. Canary deployments help limit the scope of unforeseen failures on production.
15
+
All teams that prioritize reliability will perform testing to make sure code works before it's deployed to real users. However, at a certain point we must admit that some problems can't be predicted by pre-release testing, no matter how complex. Canary deployments help limit the scope of unforeseen failures on production. Let's take an example for our guide: a major change to our eCommerce store with a significant rewrite of our front-end code.
16
+
17
+

18
+
*The canary deployment in our example is a total redesign of our storefront, and along with existing features a number of features will be added.*
16
19
17
20

18
-
*The first stage of a canary deployment: after rolling out new code to a subset of servers, some users are moved over to the new code version. Most users see the previous, known good, 'current' version of our service, while some see the updated 'canary' version. Note that canary deployments work in a number of ways, possibly assigning users randomly, and a simple page reload may switch the version a user sees.*
21
+
*The first stage of a canary deployment: after rolling out new code to a subset of servers, some users are moved over to the new code version. Most users see the previous, known good, 'current' version of our service, while some see the updated 'canary' version.*
19
22
20
-
Once the canary version of the service is shown to be working well, all users can be transferred over to the new version.
21
-

23
+
Note that canary deployments work in a number of ways, possibly assigning users randomly at the database level, or a simple page reload may switch the version a user sees. Users assigned to a canary server will often receive a feature flag via a header that will cause their requests to be routed to canary servers.
22
24
23
-
The essential problem we're trying to solve with this guide is **how do you know that your canary deployment is working?** Often the tools available to operations teams are quite limited, and amount to little more than a smoke test. Since canary servers are tagged at the infrastructure level, operations can see the infrastructure health of canary servers, but not their actual performance for users. Let's look at an example:
25
+
Canary deployments let us ensure that the new version of our site is working before all users see it. While canary deployments are valuable for incrementally rolling out new features and updates to users, they present a special challenge for synthetic monitoring, especially in scenarios like the one above where the user interface is changing: *how can an automated monitor that checks the user interface succesfully check an interface that's being served in two separate versions?* The rest of this guide will show you how to create checks that can check two different versions of your site based on whether they detect a feature flag at runtime.
24
26
25
-

26
-
*During a deployment, our feature flag loads our new chat feature, but the API also isn't returning full data, so our book catalog looks incomplete.*
27
+
### What if we're not setting a feature flag?
28
+
29
+
The process defined above starts with checking the response headers for a feature flag, but not every canary deployment will be engineered in the same way. Is it possible to detect that the test is running against a canary server even without a header to match? Absolutely! The test above just has to be modified to look for any detail that indicates we're looking at the canary version of the site. Looking at our new site interface:
30
+

31
+
We can look for any detail of the page to recognize that we're on the canary version, for example the 'Electronics' button on the new page.
console.log('✅ Canary version detected and tested')
53
+
} else {
54
+
// Production version - test existing functionality
55
+
const productionButtons:Locator[] = [
56
+
page.locator('button:has-text("Books")'),
57
+
page.locator('button:has-text("Clothing")'),
58
+
page.locator('button:has-text("Home & Garden")')
59
+
]
60
+
61
+
// Verify at least one production button exists
62
+
let foundButton:boolean=false
63
+
for (const button ofproductionButtons) {
64
+
if (awaitbutton.isVisible()) {
65
+
awaitexpect(button).toBeVisible()
66
+
awaitbutton.click()
67
+
foundButton=true
68
+
break
69
+
}
70
+
}
71
+
72
+
expect(foundButton).toBe(true)
73
+
console.log('✅ Production version detected and tested')
74
+
}
75
+
})
76
+
```
77
+
78
+
## Further Reading
79
+
80
+
**Checkly Guides:**
81
+
-[Getting Started with Monitoring as Code](https://www.checklyhq.com/guides/getting-started-with-monitoring-as-code/) - Learn the fundamentals of programmatic monitoring that make canary deployment strategies scalable
82
+
-[Detect, Communicate, and Resolve with Checkly - A Step-by-Step Tutorial for Engineers](https://www.checklyhq.com/guides/startup-guide-detect-communiate-resolve/) - Discover how monitoring as code enhances developer workflows and deployment confidence
83
+
-[Scaling Your Monitoring Setup Beyond the UI](https://www.checklyhq.com/guides/scaling-your-monitoring-setup/) - Explore techniques for managing complex monitoring requirements as your deployment strategies evolve
84
+
85
+
**Checkly Learn:**
86
+
-[Monitoring](https://www.checklyhq.com/learn/monitoring/) - Deep dive into monitoring strategies and best practices for deployment validation
87
+
-[Playwright Testing](https://www.checklyhq.com/learn/playwright/) - Master browser automation techniques used in the canary deployment examples
27
88
28
-
Looking at simple infrastructure metrics won't reveal this problem.
*A chart like this one showing network operations can at least show that the canary servers are running and accepting requests, but it's hardly an accurate picture that everything on the service is working as designed.*
90
+
91
+
# unused
92
+
----
32
93
33
94
## How Synthetic Monitoring Can Improve Canary Deployment Reliability
34
95
@@ -386,15 +447,4 @@ This guide demonstrated three complementary approaches to enhance your canary de
386
447
387
448
Together, these techniques transform canary deployments from a "hope and pray" exercise into a confident, data-driven process. Your team gains the ability to **detect** issues faster with targeted monitoring, **communicate** deployment status clearly with dedicated dashboards, and **resolve** problems before they affect all users.
388
449
389
-
The monitoring-as-code approach makes these enhancements scalable and repeatable, ensuring every canary deployment benefits from the same level of observability and control.
390
-
391
-
## Further Reading
392
-
393
-
**Checkly Guides:**
394
-
- [Getting Started with Monitoring as Code](https://www.checklyhq.com/guides/getting-started-with-monitoring-as-code/) - Learn the fundamentals of programmatic monitoring that make canary deployment strategies scalable
395
-
- [Detect, Communicate, and Resolve with Checkly - A Step-by-Step Tutorial for Engineers](https://www.checklyhq.com/guides/startup-guide-detect-communiate-resolve/) - Discover how monitoring as code enhances developer workflows and deployment confidence
396
-
- [Scaling Your Monitoring Setup Beyond the UI](https://www.checklyhq.com/guides/scaling-your-monitoring-setup/) - Explore techniques for managing complex monitoring requirements as your deployment strategies evolve
397
-
398
-
**Checkly Learn:**
399
-
- [Monitoring](https://www.checklyhq.com/learn/monitoring/) - Deep dive into monitoring strategies and best practices for deployment validation
400
-
- [Playwright Testing](https://www.checklyhq.com/learn/playwright/) - Master browser automation techniques used in the canary deployment examples
450
+
The monitoring-as-code approach makes these enhancements scalable and repeatable, ensuring every canary deployment benefits from the same level of observability and control.
0 commit comments