feat: port geoip to ipbase & cache #11
Merged
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.
This pull request introduces enhancements to the GeoIP functionality of the Prometheus exporter, including the integration of IPBase for GeoIP lookups, state persistence for caching, and improved configuration options. The most important changes are grouped below by theme.
GeoIP Enhancements:
GeoIPCollectorto support IPBase API integration by adding anipbase-keyparameter and refactoring thegetGeoIPfunction to use the IPBase API. [1] [2]GeoIPCollector, enabling state persistence for GeoIP data with a configurablestate-fileparameter. This includes methods to load and save state, and logic to refresh data based on cache expiration. [1] [2]Configuration Updates:
--ipbase-keyand--state-fileto theservecommand for configuring the IPBase API key and state file path, respectively.ServeConfigto includeIpBaseKeyandStateFilefields, with validation to ensurestate-fileis specified. [1] [2]Code Refactoring:
GeoIPResponse,GeoIPData, andGeoIPLocation.getGeoIP.Documentation:
README.mdto document the new--ipbase-keyand--state-fileflags.