How to read a footprint per tenant or per provider
A system's footprint can answer two different questions:
- Per tenant — who caused the impact? Demand-side: attribute the footprint to the end users (a customer, a business unit, a country) who triggered it.
- Per provider — where does it run? Supply-side: group the infrastructure (servers and their storage) by the cloud or hosting provider that operates it.
Use attributed footprints for the first question and group infrastructure for the second.
Per tenant (demand-side)
Model one UsagePattern per tenant to attribute impact across end-user devices, network, servers and storage.
from efootprint.constants.units import u
from efootprint.core.attribution import attributed_footprint
from efootprint.core.lifecycle_phases import LifeCyclePhases
# `system` is your already-built System, with one UsagePattern per tenant
for phase in (LifeCyclePhases.MANUFACTURING, LifeCyclePhases.USE):
for tenant in system.usage_patterns:
print(phase.value, tenant.name, attributed_footprint(tenant, phase).sum().to(u.kg))
Sum the hourly attributed footprint with .sum() for a period total.
Per provider (supply-side)
Group BoaviztaCloudServer objects by their provider key and include
their attached Storage. This key identifies the hardware profile's
provider. When a profile is only a sizing proxy for on-premise hardware,
use your own operator labels for a hosting-provider breakdown.
from collections import defaultdict
from efootprint.abstract_modeling_classes.empty_explainable_object import EmptyExplainableObject
from efootprint.builders.hardware.boavizta_cloud_server import BoaviztaCloudServer
from efootprint.constants.units import u
from efootprint.core.attribution import attributed_footprint
from efootprint.core.lifecycle_phases import LifeCyclePhases
# `system` is your already-built System
infra_by_provider = defaultdict(list)
for server in system.servers:
if isinstance(server, BoaviztaCloudServer):
# the server carries its provider; its attached storage rides along
infra_by_provider[server.provider.value] += [server, server.storage]
for provider, infra in infra_by_provider.items():
total = sum(
(attributed_footprint(obj, phase)
for obj in infra for phase in LifeCyclePhases),
start=EmptyExplainableObject())
print(provider, total.sum().to(u.kg))
These totals combine manufacturing and use. Keep separate totals per phase to distinguish their contributions.
Boundary
A plain Server has no provider attribute and is skipped by this
grouping. Add your own labels to include it and its storage. Network and
end-user devices are also outside this breakdown; use the per-tenant view
for the full footprint across all tiers.