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 Max Allocated Storage metric for RDS #77

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

asaf400
Copy link

@asaf400 asaf400 commented May 18, 2023

An attempt to add the 'Max Allocated Storage' data field as a metric..

Could be useful for storage related alerts, to be able to 'know' the max limit of the RDS instance\cluster config

Edit: I tried running make and or make test but it failed with:

[user@LAPTOP-ASAF-T14 aws-resource-exporter]# make
go vet ./...
go test -race -short github.com/app-sre/aws-resource-exporter github.com/app-sre/aws-resource-exporter/pkg github.com/app-sre/aws-resource-exporter/pkg/awsclient github.com/app-sre/aws-resource-exporter/pkg/awsclient/mock -count=1
?       github.com/app-sre/aws-resource-exporter        [no test files]
--- FAIL: TestAddAllInstanceMetrics (0.00s)
    rds_test.go:91: 
                Error Trace:    /root/gits/aws-resource-exporter/pkg/rds_test.go:91
                Error:          "[%!s(*prometheus.constMetric=&{0xc00044bb90 2 1 [0xc0000ab3e0 0xc0000ab410 0xc0000ab440]}) %!s(*prometheus.constMetric=&{0xc00044bb20 2 1 [0xc0000ab620 0xc0000ab650 0xc0000ab680]}) %!s(*prometheus.constMetric=&{0xc00044bea0 2 0 [0xc0000aaff0 0xc0000ab020]}) %!s(*prometheus.constMetric=&{0xc00044bc70 1 0 [0xc0000ab0b0 0xc0000ab0e0]}) %!s(*prometheus.constMetric=&{0xc00044bce0 2 1646 [0xc0000ab170 0xc0000ab1a0]}) %!s(*prometheus.constMetric=&{0xc00044bab0 2 1.099511627776e+12 [0xc0000ab2f0 0xc0000ab320]}) %!s(*prometheus.constMetric=&{0xc00044bc00 2 1 [0xc0000ab4d0 0xc0000ab500 0xc0000ab530 0xc0000ab560]}) %!s(*prometheus.constMetric=&{0xc00044bd50 2 0 [0xc0000aae40 0xc0000aae70 0xc0000aaea0]}) %!s(*prometheus.constMetric=&{0xc00044be30 2 0 [0xc0000aaf30 0xc0000aaf60]}) %!s(*prometheus.constMetric=&{0xc00044ba40 2 1.099511627776e+12 [0xc0000ab230 0xc0000ab260]})]" should have 9 item(s), but has 10
                Test:           TestAddAllInstanceMetrics
FAIL
FAIL    github.com/app-sre/aws-resource-exporter/pkg    4.024s
?       github.com/app-sre/aws-resource-exporter/pkg/awsclient  [no test files]
?       github.com/app-sre/aws-resource-exporter/pkg/awsclient/mock     [no test files]
FAIL
make: *** [Makefile:69: test-unit] Error 1

@app-sre-bot
Copy link

Can one of the admins verify this patch?

@asaf400
Copy link
Author

asaf400 commented May 18, 2023

Nevermind, I now change the assertion for the length of metrics returned, and test passed

@asaf400
Copy link
Author

asaf400 commented May 18, 2023

I confirmed it works on aws account:

# HELP aws_resources_exporter_rds_maxallocatedstorage The amount of max allocated storage for RDS storage autoscaling in bytes.
# TYPE aws_resources_exporter_rds_maxallocatedstorage gauge
aws_resources_exporter_rds_maxallocatedstorage{aws_region="us-east-1",dbinstance_identifier="infra-db"} 1.073741824e+11

100gb max allocated storage, as configured in RDS

@janboll
Copy link
Contributor

janboll commented Jun 19, 2023

test this please

@janboll
Copy link
Contributor

janboll commented Jun 19, 2023

Can you please rebase your branch with the main one?

README.md Show resolved Hide resolved
@asaf400
Copy link
Author

asaf400 commented Aug 6, 2023

Sure thing, I rebased.
I will also:

  • Create tests (1 with maxStorage value, 1 without [nil] )
  • Update the Readme markdown table

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

Successfully merging this pull request may close these issues.

4 participants