PageSourceSearch

https://flanksource.com/assets/js/843d807c.f089c9b5.js

js flanksource.com collected 2026-10-03 20:55:03 UTC 8,260 bytes, 1 lines download raw bytes

1"use strict";(globalThis.webpackChunkmission_control=globalThis.webpackChunkmission_control||[]).push([[3248],{56480(e,n,t){t.r(n),t.d(n,{assets:()=>l,contentTitle:()=>c,default:()=>h,frontMatter:()=>r,metadata:()=>s,toc:()=>o});const s=JSON.parse('{"id":"guide/canary-checker/concepts/distributed-canaries","title":"Distributed Canaries","description":"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.","source":"@site/docs/guide/canary-checker/concepts/distributed-canaries.md","sourceDirName":"guide/canary-checker/concepts","slug":"/guide/canary-checker/concepts/distributed-canaries","permalink":"/docs/guide/canary-checker/concepts/distributed-canaries","draft":false,"unlisted":false,"editUrl":"https://github.com/flanksource/docs/tree/main/docs/guide/canary-checker/concepts/distributed-canaries.md","tags":[],"version":"current","sidebarPosition":6,"frontMatter":{"title":"Distributed Canaries","sidebar_custom_props":{"icon":"network"},"sidebar_position":6},"sidebar":"guide","previous":{"title":"Request Chaining","permalink":"/docs/guide/canary-checker/concepts/request-chaining"},"next":{"title":"Env Vars","permalink":"/docs/guide/canary-checker/concepts/secret-management"}}');var a=t(74848),i=t(28453);const r={title:"Distributed Canaries",sidebar_custom_props:{icon:"network"},sidebar_position:6},c=void 0,l={},o=[{value:"How It Works",id:"how-it-works",level:2},{value:"Agent Selector Patterns",id:"agent-selector-patterns",level:2},{value:"Example: HTTP Check on All Agents",id:"example-http-check-on-all-agents",level:2},{value:"Example: Regional Monitoring",id:"example-regional-monitoring",level:2},{value:"Example: Exclude Specific Agents",id:"example-exclude-specific-agents",level:2}];function d(e){const n={a:"a",admonition:"admonition",code:"code",h2:"h2",li:"li",ol:"ol",p:"p",pre:"pre",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",...(0,i.R)(),...e.components};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(n.p,{children:"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."}),"\n",(0,a.jsx)(n.admonition,{type:"info",children:(0,a.jsxs)(n.p,{children:["This feature is only available in ",(0,a.jsx)(n.a,{href:"https://flanksource.com/docs",children:"Mission Control"})," since Canary Checker does not support agents"]})}),"\n",(0,a.jsx)(n.admonition,{type:"tip",children:(0,a.jsxs)(n.p,{children:["For a step-by-step tutorial and real-world examples, see the ",(0,a.jsx)(n.a,{href:"/blog/distributed-canaries-tutorial",children:"Distributed Canaries blog post"}),"."]})}),"\n",(0,a.jsx)(n.h2,{id:"how-it-works",children:"How It Works"}),"\n",(0,a.jsxs)(n.p,{children:["When you specify an ",(0,a.jsx)(n.code,{children:"agentSelector"})," on a canary:"]}),"\n",(0,a.jsxs)(n.ol,{children:["\n",(0,a.jsxs)(n.li,{children:["The canary does ",(0,a.jsx)(n.strong,{children:"not"})," run locally on the server"]}),"\n",(0,a.jsx)(n.li,{children:"A copy of the canary is created for each matched agent"}),"\n",(0,a.jsx)(n.li,{children:"Each agent runs the check independently and reports results back"}),"\n",(0,a.jsx)(n.li,{children:"The copies are kept in sync with the parent canary"}),"\n"]}),"\n",(0,a.jsx)(n.p,{children:"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."}),"\n",(0,a.jsx)(n.h2,{id:"agent-selector-patterns",children:"Agent Selector Patterns"}),"\n",(0,a.jsxs)(n.p,{children:["The ",(0,a.jsx)(n.code,{children:"agentSelector"})," field accepts a list of patterns to match agent names:"]}),"\n",(0,a.jsxs)(n.table,{children:[(0,a.jsx)(n.thead,{children:(0,a.jsxs)(n.tr,{children:[(0,a.jsx)(n.th,{children:"Pattern"}),(0,a.jsx)(n.th,{children:"Description"})]})}),(0,a.jsxs)(n.tbody,{children:[(0,a.jsxs)(n.tr,{children:[(0,a.jsx)(n.td,{children:(0,a.jsx)(n.code,{children:"agent-1"})}),(0,a.jsx)(n.td,{children:"Exact match"})]}),(0,a.jsxs)(n.tr,{children:[(0,a.jsx)(n.td,{children:(0,a.jsx)(n.code,{children:"eu-west-*"})}),(0,a.jsx)(n.td,{children:"Prefix match (glob)"})]}),(0,a.jsxs)(n.tr,{children:[(0,a.jsx)(n.td,{children:(0,a.jsx)(n.code,{children:"*-prod"})}),(0,a.jsx)(n.td,{children:"Suffix match (glob)"})]}),(0,a.jsxs)(n.tr,{children:[(0,a.jsx)(n.td,{children:(0,a.jsx)(n.code,{children:"!staging"})}),(0,a.jsx)(n.td,{children:"Exclude agents matching this pattern"})]}),(0,a.jsxs)(n.tr,{children:[(0,a.jsxs)(n.td,{children:[(0,a.jsx)(n.code,{children:"team-*"}),", ",(0,a.jsx)(n.code,{children:"!team-b"})]}),(0,a.jsxs)(n.td,{children:["Match all ",(0,a.jsx)(n.code,{children:"team-*"})," except ",(0,a.jsx)(n.code,{children:"team-b"})]})]})]})]}),"\n",(0,a.jsx)(n.h2,{id:"example-http-check-on-all-agents",children:"Example: HTTP Check on All Agents"}),"\n",(0,a.jsx)(n.p,{children:"This example creates an HTTP check for a Kubernetes service that runs on every agent matching the pattern:"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-yaml",metastring:'title="distributed-http-check.yaml"',children:"apiVersion: canaries.flanksource.com/v1\nkind: Canary\nmetadata:\n  name: api-health\n  namespace: monitoring\nspec:\n  schedule: '@every 1m'\n  http:\n    - name: api-endpoint\n      url: http://api-service.default.svc.cluster.local:8080/health\n      responseCodes: [200]\n      test:\n        expr: json.status == 'healthy'\n  agentSelector:\n    - '*' # Run on all agents\n"})}),"\n",(0,a.jsx)(n.p,{children:"When this canary is created:"}),"\n",(0,a.jsxs)(n.ol,{children:["\n",(0,a.jsxs)(n.li,{children:["The check is executed locally only when ",(0,a.jsx)(n.code,{children:"local"})," agent is provided in selector"]}),"\n",(0,a.jsx)(n.li,{children:"A derived canary is created for each registered agent"}),"\n",(0,a.jsxs)(n.li,{children:["Each agent executes the HTTP check against ",(0,a.jsx)(n.code,{children:"api-service.default.svc.cluster.local:8080/health"})," in its own cluster"]}),"\n",(0,a.jsx)(n.li,{children:"Results from all agents are aggregated and visible in the UI"}),"\n"]}),"\n",(0,a.jsx)(n.h2,{id:"example-regional-monitoring",children:"Example: Regional Monitoring"}),"\n",(0,a.jsx)(n.p,{children:"Monitor an external API from specific regions:"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-yaml",metastring:'title="regional-monitoring.yaml"',children:"apiVersion: canaries.flanksource.com/v1\nkind: Canary\nmetadata:\n  name: external-api-latency\nspec:\n  schedule: '@every 5m'\n  http:\n    - name: payment-gateway\n      url: https://api.payment-provider.com/health\n      responseCodes: [200]\n      maxResponseTime: 500\n  agentSelector:\n    - 'eu-*' # All EU agents\n    - 'us-*' # All US agents\n    - '!us-test' # Exclude test agent\n    - 'local' # Run on local instance as well\n"})}),"\n",(0,a.jsx)(n.h2,{id:"example-exclude-specific-agents",children:"Example: Exclude Specific Agents"}),"\n",(0,a.jsx)(n.p,{children:"Run checks on all agents except those in a specific environment:"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-yaml",metastring:'title="production-only.yaml"',children:"apiVersion: canaries.flanksource.com/v1\nkind: Canary\nmetadata:\n  name: production-checks\nspec:\n  schedule: '@every 2m'\n  http:\n    - name: internal-service\n      url: http://internal.example.com/status\n  agentSelector:\n    - '!*-dev' # Exclude all dev agents\n    - '!*-staging' # Exclude all staging agents\n"})})]})}function h(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,a.jsx)(n,{...e,children:(0,a.jsx)(d,{...e})}):d(e)}},28453(e,n,t){t.d(n,{R:()=>r,x:()=>c});var s=t(96540);const a={},i=s.createContext(a);function r(e){const n=s.useContext(i);return s.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function c(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(a):e.components||a:r(e.components),s.createElement(i.Provider,{value:n},e.children)}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.