Giter Club home page Giter Club logo

infrawallet's Introduction

logo InfraWallet

Control your cloud costs just in the way how you control your bank accounts

InfraWallet

Highlights

  • Flexible aggregation options for cloud costs across multiple platforms and accounts*
  • Cost categorization for aggregating expenses across different cloud vendors with configurable category mappings
  • Swift response times with cached cost data, ensuring rapid access to financial insights fetched from cloud platforms
  • Easy configuration and deployment as a Backstage plugin, both frontend and backend plugins are production-ready

*The latest version supports AWS, Azure and GCP cost aggregation while the framework is designed to be extensible to support others. Feel free to contribute to the project.

Getting started

To start using InfraWallet, see the Getting Started documentation.

From v0.1.8, InfraWallet also supports displaying business metrics as line charts on the same cost graph (beta feature for now). Currently the supported metric providers include Datadog and GrafanaCloud. See the steps on this page if you would like to try it out.

Contributing to InfraWallet

There are different ways to contribute to InfraWallet, see examples here. To join the coding, you can start from this documentation.

Roadmap

  • Make IAM user optional for AWS credentials
  • Support Google Cloud Costs
  • Support filters besides grouping bys
  • WebUI for managing category mappings
  • Enable users to select a subset of configured cloud accounts as a wallet
  • Support different currencies

infrawallet's People

Contributors

gluckzhang avatar emillg avatar rustyrien avatar

Stargazers

thiagoscherrer avatar André Bovendorp avatar tklim avatar Henrique Oliveira avatar Bruno Padilha avatar Nikita Pakhomov avatar  avatar  avatar Jean-Louis FEREY avatar Odilio avatar  avatar Johannes Grumböck avatar Gorkem Ozlu avatar Gabriel Dantas Gomes avatar Konstantin K avatar  avatar César Soto Valero avatar  avatar  avatar Evan Saboo avatar Alina Astapovich avatar Jackie avatar Marco Garbelini avatar Steven Kessler avatar  avatar  avatar  avatar  avatar  avatar

Watchers

André Bovendorp avatar tklim avatar  avatar William OSPINA avatar  avatar  avatar  avatar  avatar  avatar Alina Astapovich avatar

Forkers

stvnksslr

infrawallet's Issues

Support for GCP Cloud Billing

Hi thanks for the great plugin,

Was wondering if we can later add support GCP cloud billing, and since GCP is project based, can we separately add a tab in the entity details page, so that we can view each relavant gcp project costs?

I know this may be a big ask, please let me know if theres any way i can help.

GCP Cloud Services error Location EU

