-
Notifications
You must be signed in to change notification settings - Fork 2
chore: add distributed canaries docs + blog #469
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,106 @@ | ||||||||||||||||||||||||||||||||||
| --- | ||||||||||||||||||||||||||||||||||
| title: Distributed Canaries | ||||||||||||||||||||||||||||||||||
| sidebar_custom_props: | ||||||||||||||||||||||||||||||||||
| icon: network | ||||||||||||||||||||||||||||||||||
| sidebar_position: 6 | ||||||||||||||||||||||||||||||||||
| --- | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| Distributed canaries allow you to define a check once and have it automatically run on multiple agents. This is useful for monitoring services from different locations, clusters, or network segments. | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| :::info | ||||||||||||||||||||||||||||||||||
| This feature is only available in [Mission Control](https://flanksource.com/docs) since Canary Checker does not support agents | ||||||||||||||||||||||||||||||||||
| ::: | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| ## How It Works | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| When you specify an `agentSelector` on a canary: | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| 1. The canary does **not** run locally on the server | ||||||||||||||||||||||||||||||||||
| 2. A copy of the canary is created for each matched agent | ||||||||||||||||||||||||||||||||||
| 3. Each agent runs the check independently and reports results back | ||||||||||||||||||||||||||||||||||
| 4. The copies are kept in sync with the parent canary | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| A background job syncs agent selector canaries every 5 minutes. When agents are added or removed, the derived canaries are automatically created or cleaned up. | ||||||||||||||||||||||||||||||||||
|
Comment on lines
+16
to
+23
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rewrite passive voice in the “How It Works” steps. Lines 14–17 use passive voice. Please switch to active voice to match the documentation style guide. Suggested rewrite-1. The canary does **not** run locally on the server
-2. A copy of the canary is created for each matched agent
-3. Each agent runs the check independently and reports results back
-4. The copies are kept in sync with the parent canary
+1. The server does **not** run the canary locally.
+2. The system creates a copy of the canary for each matched agent.
+3. Each agent runs the check independently and reports results back.
+4. The system keeps the copies in sync with the parent canary.As per coding guidelines, use active voice; never use passive voice. 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use Mission Control, not server and system There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Revised suggestion: When you specify an `agentSelector` on a canary:
1. Mission Control does **not** run the canary locally.
2. Mission Control creates a copy of the canary for each matched agent.
3. Each agent runs the check independently and reports results back.
4. Mission Control keeps the copies in sync with the parent canary.
A background job syncs agent selector canaries every 5 minutes. When agents are added or removed, the derived canaries are automatically created or cleaned up.✏️ Learnings added
🧠 Learnings used |
||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| ## Agent Selector Patterns | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| The `agentSelector` field accepts a list of patterns to match agent names: | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| | Pattern | Description | | ||||||||||||||||||||||||||||||||||
| | ------------------- | ------------------------------------ | | ||||||||||||||||||||||||||||||||||
| | `agent-1` | Exact match | | ||||||||||||||||||||||||||||||||||
| | `eu-west-*` | Prefix match (glob) | | ||||||||||||||||||||||||||||||||||
| | `*-prod` | Suffix match (glob) | | ||||||||||||||||||||||||||||||||||
| | `!staging` | Exclude agents matching this pattern | | ||||||||||||||||||||||||||||||||||
| | `team-*`, `!team-b` | Match all `team-*` except `team-b` | | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| ## Example: HTTP Check on All Agents | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| This example creates an HTTP check for a Kubernetes service that runs on every agent matching the pattern: | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| ```yaml title="distributed-http-check.yaml" | ||||||||||||||||||||||||||||||||||
| apiVersion: canaries.flanksource.com/v1 | ||||||||||||||||||||||||||||||||||
| kind: Canary | ||||||||||||||||||||||||||||||||||
| metadata: | ||||||||||||||||||||||||||||||||||
| name: api-health | ||||||||||||||||||||||||||||||||||
| namespace: monitoring | ||||||||||||||||||||||||||||||||||
| spec: | ||||||||||||||||||||||||||||||||||
| schedule: '@every 1m' | ||||||||||||||||||||||||||||||||||
| http: | ||||||||||||||||||||||||||||||||||
| - name: api-endpoint | ||||||||||||||||||||||||||||||||||
| url: http://api-service.default.svc.cluster.local:8080/health | ||||||||||||||||||||||||||||||||||
| responseCodes: [200] | ||||||||||||||||||||||||||||||||||
| test: | ||||||||||||||||||||||||||||||||||
| expr: json.status == 'healthy' | ||||||||||||||||||||||||||||||||||
| agentSelector: | ||||||||||||||||||||||||||||||||||
| - '*' # Run on all agents | ||||||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| When this canary is created: | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| 1. The check is executed locally only when `local` agent is provided in selector | ||||||||||||||||||||||||||||||||||
| 2. A derived canary is created for each registered agent | ||||||||||||||||||||||||||||||||||
| 3. Each agent executes the HTTP check against `api-service.default.svc.cluster.local:8080/health` in its own cluster | ||||||||||||||||||||||||||||||||||
| 4. Results from all agents are aggregated and visible in the UI | ||||||||||||||||||||||||||||||||||
|
Comment on lines
+59
to
+64
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use active voice in the execution steps. Line 57 uses passive voice. Please switch to active voice. Suggested rewrite-1. The check is executed locally only when `local` agent is provided in selector
+1. The system executes the check locally only when you include the `local` agent in the selector.As per coding guidelines, use active voice; never use passive voice. 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| ## Example: Regional Monitoring | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| Monitor an external API from specific regions: | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| ```yaml title="regional-monitoring.yaml" | ||||||||||||||||||||||||||||||||||
| apiVersion: canaries.flanksource.com/v1 | ||||||||||||||||||||||||||||||||||
| kind: Canary | ||||||||||||||||||||||||||||||||||
| metadata: | ||||||||||||||||||||||||||||||||||
| name: external-api-latency | ||||||||||||||||||||||||||||||||||
| spec: | ||||||||||||||||||||||||||||||||||
| schedule: '@every 5m' | ||||||||||||||||||||||||||||||||||
| http: | ||||||||||||||||||||||||||||||||||
| - name: payment-gateway | ||||||||||||||||||||||||||||||||||
| url: https://api.payment-provider.com/health | ||||||||||||||||||||||||||||||||||
| responseCodes: [200] | ||||||||||||||||||||||||||||||||||
| maxResponseTime: 500 | ||||||||||||||||||||||||||||||||||
| agentSelector: | ||||||||||||||||||||||||||||||||||
| - 'eu-*' # All EU agents | ||||||||||||||||||||||||||||||||||
| - 'us-*' # All US agents | ||||||||||||||||||||||||||||||||||
| - '!us-test' # Exclude test agent | ||||||||||||||||||||||||||||||||||
| - 'local' # Run on local instance as well | ||||||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| ## Example: Exclude Specific Agents | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| Run checks on all agents except those in a specific environment: | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| ```yaml title="production-only.yaml" | ||||||||||||||||||||||||||||||||||
| apiVersion: canaries.flanksource.com/v1 | ||||||||||||||||||||||||||||||||||
| kind: Canary | ||||||||||||||||||||||||||||||||||
| metadata: | ||||||||||||||||||||||||||||||||||
| name: production-checks | ||||||||||||||||||||||||||||||||||
| spec: | ||||||||||||||||||||||||||||||||||
| schedule: '@every 2m' | ||||||||||||||||||||||||||||||||||
| http: | ||||||||||||||||||||||||||||||||||
| - name: internal-service | ||||||||||||||||||||||||||||||||||
| url: http://internal.example.com/status | ||||||||||||||||||||||||||||||||||
| agentSelector: | ||||||||||||||||||||||||||||||||||
| - '!*-dev' # Exclude all dev agents | ||||||||||||||||||||||||||||||||||
| - '!*-staging' # Exclude all staging agents | ||||||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add that this will only work for mission control