-
Notifications
You must be signed in to change notification settings - Fork 20
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
feat(observability): add prometheus metrics and detailed logging #45
Conversation
WalkthroughThe recent updates introduce significant improvements to the Changes
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
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.
Actionable comments posted: 1
Outside diff range and nitpick comments (5)
feeder/priceprovider/sources/gateio.go (1)
28-29
: Robust error handling and metrics integration.Consider adding more detailed logging for successful operations to provide better observability.
Also applies to: 36-37, 44-45, 66-66
README.md (4)
Line range hint
79-79
: Consider revising the sentence for clarity and grammatical correctness.- Votes for exchange rates in the [Oracle Module](https://nibiru.fi/docs/ecosystem/oracle/) are posted by validator nodes, however a validator can give consent a `feeder`... + Votes for exchange rates in the [Oracle Module](https://nibiru.fi/docs/ecosystem/oracle/) are posted by validator nodes. However, a validator can delegate a `feeder`...
Line range hint
80-80
: Simplify the sentence to enhance readability.- In order to be able to delegate consent to post prices, you need to set the `VALIDATOR_ADDRESS` env variable to the "valoper" address the `feeder` will represent. + To delegate consent, set the `VALIDATOR_ADDRESS` env variable to the "valoper" address the `feeder` will represent.
Line range hint
115-115
: Revise the sentence to correct the grammatical error.- Coingecko source allows to use paid api key to get more requests per minute. + Coingecko source allows the use of a paid API key to get more requests per minute.
Line range hint
116-116
: Avoid repetition to enhance the document's readability.- In order to configure it, you need to set env var: + To configure it, set the env var:
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (1)
go.mod
is excluded by!**/*.mod
Files selected for processing (18)
- .goreleaser.yml (2 hunks)
- Dockerfile (1 hunks)
- Makefile (2 hunks)
- README.md (1 hunks)
- cmd/root.go (1 hunks)
- cmd/version.go (1 hunks)
- feeder/priceposter/client.go (3 hunks)
- feeder/priceprovider/aggregateprovider.go (3 hunks)
- feeder/priceprovider/sources/binance.go (3 hunks)
- feeder/priceprovider/sources/bitfinex.go (3 hunks)
- feeder/priceprovider/sources/bybit.go (3 hunks)
- feeder/priceprovider/sources/coingecko.go (2 hunks)
- feeder/priceprovider/sources/coinmarketcap.go (2 hunks)
- feeder/priceprovider/sources/gateio.go (3 hunks)
- feeder/priceprovider/sources/okex.go (3 hunks)
- main.go (1 hunks)
- metrics/README.md (1 hunks)
- metrics/metrics.go (1 hunks)
Files skipped from review due to trivial changes (4)
- .goreleaser.yml
- Dockerfile
- main.go
- metrics/metrics.go
Additional context used
LanguageTool
metrics/README.md
[uncategorized] ~11-~11: Loose punctuation mark. (UNLIKELY_OPENING_PUNCTUATION)
Context: ...e data sources. labels: -source
: The data source from which the price wa...
[uncategorized] ~12-~12: Loose punctuation mark. (UNLIKELY_OPENING_PUNCTUATION)
Context: ...e was fetched, e.g.Bybit
. -success
: The result of the fetch operation. Poss...
[uncategorized] ~20-~20: Loose punctuation mark. (UNLIKELY_OPENING_PUNCTUATION)
Context: ...videris called. **labels**: -
pair`: The pair for which the price was aggreg...
[uncategorized] ~21-~21: Loose punctuation mark. (UNLIKELY_OPENING_PUNCTUATION)
Context: ...ich the price was aggregated. -source
: The data source from which the price wa...
[uncategorized] ~22-~22: Loose punctuation mark. (UNLIKELY_OPENING_PUNCTUATION)
Context: ...e was fetched, e.g.Bybit
. -success
: The result of the fetch operation. Poss...
[uncategorized] ~30-~30: Loose punctuation mark. (UNLIKELY_OPENING_PUNCTUATION)
Context: ...oracle module. labels: -success
: The result of the post operation. Possi...README.md
[typographical] ~79-~79: The word “however” is an adverb that can’t be used like a conjunction, and therefore needs to be separated from the sentence. (HOWEVER_SENTENCE)
Context: ...m/oracle/) are posted by validator nodes, however a validator can give consent afeeder
...
[style] ~80-~80: Consider a shorter alternative to avoid wordiness. (IN_ORDER_TO_PREMIUM)
Context: ...tor's mnemonic to send transactions. In order to be able to delegate consent to post pri...
[grammar] ~115-~115: Did you mean “using”? Or maybe you should add a pronoun? In active voice, ‘allow’ + ‘to’ takes an object, usually a pronoun. (ALLOW_TO)
Context: ...#### CoinGecko Coingecko source allows to use paid api key to get more requests per m...
[style] ~115-~115: Consider a shorter alternative to avoid wordiness. (IN_ORDER_TO_PREMIUM)
Context: ...pi key to get more requests per minute. In order to configure it, you need to set env var: ...
[style] ~116-~116: You have already used this phrasing in nearby sentences. Consider replacing it to add variety to your writing. (REP_NEED_TO_VB)
Context: ...r minute. In order to configure it, you need to set env var: ```ini DATASOURCE_CONFIG_...
Markdownlint
README.md
3-3: null (MD045, no-alt-text)
Images should have alternate text (alt text)
Additional comments not posted (19)
metrics/README.md (1)
1-30
: Documentation is clear and well-structured.This will help users understand the metrics being collected and their significance.
Tools
LanguageTool
[uncategorized] ~11-~11: Loose punctuation mark. (UNLIKELY_OPENING_PUNCTUATION)
Context: ...e data sources. labels: -source
: The data source from which the price wa...
[uncategorized] ~12-~12: Loose punctuation mark. (UNLIKELY_OPENING_PUNCTUATION)
Context: ...e was fetched, e.g.Bybit
. -success
: The result of the fetch operation. Poss...
[uncategorized] ~20-~20: Loose punctuation mark. (UNLIKELY_OPENING_PUNCTUATION)
Context: ...videris called. **labels**: -
pair`: The pair for which the price was aggreg...
[uncategorized] ~21-~21: Loose punctuation mark. (UNLIKELY_OPENING_PUNCTUATION)
Context: ...ich the price was aggregated. -source
: The data source from which the price wa...
[uncategorized] ~22-~22: Loose punctuation mark. (UNLIKELY_OPENING_PUNCTUATION)
Context: ...e was fetched, e.g.Bybit
. -success
: The result of the fetch operation. Poss...
[uncategorized] ~30-~30: Loose punctuation mark. (UNLIKELY_OPENING_PUNCTUATION)
Context: ...oracle module. labels: -success
: The result of the post operation. Possi...Makefile (1)
14-14
: Changes to the Makefile are appropriate and align with the new directory structure.Also applies to: 17-17, 49-58
feeder/priceprovider/sources/binance.go (2)
9-9
: Proper integration of Prometheus metrics and enhanced error logging aligns with the PR objectives.Also applies to: 40-41, 48-49, 57-58
67-67
: Correct placement of metric incrementation for successful operations.feeder/priceprovider/sources/okex.go (2)
11-11
: Effective use of Prometheus metrics and enhanced error logging for better observability.Also applies to: 38-39, 46-47, 54-55
77-77
: Correct implementation of metric incrementation upon successful price fetch.feeder/priceprovider/sources/bybit.go (2)
10-10
: Effective integration of Prometheus metrics and enhanced error logging for improved observability.Also applies to: 37-38, 45-46, 53-54
73-73
: Proper implementation of metric incrementation upon successful price fetch.feeder/priceprovider/sources/bitfinex.go (2)
10-10
: Effective integration of Prometheus metrics and enhanced error logging for improved observability.Also applies to: 39-40, 47-48, 55-56
72-72
: Proper implementation of metric incrementation upon successful price fetch.cmd/root.go (3)
21-32
: ThesetupLogger
function is well-implemented and correctly sets the log level based on the debug flag.
34-45
: ThehandleInterrupt
function correctly implements a graceful shutdown process for the application.
78-83
: TheExecute
function is correctly implemented to handle command execution and error management.feeder/priceprovider/aggregateprovider.go (1)
43-47
: The integration of Prometheus metrics in theAggregatePriceProvider
is correctly implemented to track the number of prices provided, with appropriate labels for success status.Also applies to: 58-58, 65-65
feeder/priceprovider/sources/coingecko.go (1)
35-36
: The error handling and Prometheus metrics updates in theCoingeckoPriceUpdate
function are well-implemented, providing detailed logs and metrics for different failure scenarios.Also applies to: 42-43, 50-51, 57-58, 62-62
feeder/priceposter/client.go (1)
108-112
: The integration of Prometheus metrics in theClient
class is correctly implemented to track the number of price update transactions sent to the chain, with appropriate labels for success status.Also applies to: 124-124, 130-130
feeder/priceprovider/sources/coinmarketcap.go (2)
12-12
: Ensure the new import is used effectively throughout the file.
48-49
: Enhanced error handling and metrics tracking are well-implemented.Also applies to: 55-56, 63-64, 71-72, 78-79, 83-83
README.md (1)
39-39
: Updated version in git checkout command aligns with the PR description.
var versionCmd = &cobra.Command{ | ||
Use: "version", | ||
Short: "Print the version number of Hugo", | ||
Long: `All software has versions. This is Hugo's`, | ||
Run: func(cmd *cobra.Command, args []string) { | ||
fmt.Println("v1.0.3") | ||
}, | ||
} |
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.
Consider fetching the version dynamically from a configuration file or environment variable.
This would allow easier updates and consistency across deployments without needing to recompile the binary.
Summary by CodeRabbit
New Features
version
command to display the current version of the software.Documentation
pricefeeder
.metrics/README.md
.Chores
.goreleaser.yml
, Dockerfile, and Makefile for improved build processes.release-snapshot
target in the Makefile for creating release snapshots.