Hi, I'm installing this new super plugins for GCP, but I'm blocked :(
I followed all the instructions, but when I pull it up inside my GKE, I get an error that my dataset cannot be found in the US, but it is not here, is in the EU
Captura de pantalla 2024-07-10 a las 20 42 05
.

I don't see any config parameter that has to pass the EU location.

Can anyone help me? Thank you.

Service category mappings overriding

In the current implementation, InfraWallet backend checks if there are any category mapping records in table category_mappings, and inserts default mappings if the table does not contain any records. This is not convenient when we update the default category mappings (because there are records already, and probably some users already adjust the mappings).

Here is a proposal for better supporting category mappings:

  • We create two database tables: category_mappings_default and category_mappings_override
  • For category_mappings_default, when starting InfraWallet backend, it always cleans up the table and inserts the latest version of default category mapping
  • For category_mappings_override, users can define overriding rules there and later on we will provide UI for configuring such mappings

Notify/visualize if spending is over the monthly average

hi @gluckzhang

Thanks for adding gcp earlier.

I do have an additional idea. now that we can catalog all the cost for all gcp projects, is there a way we can alert/notify or have a alert within the plugin page instead of resorting to a slack integration/ or directly within the component such that if the associated gcp_project of that component has a spending average higher than last month, we can see it or be notified?

I think the plugin itself currently tackles multicloud costs data visualization very well already, but i believe the next step is to take the data of what we process, alert users that if they are spending over their last monthly average.

The example above is based on gcp_project_id since i know gcp environment best, but im assuming the same logic for determining if the cost was going up for a certain project-id/service-account/resource-id logic is the same, it is just the cloud data category + resource type would be different.

Once again this is just a an idea that i think would be helpful and bring it to your radar, it doesnt even have to be a integration to slack or directly visisble in the component overview page, it could just all be shown in the plugin page after select a specific gcp-project-id. or in backstage's logic a certain group own services that are linked to their gcp-project-id.

Display error messages when there are failures to fetch some of the cloud accounts

Currently InfraWallet backend outputs error messages from cloud providers as backend logs and frontend does not display such failures. To better inform the users that InfraWallet fails to fetch costs from some of the cloud accounts, these error messages should be sent to the frontend as well. We can still keep the response code as 200 since it is a partial failure, but it would be nice to tell which cloud account fails.

Caching should be implemented in each client instead of in router.ts

In the current implementation, the cost data is cached based on the query parameters sent from the frontend.

        const cacheKey = [
          client.constructor.name,
          filters,
          groups,
          granularity,
          startTime,
          endTime,
        ].join('_');
        const cachedCosts = (await cache.get(cacheKey)) as Report[] | undefined;

This will be an issue when a client like AwsClient fails to fetch costs from some of the AWS accounts. The partial results are still cached and then, the backend will not retry to fetch all cost data until the cache expires.

New feature: New Cloud Provider OCI

Hi, Can you validate the idea to add a Oracle Cloud Infrastructure to InfraWallet?
It would be more robust to be able to see all the costs in a single plugin.

It's and idea... thank you for consider it.... I'm interesting on your roadmap.

feat: display business metrics as lines in the column chart

To better understand the correlations between cloud costs and business metrics, it is helpful to display these metrics such as usage, the number of monthly active users, etc. on the same chart (ColumnsChartComponent).

We may have a similar implementation as cost clients:

  • an abstract class MetricProvider that defines the common logic and data format
  • implementations for different metric providers, such as Datadog, Prometheus, etc.
  • a new API endpoint for fetching metrics so that frontend can visualize them

An example in the ApexCharts documentation: https://apexcharts.com/react-chart-demos/mixed-charts/multiple-yaxis/

MockClient for Demo or Frontend Contributors

For the demo site or someone who wants to contribute to the frontend part, it is not necessary to set up different kinds of real cloud integrations. It is better to have a mock client that returns some fake cost data in this case.

Add savings to cost Provider

Hi,
I'm working on GCP and I can view the cost of my services, So far everything is perfect.
But the plugin show me the cost of services without saving, is it possible to add the commitments?

Documentation:
https://cloud.google.com/billing/docs/how-to/bq-examples

Example:
SELECT invoice.month, SUM(cost) + SUM(IFNULL((SELECT SUM(c.amount) FROM UNNEST(credits) c), 0)) AS total, (SUM(CAST(cost AS NUMERIC)) + SUM(IFNULL((SELECT SUM(CAST(c.amount AS NUMERIC)) FROM UNNEST(credits) AS c), 0))) AS total_exact FROM 'project-ID.dataset.gcp_billing_export_v1_XXXXXX-XXXXXX-XXXXXX' GROUP BY 1 ORDER BY 1 ASC ;

Thank you.

feat: frontend filters for dimensions

Before grouping the cost reports, the frontend should enable users to filter the records. For example, group the records whose project tag has the value X by providers.

Support tag based filtering of cost

Hi
In case of extracting data from cost explorer, can we add the functionality to filter based on a tag(s). For example, filter cost of all cloud services having tag "x". Also things like filter cost of all Lambdas having a tag "y".

Add permissions for plugin

Hi All,

I couldn't find anything about permissions being expose for the permissions plugin.
Would you consider adding permissions or is this topic something not considered for this project?
I could create a PR for this if it is considered.

Best Regards.

refactoring: adopt class inheritance for InfraWalletApi clients

Currently, there is a bunch of duplicate code in each InfraWalletApi client, and the flow of fetchCostsFromCloud is actually the same:

  • read config
  • loop billing accounts / sub-accounts in each cloud provider
  • check if there is any cached data for a sub-account based on the query
  • if there is no cache, send APIs to fetch cost data from a cloud provider
  • convert the response from the cloud provider to the InfraWallet data model
  • cache the results for some time
  • return the full list of cost records

The code should be refactored using class inheritance instead of the current interface.

Using IAM roles instead of User

Hi
Is it possible to provide IAM roles across different accounts (configured with cross account assume role) and fetch cost explorer metrics using these IAM roles. That would make it much simpler and easy to use. For implementation around that, you can refer to https://github.com/awslabs/backstage-plugins-for-aws in which plugins like ecs make use of IAM roles.

Interested to use this plugin!

feat: category mapping rules support regular expressions

Currently, we do a full string comparison in getCategoryByServiceName (https://github.com/electrolux-oss/infrawallet/blob/main/plugins/infrawallet-backend/src/service/functions.ts#L48C17-L48C41) for category mappings. It is better to support regular expressions there to categorize similar service names easily.

For example, in AWS different LLMs are considered as different services. For now, if we would like to categorize them into Artificial Intelligence, all of the names need to be added to category_mappings_default. If there is a new model, we need to update the mappings every single time.

A better approach is to categorize all the services whose names contain Bedrock to Artificial Intelligence.

image

Error: response code 500 while fetching metrics from Cost explorer

Hi guys,
I tried using the infra wallet plugin for cost explorer metrics on backstage. I have tried integrating with multiple aws accounts. On running the plugin, I am getting error code 500 from /reports api endpoint.

{
    "error": {
        "name": "Error",
        "message": "An internal error occurred logId=e0721b098d4b588b14ba"
    },
    "request": {
        "method": "GET",
        "url": "/reports?&filters=&groups=&granularity=monthly&startTime=1711909800000&endTime=1719772199999"
    },
    "response": {
        "statusCode": 500
    }
}

I have integrated 2 aws accounts with this plugin i.e. my app-config.yaml:

  infraWallet:
    integrations:
      aws:
      - name: accountA
        accountId: ${AWS_ACCOUNT_ID_A}
        roleArn: ${AWS_IAM_ROLE_ARN_A{
        region: ${AWS_REGION}
      - name: accountB
        accountId: ${AWS_ACCOUNT_ID_B}
        roleArn: ${AWS_IAM_ROLE_ARN_B}
        region: ${AWS_REGION}

Can anyone help with what's wrong or how to debug this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.