Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[Feature] Added Prometheus metrics to blockchain-api #115

Merged
merged 14 commits into from
Mar 24, 2021

Conversation

yourbuddyconner
Copy link
Contributor

@yourbuddyconner yourbuddyconner commented Mar 12, 2021

Changes:

  • Added express-prom-bundle for prometheus metrics, exposes them at /metrics
  • Added custom metric for unknown transaction type
  • Added several duration histograms to measure speed of various parts of the system
  • Added tests for the custom metric

Copy link
Contributor

@gnardini gnardini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for being annoying with the two small style issues :(

Love that we're getting metrics! It will really help us make better decisions to have this info 😄

Also, looks like the yarn.lock needs updating :)

@@ -58,6 +61,8 @@ export class BlockscoutAPI extends RESTDataSource {
async getRawTokenTransactions(address: string): Promise<Transaction[]> {
console.info(`Getting token transactions for address: ${address}`)

// Measure time at beginning of execution
const t0 = performance.now()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps this timing measurement could be implemented as a decorator.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I felt doing it this way was a little more granular given I didn't understand the structure of the code I was instrumenting as much. I think that would be a good refactor at least.

@yourbuddyconner yourbuddyconner force-pushed the blockchain-api-metrics branch from f3436aa to f10dabd Compare March 23, 2021 22:35
Valentin Rodygin and others added 3 commits March 24, 2021 02:27
…nto blockchain-api-metrics

* 'blockchain-api-metrics' of github.com:celo-org/wallet:
  Updated yarn.lock
@yourbuddyconner yourbuddyconner force-pushed the blockchain-api-metrics branch from de4c950 to cf2a899 Compare March 24, 2021 16:30
@yourbuddyconner yourbuddyconner merged commit 6e8df4e into main Mar 24, 2021
tarikbellamine pushed a commit that referenced this pull request Apr 2, 2021
* added prometheus metrics

Co-authored-by: Valentin Rodygin <valentin@clabs.co>
@gnardini gnardini deleted the blockchain-api-metrics branch May 28, 2021 05:21
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants