Skip to content
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

fix(metrics): Add TASKS_ADDED_COUNT and TASKS_RESET_COUNT metrics in router scheduler flow #3189

Merged
merged 9 commits into from
Jan 18, 2024

Conversation

pixincreate
Copy link
Member

@pixincreate pixincreate commented Dec 21, 2023

Type of Change

  • Bugfix

Description

Currently TASKS_ADDED_COUNT and TASKS_RESET_COUNT metrics does not exist in router to track the tasks added in scheduler. This PR aims at adding that.
Closes #2090

Motivation and Context

We need to track the tasks added in scheduler.

How did you test it?

Did a few payments (Ran Stripe and Volt collection a few times):
image

Local setup:

Modify 3 files:

  • docker-compose.yml: Expose the otel-collector port by replacing "4317" with "4317:4317"
  • development.toml: Enable logging by setting metrics_enabled to true and otel_exporter_otlp_endpoint to http://localhost:4317
  • otel-collector.yml: Add logging in exporters of pipeline service: [prometheus, logging] instead of [prometheus]
  • Open a terminal window, start server by executing: cargo r
  • Create another terminal window for psql, execute:
     psql hyperswitch_db
     \x
     \dt
     table process_tracker;
    
  • Create another 3 terminal windows. One for consumer, another for producer and another for Grafana. Execute:
     # In consumer terminal window
     SCHEDULER_FLOW=consumer cargo r --bin scheduler 
     # In producer terminal window
     SCHEDULER_FLOW=producer cargo r --bin scheduler
     # In Grafana terminal window
     docker compose up -d grafana prometheus otel-collector
    
  • Execute curl telnet://localhost:4317 in yet another terminal window to see if this URL can be accessed or not
  • Grafana username/password - admin/admin

    incase reset is required, execute in terminal:
    grafana-cli admin reset-admin-password <new-password>

In env:

  • Open Grafana > VM Single > Metric:router_TASKS_ADDED_COUNT_total, label:job=router > Run Query

Checklist

  • I formatted the code cargo +nightly fmt --all
  • I addressed lints thrown by cargo clippy
  • I reviewed the submitted code
  • I added unit tests for my changes where possible
  • I added a CHANGELOG entry if applicable

@pixincreate pixincreate added the C-bug Category: Bug label Dec 21, 2023
@pixincreate pixincreate added this to the December 2023 Release milestone Dec 21, 2023
@pixincreate pixincreate self-assigned this Dec 21, 2023
@pixincreate pixincreate marked this pull request as ready for review December 21, 2023 13:23
@pixincreate pixincreate requested review from a team as code owners December 21, 2023 13:23
@pixincreate pixincreate requested review from a team as code owners December 22, 2023 08:01
SanchithHegde
SanchithHegde previously approved these changes Dec 22, 2023
crates/router/src/core/payments/helpers.rs Outdated Show resolved Hide resolved
…-router

* 'main' of github.com:juspay/hyperswitch: (84 commits)
  chore(config): add merchant_secret config for webhooks for  cashtocode and volt in wasm dashboard (#3333)
  chore(version): 2024.01.12.0
  fix: update amount_capturable based on intent_status and payment flow (#3278)
  feat: add support for card extended bin in payment attempt (#3312)
  feat(connector): [cybersource] Implement 3DS flow for cards (#3290)
  chore: remove connector auth TOML files from `.gitignore` and `.dockerignore` (#3330)
  fix(refund): add merchant_connector_id in refund (#3303)
  feat(connector): [BOA/CYB] Store AVS response in connector_metadata (#3271)
  feat(outgoingwebhookevent): adding api for query to fetch outgoing webhook events log (#3310)
  feat(router): payment_method block (#3056)
  feat(connector): [Volt] Add support for refund webhooks  (#3326)
  feat(users): invite user without email (#3328)
  feat(euclid_wasm): config changes for NMI (#3329)
  refactor(router): restricted list payment method Customer to api-key based (#3100)
  feat(connector): [BOA/Cyb] Include merchant metadata in capture and void requests (#3308)
  fix(router): add config to avoid connector tokenization for `apple pay` `simplified flow` (#3234)
  refactor(router): flagged order_details validation to skip validation (#3116)
  fix(core): surcharge with saved card failure (#3318)
  feat(payment_link): Added sdk layout option payment link (#3207)
  chore(version): 2024.01.11.0
  ...
…to add-metrics-router

* 'add-metrics-router' of github.com:juspay/hyperswitch:
@pixincreate pixincreate added A-core Area: Core flows S-waiting-on-review Status: This PR has been implemented and needs to be reviewed labels Jan 12, 2024
@SanchithHegde SanchithHegde added S-waiting-on-author Status: This PR is incomplete or needs to address review comments and removed S-waiting-on-review Status: This PR has been implemented and needs to be reviewed labels Jan 14, 2024
@pixincreate pixincreate added S-waiting-on-review Status: This PR has been implemented and needs to be reviewed and removed S-waiting-on-author Status: This PR is incomplete or needs to address review comments labels Jan 14, 2024
…-router

* 'main' of github.com:juspay/hyperswitch:
  fix(payment_link): added expires_on in payment response (#3332)
  fix(connector_onboarding): Check if connector exists for the merchant account and add reset tracking id API (#3229)
  chore(version): 2024.01.12.1
  chore: add api reference for blocklist (#3336)
SanchithHegde
SanchithHegde previously approved these changes Jan 16, 2024
@pixincreate pixincreate added this pull request to the merge queue Jan 18, 2024
Merged via the queue into main with commit b4df40d Jan 18, 2024
9 checks passed
@pixincreate pixincreate deleted the add-metrics-router branch January 18, 2024 10:29
@pixincreate pixincreate removed the S-waiting-on-review Status: This PR has been implemented and needs to be reviewed label Jan 18, 2024
pixincreate added a commit that referenced this pull request Jan 18, 2024
* 'main' of github.com:juspay/hyperswitch:
  feat(users): Added get role from jwt api (#3385)
  feat(users): Add `preferred_merchant_id` column and update user details API (#3373)
  chore(version): 2024.01.18.1
  refactor(core): add locker config to enable or disable locker  (#3352)
  fix(connector): [Cashtocode] update amount from i64 to f64 in webhook payload (#3382)
  fix(metrics): Add TASKS_ADDED_COUNT and TASKS_RESET_COUNT metrics in router scheduler flow (#3189)
  fix(connector): Trustpay zen error mapping (#3255)
  fix(user): fetch profile_id for sample data (#3358)
  refactor(connector): [Volt] Refactor Payments and Refunds Webhooks (#3377)
  chore(version): 2024.01.18.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-core Area: Core flows C-bug Category: Bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Add metrics in router scheduler flow as it is being ignored now
4 participants