Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"displayName": "Customer uses Service",
"source": { "types": "Customer" },
"target": { "types": "Service" },
"conditions": [{ "sourceProperty": "uses", "operator": "equals", "targetProperty": "name" }],
"labels": { "forward": "uses", "reverse": "used by" }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"displayName": "Region hosts Host",
"source": { "types": "Region" },
"target": { "types": "Host" },
"conditions": [{ "sourceProperty": "name", "operator": "equals", "targetProperty": "region" }],
"labels": { "forward": "hosts", "reverse": "hosted in" }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"displayName": "Region hosts Service",
"source": { "types": "Region" },
"target": { "types": "Service" },
"conditions": [{ "sourceProperty": "name", "operator": "equals", "targetProperty": "region" }],
"labels": { "forward": "hosts", "reverse": "hosted in" }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"displayName": "Service calls Service",
"source": { "types": "Service" },
"target": { "types": "Service" },
"conditions": [{ "sourceProperty": "calls", "operator": "equals", "targetProperty": "name" }],
"labels": { "forward": "calls", "reverse": "called by" }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"displayName": "Team owns Pipeline",
"source": { "types": "Team" },
"target": { "types": "Pipeline" },
"conditions": [{ "sourceProperty": "name", "operator": "equals", "targetProperty": "team" }],
"labels": { "forward": "owns", "reverse": "owned by" }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"displayName": "Team owns Service",
"source": { "types": "Team" },
"target": { "types": "Service" },
"conditions": [{ "sourceProperty": "name", "operator": "equals", "targetProperty": "team" }],
"labels": { "forward": "owns", "reverse": "owned by" }
}
4 changes: 3 additions & 1 deletion plugins/SampleData/v3/custom_types.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@
{ "name": "Service", "sourceType": "Service", "icon": "cubes", "singular": "Service", "plural": "Services" },
{ "name": "Host", "sourceType": "Host", "icon": "server", "singular": "Host", "plural": "Hosts" },
{ "name": "Pipeline", "sourceType": "Pipeline", "icon": "code-branch", "singular": "Pipeline", "plural": "Pipelines" },
{ "name": "Customer", "sourceType": "Customer", "icon": "building", "singular": "Customer", "plural": "Customers" }
{ "name": "Customer", "sourceType": "Customer", "icon": "building", "singular": "Customer", "plural": "Customers" },
{ "name": "Team", "sourceType": "Team", "icon": "users", "singular": "Team", "plural": "Teams" },
{ "name": "Region", "sourceType": "Region", "icon": "globe", "singular": "Region", "plural": "Regions" }
]
4 changes: 3 additions & 1 deletion plugins/SampleData/v3/dataStreams/cloudCost.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
"sourceType": {
"type": "oneOf",
"values": [
"Service"
"Service",
"Team",
"Region"
]
}
},
Expand Down
4 changes: 3 additions & 1 deletion plugins/SampleData/v3/dataStreams/deployments.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
"type": "oneOf",
"values": [
"Pipeline",
"Service"
"Service",
"Team",
"Region"
]
}
},
Expand Down
4 changes: 3 additions & 1 deletion plugins/SampleData/v3/dataStreams/hostHealth.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
"type": "oneOf",
"values": [
"Host",
"Service"
"Service",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I follow these scoping changes - given this stream is for host health, why can this now scope by Service/Team/Region etc.?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change added the additional scopes so that you can see the health of all the hosts running a given team's or region's services

E.g. the new Payments team perspective uses this to show every host running a Payments service

Happy to change it up though if it's not a good fit 👍

"Team",
"Region"
]
}
},
Expand Down
4 changes: 3 additions & 1 deletion plugins/SampleData/v3/dataStreams/hostPerformance.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
"type": "oneOf",
"values": [
"Host",
"Service"
"Service",
"Team",
"Region"
]
}
},
Expand Down
12 changes: 11 additions & 1 deletion plugins/SampleData/v3/dataStreams/objects.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "objects",
"displayName": "Objects",
"description": "Every service, host, pipeline and customer in the sample company",
"description": "Every service, host, pipeline, customer, team and region in the sample company",
"tags": [
"Inventory"
],
Expand Down Expand Up @@ -55,6 +55,11 @@
}
]
},
{
"name": "calls",
"displayName": "Calls",
"shape": ["array", { "itemShape": "string" }]
},
{
"name": "serviceName",
"displayName": "Service"
Expand Down Expand Up @@ -83,6 +88,11 @@
"name": "country",
"displayName": "Country"
},
{
"name": "uses",
"displayName": "Uses",
"shape": ["array", { "itemShape": "string" }]
},
{
"name": "slaTarget",
"displayName": "SLA target",
Expand Down
15 changes: 12 additions & 3 deletions plugins/SampleData/v3/dataStreams/scripts/businessMetrics.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,19 @@ const services = byId(model.services);
const regions = byId(model.regions);
const teams = byId(model.teams);

// Host, deployment and ticket streams can also be scoped to services (the Service
// perspective); rows are then narrowed to those services
const serviceFilter = new Set((context.objects || []).map((o) => unwrap(o.rawId)).filter((id) => services[id]));
// Service, host, deployment and ticket streams can also be scoped to services, or to
// the team that owns them, the region that hosts them or a customer that uses them;
// rows are then narrowed to those services
const customersById = byId(model.customers);
const scopeIds = (context.objects || []).map((o) => unwrap(o.rawId));
const usedBy = (id) => (customersById[id] && customersById[id].services) || [];
const serviceFilter = new Set(
model.services
.filter((s) => scopeIds.some((id) => id === s.id || id === `team-${s.team}` || id === `region-${s.region}` || usedBy(id).includes(s.id)))
.map((s) => s.id),
);
const forService = (serviceId) => serviceFilter.size === 0 || serviceFilter.has(serviceId);
const scopedServices = () => model.services.filter((s) => forService(s.id));

// Golden signals for a service at time t
const stress = (s, t) => Math.min(1, serviceImpact(s.id, t) + blip(s.id, t));
Expand Down
17 changes: 13 additions & 4 deletions plugins/SampleData/v3/dataStreams/scripts/cloudCost.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,19 @@ const services = byId(model.services);
const regions = byId(model.regions);
const teams = byId(model.teams);

// Host, deployment and ticket streams can also be scoped to services (the Service
// perspective); rows are then narrowed to those services
const serviceFilter = new Set((context.objects || []).map((o) => unwrap(o.rawId)).filter((id) => services[id]));
// Service, host, deployment and ticket streams can also be scoped to services, or to
// the team that owns them, the region that hosts them or a customer that uses them;
// rows are then narrowed to those services
const customersById = byId(model.customers);
const scopeIds = (context.objects || []).map((o) => unwrap(o.rawId));
const usedBy = (id) => (customersById[id] && customersById[id].services) || [];
const serviceFilter = new Set(
model.services
.filter((s) => scopeIds.some((id) => id === s.id || id === `team-${s.team}` || id === `region-${s.region}` || usedBy(id).includes(s.id)))
.map((s) => s.id),
);
const forService = (serviceId) => serviceFilter.size === 0 || serviceFilter.has(serviceId);
const scopedServices = () => model.services.filter((s) => forService(s.id));

// Golden signals for a service at time t
const stress = (s, t) => Math.min(1, serviceImpact(s.id, t) + blip(s.id, t));
Expand Down Expand Up @@ -142,7 +151,7 @@ const categories = [
];
const rows = [];
const today = Math.floor(NOW / DAY);
for (const s of scoped(model.services)) {
for (const s of scopedServices()) {
const dailyBudget = (s.monthlyCost * 1.08) / 30;
for (let day = Math.floor(windowStart / DAY); day <= Math.min(today, Math.floor((windowEnd - 1) / DAY)); day++) {
// Search has a cost anomaly: an index rebuild left extra nodes running for the last 9 days
Expand Down
15 changes: 12 additions & 3 deletions plugins/SampleData/v3/dataStreams/scripts/conversionFunnel.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,19 @@ const services = byId(model.services);
const regions = byId(model.regions);
const teams = byId(model.teams);

// Host, deployment and ticket streams can also be scoped to services (the Service
// perspective); rows are then narrowed to those services
const serviceFilter = new Set((context.objects || []).map((o) => unwrap(o.rawId)).filter((id) => services[id]));
// Service, host, deployment and ticket streams can also be scoped to services, or to
// the team that owns them, the region that hosts them or a customer that uses them;
// rows are then narrowed to those services
const customersById = byId(model.customers);
const scopeIds = (context.objects || []).map((o) => unwrap(o.rawId));
const usedBy = (id) => (customersById[id] && customersById[id].services) || [];
const serviceFilter = new Set(
model.services
.filter((s) => scopeIds.some((id) => id === s.id || id === `team-${s.team}` || id === `region-${s.region}` || usedBy(id).includes(s.id)))
.map((s) => s.id),
);
const forService = (serviceId) => serviceFilter.size === 0 || serviceFilter.has(serviceId);
const scopedServices = () => model.services.filter((s) => forService(s.id));

// Golden signals for a service at time t
const stress = (s, t) => Math.min(1, serviceImpact(s.id, t) + blip(s.id, t));
Expand Down
15 changes: 12 additions & 3 deletions plugins/SampleData/v3/dataStreams/scripts/customerSla.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,19 @@ const services = byId(model.services);
const regions = byId(model.regions);
const teams = byId(model.teams);

// Host, deployment and ticket streams can also be scoped to services (the Service
// perspective); rows are then narrowed to those services
const serviceFilter = new Set((context.objects || []).map((o) => unwrap(o.rawId)).filter((id) => services[id]));
// Service, host, deployment and ticket streams can also be scoped to services, or to
// the team that owns them, the region that hosts them or a customer that uses them;
// rows are then narrowed to those services
const customersById = byId(model.customers);
const scopeIds = (context.objects || []).map((o) => unwrap(o.rawId));
const usedBy = (id) => (customersById[id] && customersById[id].services) || [];
const serviceFilter = new Set(
model.services
.filter((s) => scopeIds.some((id) => id === s.id || id === `team-${s.team}` || id === `region-${s.region}` || usedBy(id).includes(s.id)))
.map((s) => s.id),
);
const forService = (serviceId) => serviceFilter.size === 0 || serviceFilter.has(serviceId);
const scopedServices = () => model.services.filter((s) => forService(s.id));

// Golden signals for a service at time t
const stress = (s, t) => Math.min(1, serviceImpact(s.id, t) + blip(s.id, t));
Expand Down
26 changes: 22 additions & 4 deletions plugins/SampleData/v3/dataStreams/scripts/deployments.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,19 @@ const services = byId(model.services);
const regions = byId(model.regions);
const teams = byId(model.teams);

// Host, deployment and ticket streams can also be scoped to services (the Service
// perspective); rows are then narrowed to those services
const serviceFilter = new Set((context.objects || []).map((o) => unwrap(o.rawId)).filter((id) => services[id]));
// Service, host, deployment and ticket streams can also be scoped to services, or to
// the team that owns them, the region that hosts them or a customer that uses them;
// rows are then narrowed to those services
const customersById = byId(model.customers);
const scopeIds = (context.objects || []).map((o) => unwrap(o.rawId));
const usedBy = (id) => (customersById[id] && customersById[id].services) || [];
const serviceFilter = new Set(
model.services
.filter((s) => scopeIds.some((id) => id === s.id || id === `team-${s.team}` || id === `region-${s.region}` || usedBy(id).includes(s.id)))
.map((s) => s.id),
);
const forService = (serviceId) => serviceFilter.size === 0 || serviceFilter.has(serviceId);
const scopedServices = () => model.services.filter((s) => forService(s.id));

// Golden signals for a service at time t
const stress = (s, t) => Math.min(1, serviceImpact(s.id, t) + blip(s.id, t));
Expand Down Expand Up @@ -136,6 +145,13 @@ const availability30d = (s) => {

const rows = [];
const today = Math.floor(NOW / DAY);
// One release train per week, 4.11 is this week, so the incident's 4.12.0 is the newest
// version. Every 40 trains roll over into the previous major, so no component goes negative
const versionFor = (day, n) => {
const train = 11 - Math.floor((today - day) / 7);
const patch = (6 - ((today - day) % 7)) * 7 + n;
return `${4 + Math.floor(train / 40)}.${((train % 40) + 40) % 40}.${patch}`;
};
for (const p of scoped(model.pipelines).filter((p) => forService(p.service))) {
const s = services[p.service];
for (let day = Math.floor(windowStart / DAY); day <= Math.min(today, Math.floor((windowEnd - 1) / DAY)); day++) {
Expand All @@ -147,6 +163,8 @@ for (const p of scoped(model.pipelines).filter((p) => forService(p.service))) {
// Deploys land in working hours, 08:00-18:00 UTC
const at = day * DAY + (8 + rand(`${key}:at`) * 10) * HOUR;
if (at < windowStart || at > Math.min(windowEnd, NOW - 30 * MIN)) continue;
// The incident release is the last one out of its pipeline
if (p.id === incident.pipeline && at >= incidentStart - 6 * MIN) continue;
const failed = rand(`${key}:fail`) < p.failureRate;
const changeFailure = !failed && rand(`${key}:cf`) < p.failureRate * 0.6;
rows.push({
Expand All @@ -157,7 +175,7 @@ for (const p of scoped(model.pipelines).filter((p) => forService(p.service))) {
service: s.name,
team: teams[p.team].name,
tool: p.tool,
version: `${4 + Math.floor(day / 120) % 3}.${day % 40}.${n}`,
version: versionFor(day, n),
status: failed ? "Failed" : "Succeeded",
state: failed ? "error" : changeFailure ? "warning" : "success",
changeFailure,
Expand Down
15 changes: 12 additions & 3 deletions plugins/SampleData/v3/dataStreams/scripts/hostHealth.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,19 @@ const services = byId(model.services);
const regions = byId(model.regions);
const teams = byId(model.teams);

// Host, deployment and ticket streams can also be scoped to services (the Service
// perspective); rows are then narrowed to those services
const serviceFilter = new Set((context.objects || []).map((o) => unwrap(o.rawId)).filter((id) => services[id]));
// Service, host, deployment and ticket streams can also be scoped to services, or to
// the team that owns them, the region that hosts them or a customer that uses them;
// rows are then narrowed to those services
const customersById = byId(model.customers);
const scopeIds = (context.objects || []).map((o) => unwrap(o.rawId));
const usedBy = (id) => (customersById[id] && customersById[id].services) || [];
const serviceFilter = new Set(
model.services
.filter((s) => scopeIds.some((id) => id === s.id || id === `team-${s.team}` || id === `region-${s.region}` || usedBy(id).includes(s.id)))
.map((s) => s.id),
);
const forService = (serviceId) => serviceFilter.size === 0 || serviceFilter.has(serviceId);
const scopedServices = () => model.services.filter((s) => forService(s.id));

// Golden signals for a service at time t
const stress = (s, t) => Math.min(1, serviceImpact(s.id, t) + blip(s.id, t));
Expand Down
15 changes: 12 additions & 3 deletions plugins/SampleData/v3/dataStreams/scripts/hostPerformance.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,19 @@ const services = byId(model.services);
const regions = byId(model.regions);
const teams = byId(model.teams);

// Host, deployment and ticket streams can also be scoped to services (the Service
// perspective); rows are then narrowed to those services
const serviceFilter = new Set((context.objects || []).map((o) => unwrap(o.rawId)).filter((id) => services[id]));
// Service, host, deployment and ticket streams can also be scoped to services, or to
// the team that owns them, the region that hosts them or a customer that uses them;
// rows are then narrowed to those services
const customersById = byId(model.customers);
const scopeIds = (context.objects || []).map((o) => unwrap(o.rawId));
const usedBy = (id) => (customersById[id] && customersById[id].services) || [];
const serviceFilter = new Set(
model.services
.filter((s) => scopeIds.some((id) => id === s.id || id === `team-${s.team}` || id === `region-${s.region}` || usedBy(id).includes(s.id)))
.map((s) => s.id),
);
const forService = (serviceId) => serviceFilter.size === 0 || serviceFilter.has(serviceId);
const scopedServices = () => model.services.filter((s) => forService(s.id));

// Golden signals for a service at time t
const stress = (s, t) => Math.min(1, serviceImpact(s.id, t) + blip(s.id, t));
Expand Down
31 changes: 27 additions & 4 deletions plugins/SampleData/v3/dataStreams/scripts/objects.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,19 @@ const services = byId(model.services);
const regions = byId(model.regions);
const teams = byId(model.teams);

// Host, deployment and ticket streams can also be scoped to services (the Service
// perspective); rows are then narrowed to those services
const serviceFilter = new Set((context.objects || []).map((o) => unwrap(o.rawId)).filter((id) => services[id]));
// Service, host, deployment and ticket streams can also be scoped to services, or to
// the team that owns them, the region that hosts them or a customer that uses them;
// rows are then narrowed to those services
const customersById = byId(model.customers);
const scopeIds = (context.objects || []).map((o) => unwrap(o.rawId));
const usedBy = (id) => (customersById[id] && customersById[id].services) || [];
const serviceFilter = new Set(
model.services
.filter((s) => scopeIds.some((id) => id === s.id || id === `team-${s.team}` || id === `region-${s.region}` || usedBy(id).includes(s.id)))
.map((s) => s.id),
);
const forService = (serviceId) => serviceFilter.size === 0 || serviceFilter.has(serviceId);
const scopedServices = () => model.services.filter((s) => forService(s.id));

// Golden signals for a service at time t
const stress = (s, t) => Math.min(1, serviceImpact(s.id, t) + blip(s.id, t));
Expand Down Expand Up @@ -143,6 +152,7 @@ const services_ = model.services.map((s) => ({
region: regions[s.region].name,
provider: s.provider,
sloTarget: s.sloTarget,
calls: model.dependencies.filter((d) => d.from === s.id).map((d) => services[d.to].name),
}));
const hosts = model.hosts.map((h) => ({
id: h.id,
Expand Down Expand Up @@ -171,5 +181,18 @@ const customers = model.customers.map((c) => ({
city: c.city,
country: c.country,
slaTarget: c.slaTarget,
uses: (c.services || []).map((id) => services[id].name),
}));
result = [...services_, ...hosts, ...pipelines, ...customers];
// Prefixed ids keep teams and regions apart from the service and host ids the streams scope on
const teams_ = model.teams.map((t) => ({
id: `team-${t.id}`,
name: t.name,
type: "Team",
}));
const regions_ = model.regions.map((r) => ({
id: `region-${r.id}`,
name: r.name,
type: "Region",
provider: r.provider,
}));
result = [...services_, ...hosts, ...pipelines, ...customers, ...teams_, ...regions_];
Loading
Loading