feat(multitenancy): add tenant_id as a field for data pipeline and support individual database for clickhouse (#4867)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
Co-authored-by: Arun Raj M <jarnura47@gmail.com>
Co-authored-by: Sampras Lopes <sampras.lopes@juspay.in>
This commit is contained in:
Jagan
2024-06-18 18:58:46 +05:30
committed by GitHub
parent d2092dcb0a
commit 776ddb8c1a
15 changed files with 55 additions and 68 deletions

View File

@ -1,3 +1,4 @@
use common_utils::consts::TENANT_HEADER;
use futures::StreamExt;
use router_env::{
logger,
@ -140,10 +141,17 @@ where
// TODO: have a common source of truth for the list of top level fields
// /crates/router_env/src/logger/storage.rs also has a list of fields called PERSISTENT_KEYS
fn call(&self, req: actix_web::dev::ServiceRequest) -> Self::Future {
let tenant_id = req
.headers()
.get(TENANT_HEADER)
.and_then(|i| i.to_str().ok())
.map(|s| s.to_owned());
let response_fut = self.service.call(req);
Box::pin(
async move {
if let Some(tenant_id) = tenant_id {
router_env::tracing::Span::current().record("tenant_id", &tenant_id);
}
let response = response_fut.await;
router_env::tracing::Span::current().record("golden_log_line", true);
response