Bug: [FEAT] Add benchmarking for encryption/decryption



**Description:**

Cripta is a service which creates keys and maintains it (includes key rotation etc.) individually for different Merchants and Users.

We need to add a tool which benchmarks the internal encryption/decryption implementation, And any changes to the application should not cause any Perf regressions.

**Possible implementation:**

- Add `benches` folder for different benchmarking scenarios
- Use [criterion.rs](https://github.com/bheisler/criterion.rs) for benchmarking
- Call [this](https://github.com/juspay/hyperswitch-encryption-service/blob/main/src/core/crypto/crux.rs#L29) fuction in criterion to benchmark

### Submission Process:
- Ask the maintainers for assignment of the issue, you can request for assignment by commenting on the issue itself.
- Once assigned, submit a pull request (PR).
- Maintainers will review and provide feedback, if any. 
- Maintainers can unassign issues due to inactivity, [read more here](https://github.com/juspay/hyperswitch/wiki/Hacktoberfest-Contribution-Rules).
- For this issue, please raise a PR on the https://github.com/juspay/hyperswitch-encryption-service repo, and link the issue.


Refer [here](https://github.com/juspay/hyperswitch/blob/main/docs/TERMS_OF_CONTEST.md) for Terms and conditions for the contest.
diff --git a/Cargo.lock b/Cargo.lock
index 8472b79d44e..20f3b17c44f 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -91,7 +91,7 @@ dependencies = [
  "rand",
  "sha1",
  "smallvec",
- "tracing",
+ "tracing 0.1.36",
  "zstd",
 ]
 
@@ -115,7 +115,7 @@ dependencies = [
  "http",
  "regex",
  "serde",
- "tracing",
+ "tracing 0.1.36",
 ]
 
 [[package]]
@@ -144,7 +144,7 @@ dependencies = [
  "num_cpus",
  "socket2",
  "tokio",
- "tracing",
+ "tracing 0.1.36",
 ]
 
 [[package]]
@@ -439,7 +439,7 @@ dependencies = [
  "time",
  "tokio",
  "tower",
- "tracing",
+ "tracing 0.1.36",
  "zeroize",
 ]
 
@@ -454,7 +454,7 @@ dependencies = [
  "aws-types",
  "http",
  "regex",
- "tracing",
+ "tracing 0.1.36",
 ]
 
 [[package]]
@@ -472,7 +472,7 @@ dependencies = [
  "lazy_static",
  "percent-encoding",
  "pin-project-lite",
- "tracing",
+ "tracing 0.1.36",
 ]
 
 [[package]]
@@ -551,7 +551,7 @@ dependencies = [
  "aws-smithy-http",
  "aws-types",
  "http",
- "tracing",
+ "tracing 0.1.36",
 ]
 
 [[package]]
@@ -569,7 +569,7 @@ dependencies = [
  "regex",
  "ring",
  "time",
- "tracing",
+ "tracing 0.1.36",
 ]
 
 [[package]]
@@ -604,7 +604,7 @@ dependencies = [
  "pin-project-lite",
  "tokio",
  "tower",
- "tracing",
+ "tracing 0.1.36",
 ]
 
 [[package]]
@@ -625,7 +625,7 @@ dependencies = [
  "pin-project-lite",
  "tokio",
  "tokio-util 0.7.4",
- "tracing",
+ "tracing 0.1.36",
 ]
 
 [[package]]
@@ -640,7 +640,7 @@ dependencies = [
  "http-body",
  "pin-project-lite",
  "tower",
- "tracing",
+ "tracing 0.1.36",
 ]
 
 [[package]]
@@ -695,10 +695,55 @@ dependencies = [
  "aws-smithy-types",
  "http",
  "rustc_version",
- "tracing",
+ "tracing 0.1.36",
  "zeroize",
 ]
 
+[[package]]
+name = "axum"
+version = "0.5.17"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "acee9fd5073ab6b045a275b3e709c163dd36c90685219cb21804a147b58dba43"
+dependencies = [
+ "async-trait",
+ "axum-core",
+ "bitflags",
+ "bytes",
+ "futures-util",
+ "http",
+ "http-body",
+ "hyper",
+ "itoa 1.0.3",
+ "matchit",
+ "memchr",
+ "mime",
+ "percent-encoding",
+ "pin-project-lite",
+ "serde",
+ "sync_wrapper",
+ "tokio",
+ "tower",
+ "tower-http",
+ "tower-layer",
+ "tower-service",
+]
+
+[[package]]
+name = "axum-core"
+version = "0.2.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "37e5939e02c56fecd5c017c37df4238c0a839fa76b7f97acdd7efb804fd181cc"
+dependencies = [
+ "async-trait",
+ "bytes",
+ "futures-util",
+ "http",
+ "http-body",
+ "mime",
+ "tower-layer",
+ "tower-service",
+]
+
 [[package]]
 name = "base64"
 version = "0.13.0"
@@ -965,12 +1010,15 @@ dependencies = [
 
 [[package]]
 name = "dashmap"
-version = "4.0.2"
+version = "5.4.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e77a43b28d0668df09411cb0bc9a8c2adc40f9a048afe863e05fd43251e8e39c"
+checksum = "907076dfda823b0b36d2a1bb5f90c96660a5bbcd7729e10727f07858f22c4edc"
 dependencies = [
  "cfg-if",
- "num_cpus",
+ "hashbrown",
+ "lock_api",
+ "once_cell",
+ "parking_lot_core 0.9.3",
 ]
 
 [[package]]
@@ -1111,12 +1159,6 @@ dependencies = [
  "instant",
 ]
 
-[[package]]
-name = "fixedbitset"
-version = "0.4.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80"
-
 [[package]]
 name = "flate2"
 version = "1.0.24"
@@ -1193,7 +1235,7 @@ dependencies = [
  "tokio-native-tls",
  "tokio-stream",
  "tokio-util 0.6.10",
- "tracing",
+ "tracing 0.1.36",
  "tracing-futures",
  "url",
 ]
@@ -1359,7 +1401,7 @@ dependencies = [
  "slab",
  "tokio",
  "tokio-util 0.7.4",
- "tracing",
+ "tracing 0.1.36",
 ]
 
 [[package]]
@@ -1423,6 +1465,12 @@ dependencies = [
  "pin-project-lite",
 ]
 
+[[package]]
+name = "http-range-header"
+version = "0.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0bfe8eed0a9285ef776bb792479ea3834e8b94e13d615c2f66d03dd50a435a29"
+
 [[package]]
 name = "httparse"
 version = "1.8.0"
@@ -1464,7 +1512,7 @@ dependencies = [
  "socket2",
  "tokio",
  "tower-service",
- "tracing",
+ "tracing 0.1.36",
  "want",
 ]
 
@@ -1712,6 +1760,12 @@ dependencies = [
  "regex-automata",
 ]
 
+[[package]]
+name = "matchit"
+version = "0.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "73cbba799671b762df5a175adf59ce145165747bb891505c43d09aefbbf38beb"
+
 [[package]]
 name = "maud"
 version = "0.24.0"
@@ -1775,12 +1829,6 @@ dependencies = [
  "windows-sys",
 ]
 
-[[package]]
-name = "multimap"
-version = "0.8.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a"
-
 [[package]]
 name = "nanoid"
 version = "0.4.0"
@@ -1930,8 +1978,6 @@ checksum = "6105e89802af13fdf48c49d7646d3b533a70e536d818aae7e78ba0433d01acb8"
 dependencies = [
  "async-trait",
  "crossbeam-channel",
- "dashmap",
- "fnv",
  "futures-channel",
  "futures-executor",
  "futures-util",
@@ -1941,26 +1987,80 @@ dependencies = [
  "pin-project",
  "rand",
  "thiserror",
- "tokio",
- "tokio-stream",
+]
+
+[[package]]
+name = "opentelemetry"
+version = "0.18.0"
+source = "git+https://github.com/jarnura/opentelemetry-rust?rev=a82056696ca3d26960458269a894e5cf15056ad8#a82056696ca3d26960458269a894e5cf15056ad8"
+dependencies = [
+ "opentelemetry_api",
+ "opentelemetry_sdk",
 ]
 
 [[package]]
 name = "opentelemetry-otlp"
-version = "0.10.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9d1a6ca9de4c8b00aa7f1a153bd76cb263287155cec642680d79d98706f3d28a"
+version = "0.11.0"
+source = "git+https://github.com/jarnura/opentelemetry-rust?rev=a82056696ca3d26960458269a894e5cf15056ad8#a82056696ca3d26960458269a894e5cf15056ad8"
 dependencies = [
  "async-trait",
  "futures",
  "futures-util",
  "http",
- "opentelemetry",
+ "opentelemetry 0.18.0",
+ "opentelemetry-proto",
  "prost",
  "thiserror",
  "tokio",
  "tonic",
- "tonic-build",
+]
+
+[[package]]
+name = "opentelemetry-proto"
+version = "0.1.0"
+source = "git+https://github.com/jarnura/opentelemetry-rust?rev=a82056696ca3d26960458269a894e5cf15056ad8#a82056696ca3d26960458269a894e5cf15056ad8"
+dependencies = [
+ "futures",
+ "futures-util",
+ "opentelemetry 0.18.0",
+ "prost",
+ "tonic",
+]
+
+[[package]]
+name = "opentelemetry_api"
+version = "0.18.0"
+source = "git+https://github.com/jarnura/opentelemetry-rust?rev=a82056696ca3d26960458269a894e5cf15056ad8#a82056696ca3d26960458269a894e5cf15056ad8"
+dependencies = [
+ "fnv",
+ "futures-channel",
+ "futures-util",
+ "indexmap",
+ "js-sys",
+ "once_cell",
+ "pin-project-lite",
+ "thiserror",
+]
+
+[[package]]
+name = "opentelemetry_sdk"
+version = "0.18.0"
+source = "git+https://github.com/jarnura/opentelemetry-rust?rev=a82056696ca3d26960458269a894e5cf15056ad8#a82056696ca3d26960458269a894e5cf15056ad8"
+dependencies = [
+ "async-trait",
+ "crossbeam-channel",
+ "dashmap",
+ "fnv",
+ "futures-channel",
+ "futures-executor",
+ "futures-util",
+ "once_cell",
+ "opentelemetry_api",
+ "percent-encoding",
+ "rand",
+ "thiserror",
+ "tokio",
+ "tokio-stream",
 ]
 
 [[package]]
@@ -2092,16 +2192,6 @@ dependencies = [
  "sha1",
 ]
 
-[[package]]
-name = "petgraph"
-version = "0.6.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e6d5014253a1331579ce62aa67443b4a658c5e7dd03d4bc6d302b94474888143"
-dependencies = [
- "fixedbitset",
- "indexmap",
-]
-
 [[package]]
 name = "pin-project"
 version = "1.0.12"
@@ -2200,39 +2290,19 @@ dependencies = [
 
 [[package]]
 name = "prost"
-version = "0.9.0"
+version = "0.11.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "444879275cb4fd84958b1a1d5420d15e6fcf7c235fe47f053c9c2a80aceb6001"
+checksum = "a0841812012b2d4a6145fae9a6af1534873c32aa67fff26bd09f8fa42c83f95a"
 dependencies = [
  "bytes",
  "prost-derive",
 ]
 
-[[package]]
-name = "prost-build"
-version = "0.9.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "62941722fb675d463659e49c4f3fe1fe792ff24fe5bbaa9c08cd3b98a1c354f5"
-dependencies = [
- "bytes",
- "heck 0.3.3",
- "itertools",
- "lazy_static",
- "log",
- "multimap",
- "petgraph",
- "prost",
- "prost-types",
- "regex",
- "tempfile",
- "which",
-]
-
 [[package]]
 name = "prost-derive"
-version = "0.9.0"
+version = "0.11.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f9cc1a3263e07e0bf68e96268f37665207b49560d98739662cdfaae215c720fe"
+checksum = "164ae68b6587001ca506d3bf7f1000bfa248d0e1217b618108fba4ec1d0cc306"
 dependencies = [
  "anyhow",
  "itertools",
@@ -2241,16 +2311,6 @@ dependencies = [
  "syn",
 ]
 
-[[package]]
-name = "prost-types"
-version = "0.9.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "534b7a0e836e3c482d2693070f982e39e7611da9695d4d1f5a4b186b51faef0a"
-dependencies = [
- "bytes",
- "prost",
-]
-
 [[package]]
 name = "quick-error"
 version = "1.2.3"
@@ -2518,7 +2578,7 @@ dependencies = [
  "config",
  "gethostname",
  "once_cell",
- "opentelemetry",
+ "opentelemetry 0.18.0",
  "opentelemetry-otlp",
  "rustc-hash",
  "serde",
@@ -2527,12 +2587,12 @@ dependencies = [
  "strum",
  "time",
  "tokio",
- "tracing",
+ "tracing 0.1.36",
  "tracing-actix-web",
  "tracing-appender",
- "tracing-core",
- "tracing-opentelemetry",
- "tracing-subscriber",
+ "tracing-core 0.1.29",
+ "tracing-opentelemetry 0.16.0",
+ "tracing-subscriber 0.3.15",
  "vergen",
 ]
 
@@ -2895,6 +2955,12 @@ dependencies = [
  "unicode-ident",
 ]
 
+[[package]]
+name = "sync_wrapper"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "20518fe4a4c9acf048008599e464deb21beeae3d3578418951a189c235a7a9a8"
+
 [[package]]
 name = "sysinfo"
 version = "0.26.4"
@@ -3113,7 +3179,7 @@ dependencies = [
  "futures-sink",
  "pin-project-lite",
  "tokio",
- "tracing",
+ "tracing 0.1.36",
 ]
 
 [[package]]
@@ -3127,12 +3193,13 @@ dependencies = [
 
 [[package]]
 name = "tonic"
-version = "0.6.2"
+version = "0.8.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ff08f4649d10a70ffa3522ca559031285d8e421d727ac85c60825761818f5d0a"
+checksum = "55b9af819e54b8f33d453655bef9b9acc171568fb49523078d0cc4e7484200ec"
 dependencies = [
  "async-stream",
  "async-trait",
+ "axum",
  "base64",
  "bytes",
  "futures-core",
@@ -3148,26 +3215,14 @@ dependencies = [
  "prost-derive",
  "tokio",
  "tokio-stream",
- "tokio-util 0.6.10",
+ "tokio-util 0.7.4",
  "tower",
  "tower-layer",
  "tower-service",
- "tracing",
+ "tracing 0.1.36",
  "tracing-futures",
 ]
 
-[[package]]
-name = "tonic-build"
-version = "0.6.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9403f1bafde247186684b230dc6f38b5cd514584e8bec1dd32514be4745fa757"
-dependencies = [
- "proc-macro2",
- "prost-build",
- "quote",
- "syn",
-]
-
 [[package]]
 name = "tower"
 version = "0.4.13"
@@ -3185,7 +3240,26 @@ dependencies = [
  "tokio-util 0.7.4",
  "tower-layer",
  "tower-service",
- "tracing",
+ "tracing 0.1.36",
+]
+
+[[package]]
+name = "tower-http"
+version = "0.3.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3c530c8675c1dbf98facee631536fa116b5fb6382d7dd6dc1b118d970eafe3ba"
+dependencies = [
+ "bitflags",
+ "bytes",
+ "futures-core",
+ "futures-util",
+ "http",
+ "http-body",
+ "http-range-header",
+ "pin-project-lite",
+ "tower",
+ "tower-layer",
+ "tower-service",
 ]
 
 [[package]]
@@ -3210,7 +3284,17 @@ dependencies = [
  "log",
  "pin-project-lite",
  "tracing-attributes",
- "tracing-core",
+ "tracing-core 0.1.29",
+]
+
+[[package]]
+name = "tracing"
+version = "0.2.0"
+source = "git+https://github.com/jarnura/tracing?rev=16d277227f60788750528e4f4cc1db4f36b0869f#16d277227f60788750528e4f4cc1db4f36b0869f"
+dependencies = [
+ "cfg-if",
+ "pin-project-lite",
+ "tracing-core 0.2.0",
 ]
 
 [[package]]
@@ -3220,10 +3304,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "ee7247a77b494ee07bda43bce40a33e76f885662f11b3dda9894ecfdbe31fa06"
 dependencies = [
  "actix-web",
- "opentelemetry",
+ "opentelemetry 0.17.0",
  "pin-project",
- "tracing",
- "tracing-opentelemetry",
+ "tracing 0.1.36",
+ "tracing-opentelemetry 0.17.4",
  "uuid",
 ]
 
@@ -3235,7 +3319,7 @@ checksum = "09d48f71a791638519505cefafe162606f706c25592e4bde4d97600c0195312e"
 dependencies = [
  "crossbeam-channel",
  "time",
- "tracing-subscriber",
+ "tracing-subscriber 0.3.15",
 ]
 
 [[package]]
@@ -3259,6 +3343,14 @@ dependencies = [
  "valuable",
 ]
 
+[[package]]
+name = "tracing-core"
+version = "0.2.0"
+source = "git+https://github.com/jarnura/tracing?rev=16d277227f60788750528e4f4cc1db4f36b0869f#16d277227f60788750528e4f4cc1db4f36b0869f"
+dependencies = [
+ "once_cell",
+]
+
 [[package]]
 name = "tracing-futures"
 version = "0.2.5"
@@ -3266,7 +3358,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2"
 dependencies = [
  "pin-project",
- "tracing",
+ "tracing 0.1.36",
 ]
 
 [[package]]
@@ -3277,7 +3369,31 @@ checksum = "78ddad33d2d10b1ed7eb9d1f518a5674713876e97e5bb9b7345a7984fbb4f922"
 dependencies = [
  "lazy_static",
  "log",
- "tracing-core",
+ "tracing-core 0.1.29",
+]
+
+[[package]]
+name = "tracing-log"
+version = "0.2.0"
+source = "git+https://github.com/jarnura/tracing?rev=16d277227f60788750528e4f4cc1db4f36b0869f#16d277227f60788750528e4f4cc1db4f36b0869f"
+dependencies = [
+ "log",
+ "once_cell",
+ "tracing-core 0.2.0",
+]
+
+[[package]]
+name = "tracing-opentelemetry"
+version = "0.16.0"
+source = "git+https://github.com/jarnura/tracing?rev=16d277227f60788750528e4f4cc1db4f36b0869f#16d277227f60788750528e4f4cc1db4f36b0869f"
+dependencies = [
+ "async-trait",
+ "once_cell",
+ "opentelemetry 0.18.0",
+ "tracing 0.2.0",
+ "tracing-core 0.2.0",
+ "tracing-log 0.2.0",
+ "tracing-subscriber 0.3.0",
 ]
 
 [[package]]
@@ -3287,11 +3403,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "fbbe89715c1dbbb790059e2565353978564924ee85017b5fff365c872ff6721f"
 dependencies = [
  "once_cell",
- "opentelemetry",
- "tracing",
- "tracing-core",
- "tracing-log",
- "tracing-subscriber",
+ "opentelemetry 0.17.0",
+ "tracing 0.1.36",
+ "tracing-core 0.1.29",
+ "tracing-log 0.1.3",
+ "tracing-subscriber 0.3.15",
 ]
 
 [[package]]
@@ -3301,7 +3417,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "bc6b213177105856957181934e4920de57730fc69bf42c37ee5bb664d406d9e1"
 dependencies = [
  "serde",
- "tracing-core",
+ "tracing-core 0.1.29",
+]
+
+[[package]]
+name = "tracing-subscriber"
+version = "0.3.0"
+source = "git+https://github.com/jarnura/tracing?rev=16d277227f60788750528e4f4cc1db4f36b0869f#16d277227f60788750528e4f4cc1db4f36b0869f"
+dependencies = [
+ "sharded-slab",
+ "thread_local",
+ "tracing-core 0.2.0",
 ]
 
 [[package]]
@@ -3319,9 +3445,9 @@ dependencies = [
  "sharded-slab",
  "smallvec",
  "thread_local",
- "tracing",
- "tracing-core",
- "tracing-log",
+ "tracing 0.1.36",
+ "tracing-core 0.1.29",
+ "tracing-log 0.1.3",
  "tracing-serde",
 ]
 
@@ -3573,17 +3699,6 @@ dependencies = [
  "webpki 0.22.0",
 ]
 
-[[package]]
-name = "which"
-version = "4.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1c831fbbee9e129a8cf93e7747a82da9d95ba8e16621cae60ec2cdc849bacb7b"
-dependencies = [
- "either",
- "libc",
- "once_cell",
-]
-
 [[package]]
 name = "winapi"
 version = "0.3.9"
diff --git a/crates/router/src/core/payments/flows/authorize_flow.rs b/crates/router/src/core/payments/flows/authorize_flow.rs
index bfb03e5f827..cdac412b785 100644
--- a/crates/router/src/core/payments/flows/authorize_flow.rs
+++ b/crates/router/src/core/payments/flows/authorize_flow.rs
@@ -75,7 +75,7 @@ impl Feature<api::Authorize, types::PaymentsRequestData>
             )
             .await;
 
-        metrics::PAYMENT_COUNT.add(1, &[]); // Metrics
+        metrics::PAYMENT_COUNT.add(&metrics::CONTEXT, 1, &[]); // Metrics
 
         (resp, payment_data)
     }
diff --git a/crates/router/src/core/payments/operations.rs b/crates/router/src/core/payments/operations.rs
index 1b403b8615a..78e837cb757 100644
--- a/crates/router/src/core/payments/operations.rs
+++ b/crates/router/src/core/payments/operations.rs
@@ -212,7 +212,7 @@ where
         payment_attempt: &storage::PaymentAttempt,
     ) -> CustomResult<(), errors::ApiErrorResponse> {
         if helpers::check_if_operation_confirm(self) {
-            metrics::TASKS_ADDED_COUNT.add(1, &[]); // Metrics
+            metrics::TASKS_ADDED_COUNT.add(&metrics::CONTEXT, 1, &[]); // Metrics
 
             let schedule_time = payment_sync::get_sync_process_schedule_time(
                 &payment_attempt.connector,
diff --git a/crates/router/src/routes/health.rs b/crates/router/src/routes/health.rs
index 34c9321501d..cc0b72318b3 100644
--- a/crates/router/src/routes/health.rs
+++ b/crates/router/src/routes/health.rs
@@ -3,14 +3,14 @@ use router_env::{
     tracing::{self, instrument},
 };
 
-use crate::routes::metrics::HEALTH_METRIC;
+use crate::routes::metrics;
 
 /// .
 // #[logger::instrument(skip_all, name = "name1", level = "warn", fields( key1 = "val1" ))]
 #[instrument(skip_all)]
 // #[actix_web::get("/health")]
 pub async fn health() -> impl actix_web::Responder {
-    HEALTH_METRIC.add(1, &[]);
+    metrics::HEALTH_METRIC.add(&metrics::CONTEXT, 1, &[]);
     logger::info!("Health was called");
     actix_web::HttpResponse::Ok().body("health is good")
 }
diff --git a/crates/router/src/routes/metrics.rs b/crates/router/src/routes/metrics.rs
index 8cd573aef56..da21095b5d4 100644
--- a/crates/router/src/routes/metrics.rs
+++ b/crates/router/src/routes/metrics.rs
@@ -4,8 +4,10 @@ use once_cell::sync::Lazy;
 use router_env::opentelemetry::{
     global,
     metrics::{Counter, Meter},
+    Context,
 };
 
+pub static CONTEXT: Lazy<Context> = Lazy::new(Context::current);
 static GLOBAL_METER: Lazy<Meter> = Lazy::new(|| global::meter("ROUTER_API"));
 
 pub(crate) static HEALTH_METRIC: Lazy<Counter<u64>> =
diff --git a/crates/router/src/scheduler/consumer.rs b/crates/router/src/scheduler/consumer.rs
index 41f12853cd5..2b5fb45c0d0 100644
--- a/crates/router/src/scheduler/consumer.rs
+++ b/crates/router/src/scheduler/consumer.rs
@@ -118,7 +118,7 @@ pub async fn consumer_operations(
 
         pt_utils::add_histogram_metrics(&pickup_time, task, &stream_name);
 
-        metrics::TASK_CONSUMED.add(1, &[]);
+        metrics::TASK_CONSUMED.add(&metrics::CONTEXT, 1, &[]);
         let runner = pt_utils::runner_from_task(task)?;
         handler.push(tokio::task::spawn(start_workflow(
             state.clone(),
@@ -206,7 +206,7 @@ pub async fn run_executor<'a>(
             }
         },
     };
-    metrics::TASK_PROCESSED.add(1, &[]);
+    metrics::TASK_PROCESSED.add(&metrics::CONTEXT, 1, &[]);
 }
 
 #[instrument(skip_all)]
diff --git a/crates/router/src/scheduler/metrics.rs b/crates/router/src/scheduler/metrics.rs
index 7967c0cbc93..1a87248a734 100644
--- a/crates/router/src/scheduler/metrics.rs
+++ b/crates/router/src/scheduler/metrics.rs
@@ -1,15 +1,15 @@
 use once_cell::sync::Lazy;
 use router_env::opentelemetry::{
     global,
-    metrics::{Counter, Meter, ValueRecorder},
+    metrics::{Counter, Histogram, Meter},
+    Context,
 };
 
+pub static CONTEXT: Lazy<Context> = Lazy::new(Context::current);
 static PT_METER: Lazy<Meter> = Lazy::new(|| global::meter("PROCESS_TRACKER"));
 
-// Using ValueRecorder till https://bitbucket.org/juspay/orca/pull-requests/319
-// Histogram available in opentelemetry:0.18
-pub(crate) static CONSUMER_STATS: Lazy<ValueRecorder<f64>> =
-    Lazy::new(|| PT_METER.f64_value_recorder("CONSUMER_OPS").init());
+pub(crate) static CONSUMER_STATS: Lazy<Histogram<f64>> =
+    Lazy::new(|| PT_METER.f64_histogram("CONSUMER_OPS").init());
 
 macro_rules! create_counter {
     ($name:ident, $meter:ident) => {
diff --git a/crates/router/src/scheduler/producer.rs b/crates/router/src/scheduler/producer.rs
index 0c4ab2ca810..f903230d60c 100644
--- a/crates/router/src/scheduler/producer.rs
+++ b/crates/router/src/scheduler/producer.rs
@@ -125,6 +125,6 @@ pub async fn fetch_producer_tasks(
     }
 
     new_tasks.append(&mut pending_tasks);
-    metrics::TASKS_PICKED_COUNT.add(new_tasks.len() as u64, &[]);
+    metrics::TASKS_PICKED_COUNT.add(&metrics::CONTEXT, new_tasks.len() as u64, &[]);
     Ok(new_tasks)
 }
diff --git a/crates/router/src/scheduler/utils.rs b/crates/router/src/scheduler/utils.rs
index d64955ab4a6..cf86bd06316 100644
--- a/crates/router/src/scheduler/utils.rs
+++ b/crates/router/src/scheduler/utils.rs
@@ -72,7 +72,7 @@ pub async fn divide_and_append_tasks(
     settings: &SchedulerSettings,
 ) -> CustomResult<(), errors::ProcessTrackerError> {
     let batches = divide(tasks, settings);
-    metrics::BATCHES_CREATED.add(batches.len() as u64, &[]); // Metrics
+    metrics::BATCHES_CREATED.add(&metrics::CONTEXT, batches.len() as u64, &[]); // Metrics
     for batch in batches {
         let result = update_status_and_append(state, flow, batch).await;
         match result {
@@ -209,7 +209,7 @@ pub async fn get_batches(
             logger::error!(%error, "Error finding batch in stream");
             error.change_context(errors::ProcessTrackerError::BatchNotFound)
         })?;
-    metrics::BATCHES_CONSUMED.add(1, &[]);
+    metrics::BATCHES_CONSUMED.add(&metrics::CONTEXT, 1, &[]);
 
     let (batches, entry_ids): (Vec<Vec<ProcessTrackerBatch>>, Vec<Vec<String>>) = response.into_iter().map(|(_key, entries)| {
         entries.into_iter().try_fold(
@@ -303,6 +303,7 @@ pub fn add_histogram_metrics(
         logger::error!(%pickup_schedule_delta, "<- Time delta for scheduled tasks");
         let runner_name = runner.clone();
         metrics::CONSUMER_STATS.record(
+            &metrics::CONTEXT,
             pickup_schedule_delta,
             &[opentelemetry::KeyValue::new(
                 stream_name.to_owned(),
diff --git a/crates/router/src/types/storage/process_tracker.rs b/crates/router/src/types/storage/process_tracker.rs
index fa9ac368bac..b460b6ba421 100644
--- a/crates/router/src/types/storage/process_tracker.rs
+++ b/crates/router/src/types/storage/process_tracker.rs
@@ -77,7 +77,7 @@ impl ProcessTracker {
         db: &dyn db::Db,
         schedule_time: PrimitiveDateTime,
     ) -> Result<(), errors::ProcessTrackerError> {
-        metrics::TASK_RETRIED.add(1, &[]);
+        metrics::TASK_RETRIED.add(&metrics::CONTEXT, 1, &[]);
         db.update_process_tracker(
             self.clone(),
             ProcessTrackerUpdate::StatusRetryUpdate {
@@ -104,7 +104,7 @@ impl ProcessTracker {
         )
         .await
         .attach_printable("Failed while updating status of the process")?;
-        metrics::TASK_FINISHED.add(1, &[]);
+        metrics::TASK_FINISHED.add(&metrics::CONTEXT, 1, &[]);
         Ok(())
     }
 }
diff --git a/crates/router_env/Cargo.toml b/crates/router_env/Cargo.toml
index e97dc09d198..dfe88f6a104 100644
--- a/crates/router_env/Cargo.toml
+++ b/crates/router_env/Cargo.toml
@@ -12,8 +12,9 @@ build = "src/build.rs"
 config = { version = "0.13.2", features = ["toml"] }
 gethostname = "0.2.3"
 once_cell = "1.15.0"
-opentelemetry = { version = "0.17", features = ["rt-tokio-current-thread", "metrics"] }
-opentelemetry-otlp = { version = "0.10", features = ["metrics"] }
+opentelemetry = { git = "https://github.com/jarnura/opentelemetry-rust", rev = "a82056696ca3d26960458269a894e5cf15056ad8",  features = ["rt-tokio-current-thread", "metrics"] }
+opentelemetry-otlp = { git = "https://github.com/jarnura/opentelemetry-rust", rev = "a82056696ca3d26960458269a894e5cf15056ad8", features = ["metrics"] }
+
 rustc-hash = "1.1"
 serde = { version = "1.0.145", features = ["derive"] }
 serde_json = "1.0.85"
@@ -25,7 +26,7 @@ tracing = "0.1.36"
 tracing-actix-web = { version = "0.6.1", features = ["opentelemetry_0_17"], optional = true }
 tracing-appender = "0.2.2"
 tracing-core = "0.1.29"
-tracing-opentelemetry = { version = "0.17" }
+tracing-opentelemetry = { git = "https://github.com/jarnura/tracing", rev = "16d277227f60788750528e4f4cc1db4f36b0869f" }
 tracing-subscriber = { version = "0.3.15", default-features = true, features = ["json", "env-filter", "registry"] }
 vergen = { version = "7.4.2", optional = true }
 
diff --git a/crates/router_env/src/logger/setup.rs b/crates/router_env/src/logger/setup.rs
index 2eb7f181709..4ba3bbc3429 100644
--- a/crates/router_env/src/logger/setup.rs
+++ b/crates/router_env/src/logger/setup.rs
@@ -3,20 +3,19 @@
 //!
 use std::{path::PathBuf, time::Duration};
 
+use once_cell::sync::Lazy;
 use opentelemetry::{
-    global,
+    global, runtime,
     sdk::{
-        metrics::{selectors, PushController},
+        export::metrics::aggregation::cumulative_temporality_selector,
+        metrics::{controllers::BasicController, selectors::simple},
         propagation::TraceContextPropagator,
         trace, Resource,
     },
-    util::tokio_interval_stream,
     KeyValue,
 };
 use opentelemetry_otlp::WithExportConfig;
 use tracing_appender::non_blocking::WorkerGuard;
-// use tracing_subscriber::fmt::format::FmtSpan;
-// use tracing_bunyan_formatter::JsonStorageLayer;
 use tracing_subscriber::{
     filter, fmt, layer::SubscriberExt, util::SubscriberInitExt, EnvFilter, Layer,
 };
@@ -51,7 +50,7 @@ where
 #[derive(Debug)]
 pub struct TelemetryGuard {
     _log_guards: Vec<WorkerGuard>,
-    _metric_controller: Option<PushController>,
+    _metric_controller: Option<BasicController>,
 }
 
 ///
@@ -92,29 +91,13 @@ pub fn setup<Str: AsRef<str>>(
 
         let file_filter = filter::Targets::new().with_default(conf.file.level.into_level());
         let file_layer = FormattingLayer::new(service_name, file_writer).with_filter(file_filter);
-        // let fmt_layer = fmt::layer()
-        //     .with_writer(file_writer)
-        //     .with_target(true)
-        //     .with_level(true)
-        //     .with_span_events(FmtSpan::ACTIVE)
-        //     .json();
-
-        // Some(fmt_layer)
-        //Some(FormattingLayer::new(service_name, file_writer))
         Some(file_layer)
-        // Some(BunyanFormattingLayer::new("router".into(), file_writer))
     } else {
         None
     };
 
-    let telemetry_layer = match telemetry {
-        Some(Ok(ref tracer)) => Some(tracing_opentelemetry::layer().with_tracer(tracer.clone())),
-        _ => None,
-    };
-
     // Use 'RUST_LOG' environment variable will override the config settings
     let subscriber = tracing_subscriber::registry()
-        .with(telemetry_layer)
         .with(StorageSubscription)
         .with(file_writer)
         .with(
@@ -166,15 +149,29 @@ pub fn setup<Str: AsRef<str>>(
     })
 }
 
-fn setup_metrics() -> Option<PushController> {
+static HISTOGRAM_BUCKETS: Lazy<[f64; 15]> = Lazy::new(|| {
+    let mut init = 0.01;
+    let mut buckets: [f64; 15] = [0.0; 15];
+
+    for bucket in &mut buckets {
+        init *= 2.0;
+        *bucket = init;
+    }
+    buckets
+});
+
+fn setup_metrics() -> Option<BasicController> {
     opentelemetry_otlp::new_pipeline()
-        .metrics(tokio::spawn, tokio_interval_stream)
+        .metrics(
+            simple::histogram(*HISTOGRAM_BUCKETS),
+            cumulative_temporality_selector(),
+            runtime::TokioCurrentThread,
+        )
         .with_exporter(
             opentelemetry_otlp::new_exporter().tonic().with_env(), // can also config it using with_* functions like the tracing part above.
         )
         .with_period(Duration::from_secs(3))
         .with_timeout(Duration::from_secs(10))
-        .with_aggregator_selector(selectors::simple::Selector::Exact)
         .build()
         .map_err(|err| eprintln!("Failed to Setup Metrics with {:?}", err))
         .ok()

## Type of Change
<!-- Put an `x` in the boxes that apply -->

- [ ] Bugfix
- [x] New feature
- [ ] Enhancement
- [ ] Refactoring
- [x] Dependency updates

## Description
This change includes changes for adding histogram with additional requirement on updating the current telemetry dependencies. (this is a temporary change discussed with @jarnura, for initial deployment of scheduler unit 
<!-- Describe your changes in detail -->


### Additional Changes

- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables

<!-- 
Provide links to the files with corresponding changes.

Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->


## Motivation and Context
For adding the histogram functionality in the metrics a new version of opentelemetry was required. This change disables certain functionality from the `router_env`crate
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.

If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless its an obvious bug or documentation fix
that will have little conversation).
-->


## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->


## Checklist
<!-- Put an `x` in the boxes that apply -->

- [x] I formatted the code `cargo +nightly fmt`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed submitted code
- [ ] I added unit tests for my changes where possible
- [ ] I added a [CHANGELOG](/CHANGELOG.md) entry if applicable
