-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #47 from electrolux-oss/45/metric-providers
#45 display business metrics as lines in the column chart
- Loading branch information
Showing
36 changed files
with
1,749 additions
and
506 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
yarn lint-staged && yarn tsc | ||
yarn lint:type-deps && yarn lint-staged && yarn tsc && yarn prettier:check |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
## Local Development | ||
|
||
First of all, make sure you are using either Node 18 or Node 20 for this project. Your plugin has been added to the example app in this repository, meaning you'll be able to access it by running `yarn install && yarn dev` in the root directory, and then navigating to [/infrawallet](http://localhost:3000/infrawallet). | ||
|
||
You can also serve the plugin in isolation by running `yarn start` in the plugin directory. | ||
This method of serving the plugin provides quicker iteration speed and a faster startup and hot reloads. | ||
It is only meant for local development, and the setup for it can be found inside a plugin's `dev` directory (e.g., [plugins/infrawallet/dev](../plugins/infrawallet/dev)). | ||
|
||
## How to Support a New Cloud Vendor? | ||
|
||
In InfraWallet, all the cost data fetched from different cloud providers are transformed into a generic format: | ||
|
||
```typescript | ||
export type Report = { | ||
id: string; // the unique ID of a cloud account which is defined in the app-config.yaml file | ||
[dimension: string]: string | { [period: string]: number } | undefined; // other dimensions such as category, service, a tag, etc. | ||
reports?: { | ||
[period: string]: number; // the reports which are in the following format ["period": cost], such as ["2024-01": 12.23, "2024-02": 23.21] | ||
}; | ||
}; | ||
``` | ||
|
||
For example, here is a report returned from InfraWallet backend: | ||
|
||
```json | ||
{ | ||
"id": "my-aws-dev-account", | ||
"provider": "aws", | ||
"category": "Infrastructure", | ||
"service": "EC2", | ||
"reports": { | ||
"2024-01": 12.23, | ||
"2024-02": 23.21 | ||
} | ||
} | ||
``` | ||
|
||
The aggregation is done by the frontend after getting all the needed cost reports. This means that as long as the backend returns more cost reports in the same format, InfraWallet can always aggregate and visualize the costs. | ||
|
||
When adding a new cloud vendor, you need to implement a client based on the abstract class [InfraWalletClient](../plugins/infrawallet-backend/src/service/InfraWalletClient.ts). Check [AwsClient.ts](../plugins/infrawallet-backend/src/service/AwsClient.ts) and [AzureClient.ts](../plugins/infrawallet-backend/src/service/AzureClient.ts) as examples. |
Oops, something went wrong.