UNPKG

@cloud-carbon-footprint/gcp

Version:

The core logic to get cloud usage data and estimate energy and carbon emissions from Google Cloud Platform.

43 lines (42 loc) 2.19 kB
import { BigQuery } from '@google-cloud/bigquery'; import { EstimationResult, GroupBy, LookupTableInput, LookupTableOutput } from '@cloud-carbon-footprint/common'; import { ComputeEstimator, EmbodiedEmissionsEstimator, MemoryEstimator, NetworkingEstimator, StorageEstimator, UnknownEstimator } from '@cloud-carbon-footprint/core'; export default class BillingExportTable { private readonly computeEstimator; private readonly ssdStorageEstimator; private readonly hddStorageEstimator; private readonly networkingEstimator; private readonly memoryEstimator; private readonly unknownEstimator; private readonly embodiedEmissionsEstimator; private readonly bigQuery?; private readonly tableName; private readonly billingExportTableLogger; constructor(computeEstimator: ComputeEstimator, ssdStorageEstimator: StorageEstimator, hddStorageEstimator: StorageEstimator, networkingEstimator: NetworkingEstimator, memoryEstimator: MemoryEstimator, unknownEstimator: UnknownEstimator, embodiedEmissionsEstimator: EmbodiedEmissionsEstimator, bigQuery?: BigQuery); getEstimates(start: Date, end: Date, grouping: GroupBy): Promise<EstimationResult[]>; getEstimatesFromInputData(inputData: LookupTableInput[]): Promise<LookupTableOutput[]>; private getFootprintEstimateFromUsageRow; private getEstimateByUsageUnit; private getComputeFootprintEstimate; private getComputeProcessorsFromMachineType; private getGpuComputeProcessorsFromUsageType; private getEmbodiedEmissions; private getDataFromMachineType; private getStorageFootprintEstimate; private getMemoryFootprintEstimate; private getNetworkingFootprintEstimate; private isUnknownUsage; private isMemoryUsage; private isUnsupportedUsage; private isComputeUsage; private isNetworkingUsage; private getReplicationFactor; private getEstimateForUnknownUsage; private getUsage; private getQueryResults; private createQueryJob; private tagNamesToQueryColumns; private rawTagsToTagCollection; private buildProjectFilter; } export declare const buildTagQuery: (columnName: string, keys: string[]) => string[];