Business Services
Group assets into business services ("E-commerce", "Billing") with a tier and an owning team, using explicit assets, selection rules and, optionally, their dependencies.
What is a business service?
A business service is a named group of assets that together deliver something the business cares about. Each service has a tier (tier-1 is the most critical, tier-3 the default), an optional owner team and an optional deployment environment. Services are listed in Services (Discovery → Services, /dashboard/services): a table of name, tier, team, environment, number of assets, health and status, with a search box and a tier filter. Managers and admins also see "Suggest services" and "New service". Each service has a detail page at /dashboard/services/<id> with its facts (tier, owner team, environment, assets direct/derived, dependencies, membership refresh time, slug), rules, explicit assets, health and resolved members; managers can Edit or Delete it there.

Explicit assets and rules
Members come from two sources. Explicit assets are picked one by one with the asset picker. Rules are a list of selectors: an asset is included when it matches at least one selector (OR), and inside a selector every filled field must match (AND). At most 20 selectors are allowed; an empty selector, an unknown field or a wrong type is rejected.
- tags: the asset has all the listed tags
- labels: the asset labels contain every key=value pair
- namespace: attributes.namespace is equal (Kubernetes namespace)
- asset_type: the asset type is equal (e.g. k8s_deployment)
- name_prefix: the asset name starts with the prefix (case-insensitive)
Note: Rules only select active assets. When the service has an environment, rules only select assets of that environment; explicit assets stay members whatever their environment, as long as they are active.
Direct and derived members
Explicit and rule members are direct members (depth 0); when an asset is both, its source is "explicit". With "Include dependencies" the membership also follows the active runs_on and depends_on dependencies from the direct members (source to target), up to the dependency depth (1 to 5 hops, default 2). Assets reached this way are derived members with source "dependency" and the minimum hop distance as depth. A direct member is never derived, and cycles are visited once.
When the membership is refreshed
The resolved membership is stored and recomputed every time a service is created or edited, and every hour by the refresh_service_membership task (minute 10, UTC). The task refreshes every active service; a failure on one service is logged and does not stop the others. Inactive services keep their last membership. The detail page shows when the membership was last refreshed. Changes to assets (tags, labels, environment, activity) and to dependencies reach the membership only at the next hourly refresh, or when the service is saved again.
Preview before saving
In the service form, "Preview" resolves the membership of the current values without saving anything and shows the number of direct and derived members with the first 100 assets. The service is saved only with Create or Save.
Suggested services
Managers can click "Suggest services" to see one proposal per detected application (asset type application, created by Kubernetes application detection) that is not yet a direct member of any service (at most 100 proposals). A proposal contains the application and its active contains members as explicit assets, a free name and slug, the tier derived from the application criticality (critical: tier-1, high: tier-2, otherwise tier-3), the owner team of the application (or the most frequent team of its members) and its environment. "Review & create" opens the pre-filled form: nothing is created until you click Create.
Service health
Every 5 minutes, right after the health collection, the compute_service_health task computes the health of every active service from the active health checks of its members. The state of an asset is the worst of its active checks (critical > degraded > unknown > healthy); an asset without active checks has "no checks". The rules are evaluated in this order:
- critical: a direct member is critical
- degraded: a direct member is degraded, or an upstream asset is critical
- unknown: more than 50% of the direct members have no checks (or are only unknown), or the service has no direct members
- healthy: otherwise
Note: Upstream assets are the derived members and the external dependencies: the active targets of active depends_on dependencies leaving a member that are not members themselves (1 hop only). A degraded upstream asset does not change the state of the service. Exactly half of the direct members without checks is still healthy.
Root causes and "Impacted by"
The Health card of the service detail page shows the state, since when the service is in it and, for unknown, the reason (e.g. "2 of 3 direct members have no checks"). A degraded service with no direct member degraded or critical is marked "Impacted by upstream". Root causes list the checks that explain the state, most severe first, then direct, derived and external, then by asset name (at most 50): for critical the critical checks of the direct members, for degraded their degraded and critical checks, in both cases plus the critical checks of the upstream assets. Each root cause links to its asset and shows since when the check is in that state.
- Impacted by: for each critical upstream asset, the other active services it is a direct member of (with the asset it goes through), or the asset itself
- The members table shows the health of each member ("No checks" without active checks); the services list shows the health of each service ("Not computed" until the first computation)
- A deactivated service loses its state; reactivated, it is computed again at the next run
Service uptime
Every change of state of a service is recorded as a transition (an unchanged state writes nothing). The uptime over 7 and 30 days is rebuilt from the transitions: (healthy + degraded) / (healthy + degraded + critical) time, with the number of incidents (entries into critical), the time in critical and the MTTR. "No data" means the service has no computed state in the window. The nightly rollup_health_daily task also stores the seconds per state and the incidents of each service for the previous UTC day, and the same history retention as assets applies.
API
Business services are exposed under /api/v1/business-services/. Reading requires any authenticated user; creating, editing, deleting, preview and suggestions require the manager or admin role.
- GET, PATCH, PUT and DELETE /api/v1/business-services/<id>/ read, edit or delete one service (editing re-resolves its membership)
- GET /api/v1/business-services/?tier=tier-1&owner_team=<id>&environment=<id>&is_active=true&search=shop&ordering=name
- POST /api/v1/business-services/ with name, tier, owner_team, environment, rules, explicit_asset_uids, include_dependencies, dependency_depth
- GET /api/v1/business-services/<id>/members/?kind=direct|derived
- POST /api/v1/business-services/preview/ resolves without writing: {count, direct_count, derived_count, results}
- GET /api/v1/business-services/suggestions/ returns read-only proposals, at most 100, ordered by name
- GET /api/v1/business-services/<id>/health/ returns {status, impacted, since, computed_at, reason, direct_count, direct_without_checks, root_causes, impacted_by, uptime: {7d, 30d}}; status is null when never computed
- List and detail include health_status (null when never computed); members include health (null without checks)