Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sanity checks/validations for the exporter config yaml #6

Closed
Ebaneck opened this issue Feb 26, 2024 · 3 comments
Closed

Add sanity checks/validations for the exporter config yaml #6

Ebaneck opened this issue Feb 26, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@Ebaneck
Copy link

Ebaneck commented Feb 26, 2024

Exporter crashes with the following config below:
Likely groups/label_name and the projectName in target_aws_accounts cause a duplicate label

group_by:
  enabled: true
  # Cost data can be groupped using up to two different groups: DIMENSION, TAG, COST_CATEGORY.
  # ref: https://docs.aws.amazon.com/aws-cost-management/latest/APIReference/API_GetCostAndUsageWithResources.html
  groups:
    - type: DIMENSION
      key: SERVICE
      label_name: ServiceName
    - type: TAG
      key: Project
      label_name: ProjectName
target_aws_accounts:
  - Publisher: <account-bumber>
    ProjectName: CV
    EnvironmentName: prod
2024-02-26 16:29:37,811 INFO     querying cost data for aws account <account-number>
Traceback (most recent call last):
  File "//main.py", line 72, in <module>
    main(config)
  File "//main.py", line 65, in main
    app_metrics.run_metrics_loop()
  File "/app/exporter.py", line 33, in run_metrics_loop
    self.fetch()
  File "/app/exporter.py", line 120, in fetch
    self.aws_daily_cost_usd.labels(
TypeError: prometheus_client.metrics.MetricWrapperBase.labels() got multiple values for keyword argument 'ProjectName'
@gluckzhang
Copy link
Member

Hi @Ebaneck, thanks for reporting this issue. I see, we will add the validation asap!

@gluckzhang gluckzhang added the enhancement New feature or request label Feb 27, 2024
@gluckzhang
Copy link
Member

@Ebaneck feel free to give it a review #7 :)
In this PR more validations are added for the config file, including:

  • label names defined in group_by should be unique
  • label names defined in group_by should be different from the ones defined in target_aws_accounts

gluckzhang added a commit that referenced this issue Mar 1, 2024
gluckzhang added a commit that referenced this issue Mar 1, 2024
* #6 add more validations for the config file
* #6 fix typos
gluckzhang added a commit that referenced this issue Mar 1, 2024
@gluckzhang
Copy link
Member

Yesterday there was an incident in the GitHub Action that blocked the release. Now the docker image has been published and I am closing the issue :)

https://github.com/opensourceelectrolux/aws-cost-exporter/releases/tag/v1.0.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants