feat(mongodb-atlas): add currency conversion support#66
Open
malpou wants to merge 6 commits intoopencost:mainfrom
Open
feat(mongodb-atlas): add currency conversion support#66malpou wants to merge 6 commits intoopencost:mainfrom
malpou wants to merge 6 commits intoopencost:mainfrom
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>
Member
|
@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 |
Author
|
@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 😄 |
Member
|
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 |
ameijer
reviewed
Sep 4, 2025
pkg/common/currency/cache.go
Outdated
| @@ -0,0 +1,99 @@ | |||
| package currency | |||
…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
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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