File size: 2,194 Bytes
44084af f3b0a91 44084af f3b0a91 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | """Seed vocabularies: services (40 domains x 5 suffixes = 200 names), teams, companies (U3).
Company domains are reserved names under `.example` (RFC 2606), so no task links to a real site."""
from __future__ import annotations
import random
DOMAINS = [
"checkout", "payments", "search", "catalog", "cart", "auth", "inventory", "notify", "pricing",
"ledger", "media", "reco", "shipping", "orders", "billing", "identity", "profile", "reviews",
"promo", "tax", "fraud", "loyalty", "wishlist", "geo", "maps", "chat", "feed", "upload",
"export", "report", "ingest", "quote", "refund", "invoice", "booking", "session", "gateway",
"ratings", "stock", "coupon",
]
SUFFIXES = ["api", "svc", "gw", "worker", "edge"]
SERVICES = [f"{d}-{s}" for d in DOMAINS for s in SUFFIXES]
TEAMS = [
"storefront", "payments", "discovery", "identity", "fulfillment", "growth", "commerce-core",
"data-ingest", "finance-eng", "trust-safety", "mobile-backend", "search-infra", "messaging",
"logistics", "billing-eng", "media-infra",
]
PLATFORM_TEAMS = ["platform", "sre-core", "infra"]
COMPANIES = [
("Tidewater Commerce", "tidewater.example"),
("Larkspur Pay", "larkspur.example"),
("Northwind Freight", "northwind-freight.example"),
("Quillon Health", "quillon.example"),
("Brightwell Travel", "brightwell.example"),
("Marrow & Pine", "marrowpine.example"),
("Cobaltline Games", "cobaltline.example"),
("Juniper Ledger", "juniperledger.example"),
]
SLO_TARGETS = ["0.999", "0.995", "0.9995", "0.99"]
def camel(service: str) -> str:
return "".join(p[:1].upper() + p[1:] for p in service.replace("_", "-").split("-"))
def pick_services(rng: random.Random, n: int, exclude: set[str] | None = None) -> list[str]:
"""n services with distinct domains (so camel-cased alert names never collide)."""
exclude = exclude or set()
used_domains = {s.split("-")[0] for s in exclude}
out: list[str] = []
for d in rng.sample(DOMAINS, len(DOMAINS)):
if d in used_domains:
continue
out.append(f"{d}-{rng.choice(SUFFIXES)}")
used_domains.add(d)
if len(out) == n:
break
return out
|