-
Notifications
You must be signed in to change notification settings - Fork 19
feat(mongodb-atlas): add currency conversion support #66
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
base: main
Are you sure you want to change the base?
Conversation
- Create generic currency package for reuse across plugins - Implement exchange rate fetching from exchangerate-api.com - Add thread-safe caching with 24-hour TTL - Support all ISO 4217 currency codes - Update MongoDB Atlas plugin to support currency conversion - Add configuration for target currency and API key - Include comprehensive tests for currency conversion Signed-off-by: Malthe Poulsen <malthe@grundtvigsvej.dk>
509aa4c to
a88ae8c
Compare
Signed-off-by: Malthe Poulsen <malthe@grundtvigsvej.dk>
Signed-off-by: Malthe Poulsen <malthe@grundtvigsvej.dk>
…and replacing hardcoded "USD" references. Signed-off-by: Malthe Poulsen <malthe@grundtvigsvej.dk>
…e unexported types/fields and camelCase for uniformity. Update associated tests and methods accordingly. Signed-off-by: Malthe Poulsen <malthe@grundtvigsvej.dk>
|
@malpou would you be willing to move into opencost, then invoke the APIs from there? we would love to bring this functionality to all parts of the product |
|
@ameijer Yes of course. If you can give a little guidance to where and how it should land in the opencost project then I'd move it in there 😄 |
|
Could I suggest you move your 'currency' package to https://github.com/opencost/opencost/tree/develop/pkg? I think that is a logical home for it |
pkg/common/currency/cache.go
Outdated
| @@ -0,0 +1,99 @@ | |||
| package currency | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@malpou can we update this to remove currency conversion since we merged your PR upstream?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the long time of nothing happening been busy, @ameijer it should be good now 😄
…encost - Remove local currency package from opencost-plugins/common/currency - Update imports to use github.com/opencost/opencost/pkg/currency - Fix duplicate imports and incorrect replace directives in go.mod - Remove unused standard library plugin import Signed-off-by: malpou <malthe@grundtvigsvej.dk>
4cc4a21 to
556dc03
Compare
What does this PR change?
Does this PR relate to any other PRs?
How will this PR impact users?
target_currencyandexchange_api_keyin their plugin configurationDoes this PR address any GitHub or Zendesk issues?
How was this PR tested?
Does this PR require changes to documentation?
target_currency: ISO 4217 currency code (e.g., "EUR", "GBP")exchange_api_key: API key from exchangerate-api.com